News for hackers. Stuff that matters.
Re:Show HN: A PHP parser written in PHP by ceejayoz on Wednesday February 22, 2012 @10:12AM (#3621125)
That's not a subset, that's just a different syntax.

If you're making a template language for use in a SaaS system, you'd want to perhaps allow echo, but not file_put_contents.

Re:Show HN: A PHP parser written in PHP by soult on Wednesday February 22, 2012 @10:36AM (#3621225)
Funny you say that, because what you are describing is already implemented and called the Smarty template system[1], one of the worst examples of the Inner-platform effect[2] the world has ever seen.

1: http://www.smarty.net/ 2: https://en.wikipedia.org/wiki/Inner-platform_effect

Re:Show HN: A PHP parser written in PHP by NameNickHN on Wednesday February 22, 2012 @11:45AM (#3621511)
I'm saying this for years now and people think I hate templates as a concept. I only dislike template systems like Smarty. Ever since I learned that there is a {php}{/php} tag in Smarty, I new the system was broken.
Re:Show HN: A PHP parser written in PHP by Gigablah on Thursday February 23, 2012 @05:46AM (#3624487)
{php}{/php} is deprecated as of Smarty 3.
Re:Show HN: A PHP parser written in PHP by bradt on Wednesday February 22, 2012 @10:56AM (#3621312)
The issue with Smarty is that it is yet another syntax to learn. A PHP template system that uses PHP for the logic and control structures makes a lot more sense IMO.
Re:Show HN: A PHP parser written in PHP by themonk on Thursday February 23, 2012 @03:26AM (#3624229)
That is what PHP is.
Re:Show HN: A PHP parser written in PHP by kemo on Wednesday February 22, 2012 @10:43AM (#3621260)
I don't really think Smarty has anything to do with this. Though I do agree on the "one of the worst examples" point.
Re:Show HN: A PHP parser written in PHP by jakejake on Thursday February 23, 2012 @02:57AM (#3624192)
Well apparently this is not a popular opinion around here but I actually like Smarty when the situation calls for it. In version 3 the "block" feature makes Smarty templates somewhat similar to .NET "Master Pages". I personally like using Smarty as the View in an MVC pattern. I've even used it for email message templates.

I have one reason for not using Smarty in my more recent work but it has nothing to do with my feelings about Smarty itself. Rather just that a lot of web apps lately have all of the view logic in the client. So the server rendering of the view is often just outputting mostly static HTML for the Javascript to use as it's starting point. So it's not that I dislike Smarty, it's just that there's barely any logic at all happening at that level so there's no need for it.

Re:Show HN: A PHP parser written in PHP by paulhauggis on Wednesday February 22, 2012 @11:31AM (#3621456)
I used to use smarty for all my projects. Mostly because I had designers working on them and it was easier for them to read/manage.

But, you can make just as readable code without smarty and load times are much faster (although smarty does have a caching system).

Re:Show HN: A PHP parser written in PHP by easy_rider on Wednesday February 22, 2012 @07:20PM (#3623208)
As someone who has been forced to work with on a social web-app using smarty, I find myself asking co-workers to "just kill me now". Hey atleast I'm having a fun time moving all the business logic those smart smarty guys from India put in...right? no more, No but seriously, kill it with fire.

And caching..on disk, who cares? In general, dO we not have better, faster and more versitile options that would in any way justify a choice for smarty?

Re:Show HN: A PHP parser written in PHP by AgentConundrum on Wednesday February 22, 2012 @06:43PM (#3623066)
PHP already has this: the `disable_functions` INI setting.[1]

Disclaimer: I've never had to use this, so don't know what the limitations and pitfalls are for this, and there may be security concerns that I'm unaware of.

[1] http://www.php.net/manual/en/ini.core.php#ini.disable-functi...