Current time: 05-23-2012, 06:56 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Votes - 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.)
Post: #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.

Peter
JVLOGS - Japan videos, blogs and news.
Find all posts by this user
Quote this message in a reply
06-24-2011, 10:23 AM
Post: #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
Find all posts by this user
Quote this message in a reply
08-04-2011, 06:47 AM
Post: #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 .

full color brochure printing
Visit this user's website Find all posts by this user
Quote this message in a reply
05-08-2012, 10:30 PM
Post: #4
RE: PHP includes in templates
Can we use header HTML and footer PHP?



Credit Report Monitoring
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)