Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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.
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

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 .
Can we use header HTML and footer PHP?

Credit Report Monitoring
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)