PHP&Smarty Why use it? 怎样使用smarty的..

2008-01-25 23:13 来源: smarty 作者:phpma 网友评论 0 条 浏览次数 0

Smarty is too complicated, how can it be that fast?

Smarty's core is pretty lean considering what it is capable of. Most of its functionality lies in plugins. The plugin architecture is designed so that only the required plugins are loaded on demand. With this framework, adding even hundreds of new plugins will not affect performance. This makes Smarty fast, scalable and flexible.

Smarty also has caching features that can dynamically refresh and keep portions of the page uncached at your liking. Caching stores the output of the compiled templates, saving the need to execute them on each invocation.

All this talk about accelerators, how does Smarty run without one?

Actually it runs pretty well without one. Smarty does not require an accelerator, but the template files themselves will take advantage of one, something that is unique to Smarty (AFAIK). If you don't have an accelerator, template execution isn't as fast but not slow by any means since they aren't parsed! You also retain all the other benefits and features of Smarty. Also, since accelerators are freely available there isn't really an excuse to not be using one. They'll help performance with all PHP apps, using Smarty or not.

How can it be easier to maintain?

Some things can't be explained, but only experienced :-) The benefit of separation of the application logic from the presentation cannot be stressed enough. Smarty also has some nice error handling features and a built-in debugging console so you can see the template heirarchy and assigned variables at a glance. Adding custom features to Smarty is as easy as dropping them in the plugin directory and mentioning them in the template.

The template tags are not XML based, My editor doesn't like it.

The {} delimiters are just a default, they are easy to discern among HTML tags. If you don't like them, change your delimiters to <% %> or maybe something more XMLish like <smarty: > There are also lots of user contributions for dreamweaver and the like, give them a look in the contribs area.

That's Smarty in a nutshell, hopefully you can add it to your arsenal of tools for web application building. To really learn more, read the manual top to bottom, join the forums and see what people are discussing.

[上一页1  2  3  4 
上一篇:Smarty php Cras..    下一篇:Using suexec To ..

相关主题:

网友评论