Re: [SMARTY] Smarty-Light

From: Date: Wed, 14 Jul 2004 22:47:27 +0000
Subject: Re: [SMARTY] Smarty-Light
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11591@lists.php.net to get a copy of this message
Back in the very early days of Smarty when the syntax was still developing, I actually wanted to stick to PHP syntax as close as possible, mostly because it was already well understood by PHP programmers and would be easier to integrate new functionality. But somewhere along the way it was decided to make a new syntax instead. The thinking was that this is a template engine, not a PHP program. The template syntax should be as simple and intuitive as possible, and since we have a chance to do that why not do things like: {$foo.bar.blah} instead of: {$foo['bar']['blah']} Also when it came to things like section loops, keeping the syntax to a minimum meant stepping into PHP syntax boundaries for other uses. ( eg. $foo[bar][blah] ) Well as Smarty evolved it certainly has shown its consequences of going this route. I'm thinking that Smarty will eventually turn a new leaf and be re-engineered from scratch (and that day may draw nearer as PHP 5 comes to life), and all the engine idioms can then be analyzed and decided upon. Monte boots wrote:
--- Vonleigh Simmons <nospam@illusionart.com> wrote:
because I didn't like some of the syntax issues (backticks for concatenation? why not use the PHP and Perl method of putting a dot between strings?)
     
I have to agree with that. The dot between strings is much more friendly. Any idea why it's not in smarty?
Because of BC, I suppose. Smarty already uses dot-notation for array-key access. Dot-notation concatenation doesn't really have a long history in other languages, though it might be a surprise for people with only PHP. Also, unlike PHP, Smarty doesn't require literal strings to be quoted which complicates the matter. Backticks are actually more similar to PHP's {} string replacer. I guess we all have something that niggles at us in these regards. What I don't like is the -> notation for attributes/methods instead of dot notation. (oh yeah, and modifiers can't have white spacing)


« previous php.smarty.general (#11591) next »