TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   templating system (http://www.talkphp.com/general/2287-templating-system.html)

TlcAndres 02-19-2008 10:14 PM

templating system
 
Well I'm making a CMS and I've added a basic templating system

Quote:

<{id}>
<{info.id}>
<{info.username.}>

Whats your opinion on adding functions to a templating system? such as {section} from smarty

Quote:

{section name=looz loop=$loop}
{$info.id}
{/section}

Wildhoney 02-19-2008 10:26 PM

Not at all keen. Slow for one, and also it's making up a completely new language -- aren't there already enough of them? In my opinion you should use the alternative syntax where HTML is involved:

php Code:
<?php foreach($aIceCream as $szIceCream): ?>
    Yum! <?php echo $szIceCream ice cream!
<?php endforeach; ?>

TlcAndres 02-19-2008 10:52 PM

Well my templating class parses and caches the files so they'd end up from

Quote:

{section name=looz loop=$loop}
<a href="index.php?c={$info.id}">{$info.id}</a>
{/section}
to (essentially..there are some finer points missing)

PHP Code:

<?php
foreach(array_keys($arr) as $key)
{
   
?><a href="index.php?c=<?php $arr[$key][$req_key[$i]]; ?>"><?php $arr[$key][$req_key[$i]]; ?></a>
<?php
}
?>

Though yes, the learning curve concerns me.


All times are GMT. The time now is 12:34 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0