Variable Replacement
| From: | James Williams | Date: | Thu, 03 Mar 2005 05:42:06 +0000 |
| Subject: | Variable Replacement | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-209882@lists.php.net to get a copy of this message | ||
Hey guys, I'm coding a forum right now and I just decided that I needed to code some variable replacement to create a simple template system. This is the code I have but it doesn't work
------------------------------------------------------------------------
|<?php
$tpl = file <http://php.net/file>("tpl/head.tpl");
$code = str_replace
<http://php.net/str_replace>("{sitename}",$config['sitename'],$tpl);
foreach ($code as $codeline) {
print <http://php.net/print>($codeline);} ?>| ------------------------------------------------------------------------ This simply results in a mess, with only the pictures showing up on my page... I know this code is horrible but I have no idea how to go about doing this. I've never worked with reading files and whatnot before