Hello There, Guest! Register

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PHP includes in templates
06-24-2011, 08:53 AM, (This post was last modified: 06-24-2011, 09:09 AM by pita matein.)
PHP includes in templates
I have a header.html and footer.html file I use as being common to all areas of the site into which I'd like to incorporate THT. In htdocs that allow PHP, it just involves

PHP Code:
<?include 'pathto/header.html'?>

I'm not familiar with THT templating but apparently the tpl files do not allow PHP. I tried this in includes/variables.php

PHP Code:
$data preg_replace("/<HEADER>/si"'<?php include "pathto/header.html"; ?>'$data); 

but it didn't work. Is there a way to do this (include content from another file in the tpl files)? Thanks in advance.
06-24-2011, 10:23 AM,
RE: PHP includes in templates
It's because of how the output buffer is arranged, no parsing will be allowed in the templates them selves. Makes us work cleaner.

Just remove the quotes and place the code there for it to put the html in the template?

PHP Code:
$data preg_replace("/<HEADER>/si", include "pathto/header.html"$data); 
Jonny H - THT Main Developer & Founder

08-04-2011, 06:47 AM,
RE: PHP includes in templates
Then I created a file archive_files.php and put an include statement in the template page for this archive_files... but I could not get it .
05-08-2012, 10:30 PM,
RE: PHP includes in templates
Can we use header HTML and footer PHP?

Credit Report Monitoring
10-14-2012, 11:00 PM,
RE: PHP includes in templates
instead of
PHP Code:
<?php include("archive_files.php"); ?>
PHP Code:
<? include("archive_files.php"?>
use something like
<embed src="/directory/archive_files.php">

Forum Jump:

Users browsing this thread: 1 Guest(s)