View previous topic :: View next topic |
Is smarty a fancy wrapper? |
Yes, it took weeks to manage it and saved not time at all. |
|
6% |
[ 1 ] |
No, it is an architecture which saves at least 1 hour per 8 hours of coding. |
|
25% |
[ 4 ] |
Yes and it enforces to split the design from the php coding. |
|
37% |
[ 6 ] |
Yes, but I have the discipline to split the design from the php coding by using functions, classes. |
|
6% |
[ 1 ] |
Yes, and it saves typing |
|
6% |
[ 1 ] |
No, it is the only method to create a presentation layer. |
|
6% |
[ 1 ] |
I don't know. It's too complicated to use. |
|
6% |
[ 1 ] |
I don't know. Someone told me to use it, because he/she told me that it is great. |
|
6% |
[ 1 ] |
|
Total Votes : 16 |
|
Author |
Message |
DRStins Smarty n00b
Joined: 05 Mar 2005 Posts: 4
|
Posted: Sat Mar 05, 2005 8:41 pm Post subject: smart? |
|
|
I still don't see the big advantage of smarty.
when you put all php code into classes and/or functions then are the scripts mean and clean and designers/programmers can't spoil much of their work.
When using css, then you can still create nice themes.
Gettext creates multilanguage.
Only a view fancy smarty features are missing but don't have to learn this smarty wrapper engine/language.....
Please tell me which advantages of smarty I did miss and are worth using smarty? |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Sun Mar 06, 2005 1:37 am Post subject: |
|
|
DRStins, no need for a poll for this topic, really.
If you don't think Smarty is suitable for you, no problem. If you have specific questions, please ask. "Is Smarty good" is not a very good way to look at the problem. Smarty is a tool with specific features and limitations. Depending on how you use it and when are where you use it you will give different results. Its a "use the right tool for the right job" proposition and Smarty is not always the right tool.
Go into the Article Discussions area of the forum. There are several topics that beat the "what does Smarty do", "is it useful" and "what are the tradeoffs" horses quite to death.
BTW: it sounds like you might be more interested in something like PHP Savant.
----------------
FWIW: other than the technical reasons--which have been discussed elsewhere ad nauseum--here are some reasons I think Smarty is great:
- Monte is a fantastic project leader and engineer. Easy to work with and easy going, he is very open to new ideas and participants but is always careful to ensure that new ideas and changes will fit in well with Smarty's existing framework. Asides from being active on the mailing lists and the forum, he has also been spending time developing several addon projects for Smarty which are also quite successful and useful.
- Messju's tireless maintenance and improvement of the codebase. Messju has really been instrumental in getting Smarty to the point of maturity that it has now. I really can't say enough about Messju's contributions nor his talent. It is very comforting to know that he is still working on the project.
- Active users. Check out the mailing lists and the forum. There are a lot of very smart and helpful active users. The amount of support and the continual improvements suggested and coded by the users is remarkable for such a small project. Asides from that, there are countless tutorials and articles that have been written about Smarty, as well as an active Wiki.
- Documentation (officially in seven languages, unofficially more are available) and 3rd party tools. I'll let those speak for themselves.
- Maturity. Smarty has been around for a LONG time. It is very mature in its features, stability, security and performance.
- Pretty much every complaint you can offer has been raised before. Still, Smarty eggs on and a lot of smart people continue to use it in various capacities.
- One last thing (which is technical) but which I really think helps separate Smarty from the rest: it has a very workable and extensible API. |
|
Back to top |
|
DRStins Smarty n00b
Joined: 05 Mar 2005 Posts: 4
|
Posted: Sun Mar 06, 2005 9:09 am Post subject: great team, api |
|
|
Thanks. I 'll have a look at the other discussions. Can you recommend one...
Great to know that it is supported by an excellent team and has an api. |
|
Back to top |
|
DRStins Smarty n00b
Joined: 05 Mar 2005 Posts: 4
|
Posted: Sun Mar 06, 2005 10:16 am Post subject: savant |
|
|
Yes, Savant might be interesting.
Thanks for the suggestion.
I still have some doubts. May be a code generator beats them all.
Or start with savant and compile it.
Do you use lex yacc or javacc or any other compilercompilers? I am still looking for a php grammar. |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Sun Mar 06, 2005 11:41 pm Post subject: |
|
|
DRStins, what are you trying to achieve?
Smarty is a compiler as well as a small execution framework. So it is a code generator. Savant is only an execution framework (guided by convention) though I understand in the 2.x series they have introduced the possibility of a compiler.
The fact that you are looking for a PHP grammar suggests that you are looking to do something more complicated than Smarty or Savant and/or that you are looking to write your own variation on the template engine. If so, I think you might want to reconsider -- a trivial implementation is a no-brainer, but getting it to a useful, productive and well tested state takes more time than you might imagine, especially in the face of so many existing projects that do the same.
So what are your goals? What brings you to Smarty (or a template engine) in the first place? If you are thinking lex/yacc et al. maybe you should be considering implementing in a different language altogether? IIR, PHP's grammar is based on FLEX and it ought to be included with he source distribution.
FWIW, Smarty's parsing is regex based. In general, implementing a more generic parser in PHP user-land code (even a basic recursive descent parser) tends to be expensive compared to a comparable parser in a lower-level language. I don't think it is really PHP's fault: I find the same issues in most late-bound, hash-driven, memory-centric languages.
There are several interesting threads in the Articles forum but this one covers a lot of bases and has input and opinions from many folks inside and outside of the community: http://www.phpinsider.com/smarty-forum/viewtopic.php?t=102 |
|
Back to top |
|
DRStins Smarty n00b
Joined: 05 Mar 2005 Posts: 4
|
Posted: Mon Mar 07, 2005 6:16 pm Post subject: compilercompiler |
|
|
Thanks for the information.
I just want to have fun with compilercompilers and did not decided where to start.
Just wondering how and with which tools the smarty developers built the great compiler option.
I would probably start with generating classes for handling foreign key's based a ddl inclusive (foreign key) constraints.
A tool like lex is not that hard to use. That might be enough for smarty or compile savant.... |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Mar 07, 2005 7:14 pm Post subject: Re: compilercompiler |
|
|
DRStins wrote: |
Just wondering how and with which tools the smarty developers built the great compiler option. |
I used the vi editor and referenced the PHP docs. |
|
Back to top |
|
Hockey Smarty Rookie
Joined: 15 May 2005 Posts: 30
|
Posted: Sun May 15, 2005 5:57 pm Post subject: Re: smart? |
|
|
DRStins wrote: | I still don't see the big advantage of smarty.
when you put all php code into classes and/or functions then are the scripts mean and clean and designers/programmers can't spoil much of their work.
When using css, then you can still create nice themes.
Gettext creates multilanguage.
Only a view fancy smarty features are missing but don't have to learn this smarty wrapper engine/language.....
Please tell me which advantages of smarty I did miss and are worth using smarty? |
Amatuer *coughs*
Go work on a site with 50+ PHP scripts using includes and classes and them come back to the smarty paradigm...
Template engines are a godsend...Smarty just happens to be the best documented and apparently most powerful OS project available....to the best of my knowledge
Listen....the longer you hold out on using Smarty...the longer I have an advantage over you...so by all means...STAY away from Smarty |
|
Back to top |
|
folkstreamer Smarty Rookie
Joined: 13 Sep 2003 Posts: 5
|
Posted: Fri May 20, 2005 9:47 pm Post subject: |
|
|
One of the reasons why I have switched to using template engines (in Perl and PHP) is how they help me think about and visualize the application structure.
I generally storyboard an application's workflow, even for a small one, because sometimes even a simple order form has complications (you should hear what my clients want).
The storyboard shows leaf nodes where there will be templates. This also lets me design the look and content of forms, generally each node is a form or response to a form submission. Each of these generally corresponds to a template.
So I can make up the templates through a mockup process (or a designer will do this), converting them to templates once they look is right.
A template system lets me think about presentation, forms, HTML validation, etc. when I'm working with the templates. I don't have to worry about the code. When I am working with code, I don't have to worry about the templates and their markup or style issues. Templates help simplify the application code, as do OOP form handlers. I can think of the application in terms of forms, screens and responses realized through the template engine.
And without any costs of most templating engines. I avoided template engines for a long time because they are horribly inefficient. The time spent substituting placeholders and parsing loops, etc. is wasted. I can vouch for this in HTML::Template. We once had to generate an 80 page document with charts on every page in HTML. The template engine crapped out halfway through. We had to switch to a host with more resources devoted to Perl (probably memory issue) to get it to run. Smarty compiles it's templates and has built-in caching, so I don't have to care how complex they are or how many queries are run in the making of a page.
There are some tradeoffs, and I sometimes find myself wishing that I could just generate everything from code, but I am sticking with templates over building pages and forms dynamically from the code.
I'm not as skilled in computer science as many here, with their frameworks and models, but that is my point of view.
Steve
www.folkstreams.net |
|
Back to top |
|
|