Re: Problem with a regex!
| From: | Julian Wood | Date: | Sun, 28 Jan 2001 01:44:20 +0000 |
| Subject: | Re: Problem with a regex! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-37070@lists.php.net to get a copy of this message | ||
Why not use the php mechanism itself? An easy way to do a template system is
make a normal php page as a template, and then include it from another page
after specifying a bunch of variables.
eg.
template.php:
=========
<html><head><title><?= $title ?></title></head></html>
calling page:
=============
<?php
$title = "My template system";
include ('template.php');
?>
Hope this helps,
Julian
on 1/27/01 6:17 PM, Zack Ham at hamoe@sect0r.com wrote:
>
> I'm trying to create a small template parser so I can fill my html pages up
> with data. An example:
> <html><head><title>{title}</title></head></html
>
> What I'm trying to do is run through it and replace {title} with an
> appropriate value. I have tried running ereg_replace("{$var}",$value,$string)
> and ereg_replace("\{$var\}",$value,$string). Neither work. They either do
> nothing or produce the error "Warning: invalid content of \{\}".
>
> Any help would be appreciated,
> Zack
>
> _____________________________________________________________
> Free email provided by ---> http://sect0r.com
--
Julian Wood
Learning Technologies and Digital Media
University of Calgary