
July 2nd, 2005, 02:47 AM
|
|
|
|
Join Date: Apr 2007
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
PHP Template System Code
ok, I have been trying to figure this out for a while, with no luck. I used the Writing a Template System in PHP tutorial to generate a template system for my site.I am trying to implement a block system into this class.
php Code:
Original
- php Code |
|
|
|
<?php class Page { var $page; function Page($template = "template.html") { $this-> page = join("", file($template)); else die("Template file $template not found."); } function parse($file) { include($file); return $buffer; } function replace_tags ($tags = array()) { foreach ($tags as $tag => $data) { $data = (file_exists($data)) ? $this-> parse($data) : $data; $this->page); } else die("No tags designated for replacement."); } function output() { } } ?>
I want to make it so in the .tpl file, I can do this:
<!-- LOGGED_IN BEGIN -->
Code that displays only if the block is TRUE
<!-- LOGGED_IN END -->
that set that block code so it will act like below if it was not a template file.
php Code:
Original
- php Code |
|
|
|
if(isset($_SESSION['loggedin']){ echo "Code that displays only if the block is TRUE"; }
If anyone can help me with this it would be very appreciated.
I know this was discussed in another topic, but it was not the same thing, the other topic was looking at looping stuff. But I did searchg before I posted this request.
|