My next step in php is to tro to learn how to use a template system. by this i mean where i can have a page called index.php and the design would be determined by index.tpl
Then id like to be able to do what phpbb templates do and have {SOMETHING_COOL} to display a certain text or item.
Anyone know of any tutorials on this?
Comments
not sure if they have any but they have tutorials for pretty much everything else
The Royal Ram
[code:1:f73c78e1e3]$tpl = file_get_contents('index.tpl');
$tpl = str_replace('{SOMETHING_COOL', 'Something else', $tpl);
echo $tpl;[/code:1:f73c78e1e3]
Of course, you'd probably stick this into a class of some sort.
Webmaster-Talk.com
Chroder.com
The Royal Ram
[code:1:51e8a5b040]$lang = array('hello' => 'Hello', 'welcome' => 'Welcome to DD', 'time' => 'It\'s time again!');
foreach($lang AS $k => $v)
{
$tpl = str_replace("{LNG.$k}", $v, $tpl);
}
echo $tpl;[/code:1:51e8a5b040]
So in that example, {LNG.hello} would be replaced with 'Hello' etc.
Webmaster-Talk.com
Chroder.com
thanks for joining in and posting but it would be better if you didnt spam.
The Royal Ram
sorry if you though it was spaming i will not do it again
i wont count it against you
so why dont you introduce yourself. maybe even get some reviews on your site at our reveiws section
The Royal Ram
Python, I've been looking for this sort of a thing for a while and never thought to ask. Thanks for posting the thread, and I'll be sure to read it when I start learning a little more PHP; at the moment I probably could understand it, I'm just not willing to without being in must-learn-PHP-mode.
Host Assessment | Tetris | Blog | Great Big Blog
Buy Video Games | Nathan
Video Game Cheats Hints Codes | Click Joke | Game Livewire
Host Assessment | Tetris | Blog | Great Big Blog
Buy Video Games | Nathan
Video Game Cheats Hints Codes | Click Joke | Game Livewire
Hmm, phpBB has no split feature apparently.
Webmaster-Talk.com
Chroder.com
its does its just i havent got a clue how to split topics, hehe.
ill learn soon
plus your a mod
The Royal Ram
Check out the articles on Devshed.com, there is a five part series on there about building a site engine CMS, its a little incomplete but it has a lot of good ideas. I am working a version at the moment using PHP 4. Templates are XML based so I am writing a parser that emulates the simpleXML functionality in PHP5.
Cheers
Simon