Smarty
I was talking with Ahmed Soliman about a week ago and dkSystem came up, heh. He asked me what I used to manage my templates and I told him that it was hardcoded in the system, of course. He told me that that is not a very wise method of managing templates of a system, and I should use a template engine - which I had no idea what it was lol.
So I searched, and the first result (after wikipedia’s result) I got was Smarty, php’s official template engine - which I honestly never heard of (of course, I didn’t even know what a template engine was to know of the brands).
Now after reading the crash course they have at the website I was stunned by how easy it was to use, not only that, but today earlier on when I decided to finish off dkSystem (finally) and had a closer look at Smarty, I couldn’t believe how easy it was to integrate it with dkSystem, unbelievable!
// let's make sure we have a valid template
// ****************************************
// thanks to Ahmed Soliman (http://ahmedsoliman.com)
// for suggesting to use a template engine =)
$dkclass->dk->smarty->assign('addheight', $addheight );
$dkclass->dk->smarty->assign('editheight', $editheight );
$dkclass->dk->smarty->assign('acp_style', $acp_style );
$dkclass->dk->smarty->assign('time', $time );
$dkclass->dk->smarty->assign('query', $query );
$dkclass->dk->smarty->assign('components_buttons', $components_buttons );
$dkclass->dk->smarty->assign('custom_copyright', $custom_copyright );
$dkclass->dk->smarty->assign('browser_message', $browser_message );
$dkclass->dk->smarty->assign('output', $dkclass->dk->output );
$dkclass->dk->smarty->assign('title', $dkclass->dk->title );
// ********************************************
// the end
$dkclass->dk->smarty->display('index.tpl');
The good part is that styling a theme now is much much easier, AND SAFER! Easier because the designer does not have to know any PHP, rather read this, and safer because the designer does not need to change anything in the source files to create different looking output.
Well, there’s far more to Smarty than just this, there’s plenty more.
About this entry
You’re currently reading “ Smarty ,” an entry on My Days. My Life.
- Published:
- oct 4th, '07 / 3am
- Number of comments:
- 6
- Number of views:
- 406
- Category:
- Critics, Development













