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.)
#1
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.
Reply
06-24-2011, 10:23 AM,
#2
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?

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


Reply
08-04-2011, 06:47 AM,
#3
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 .
Reply
05-08-2012, 10:30 PM,
#4
RE: PHP includes in templates
Can we use header HTML and footer PHP?



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


Forum Jump:


Users browsing this thread: 1 Guest(s)