12-21-2007, 04:49 PM
|
#1 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
preg_match and that stuff..
Hey!
I don't know barely anything about this, and I want to create a simple template system where I would replace variables.
What I would want is like this:
HTML Code:
Hello and welcome {user.username}!
Your last visit was {user.lastvisit} here on {site.name}!
The "username" is the key in the "user" array.
So
HTML Code:
{user.lastvisit}
would fetch
PHP Code:
$user['lastvisit']
PHP Code:
$user = array();
$user['lastvisit'] = 'something';
$user['username'] = 'Tanax';
$site = array();
$site['name'] = 'TalkPHP';
$values = array();
$values[] = $user;
$values[] = $site;
$tpl->parse('index', $values);
How would the function parse look like??
|
|
|
|