Search
User
Recommend this pageIf this page was useful to you, please recommend it to fellow websurfers:
Home > Scripts > Development Tools > Template Engines
Rating | |
---|---|
You may rate this script by simply clicking on the appropriate star (5 stars is the best rating).
|
|
Language | |
![]() |
PHP |
License | |
![]() |
Smarty requires a web server running PHP 5.2 or greater.
When it comes to templating in PHP, there are basically two camps of thought. The first camp exclaims that “PHP is a template engine”. This approach simply mixes PHP code with HTML. Although this approach is fast from a pure script-execution point-of-view, many would argue that the PHP syntax is messy and difficult to maintain when mixed with presentation. PHP works well for programming, but not so well for templating.
The second camp exclaims that presentation should be void of all programming code, and instead use simple tags to indicate where application content is revealed. This approach is common with other template engines (and other programming languages), and is the approach that Smarty takes. The idea is to keep the templates focused squarely on presentation, void of application code, and with as little overhead as possible.
There are many benefits of separating PHP code from templates, some of which are:
Smarty:
No different than PHP being an abstraction layer on top of C to simplify development, Smarty is an abstraction layer on PHP to simplify template maintenance.
A common question: “Web designers have to learn a syntax anyways, why not PHP?” Of course web designers can learn PHP, and they may already be familiar with it. The issue isn’t their ability to learn PHP, it is about the maintenance of PHP mixed with HTML. tags are simpler, more intuitive, and less fragile than PHP statements. Templates also restrict what can be put in a template. PHP makes it too easy to add code into templates that doesn’t belong there. You could teach designers the rules of application design, but this should be unnecessary (now they are developers!). The PHP manual is intended for developers. Designers would only need a small fraction of this manual, and it doesn’t make it easier for them to find what they need. Smarty gives web designers exactly the tools they need, and gives developers fine-grained control over these tools. Numerous features are also available for presentation such as template inheritance, which maximizes template re-use and streamlines organization.
Although Smarty gives you the tools to make a clean separation of presentation from application code, it also gives you plenty of room to bend those rules. A poor implementation (i.e. injecting PHP in templates) will cause more problems than the presentation separation was meant to resolve. The documentation does a good job of indicating what things to watch out for.
Under the hood, Smarty compiles copies of the templates as PHP scripts. This way you get the benefits of both template tag syntax and the speed of PHP. Compilation happens once when each template is first invoked, and then the compiled versions are used from that point forward. Smarty takes care of this for you, so the template designer just edits the Smarty templates and never has to manage the compiled versions. This approach keeps the templates easy to maintain, and yet keeps execution times extremely fast. Since the compiled versions are PHP, op-code accelerators such as APC or ZendCache continue to work on the compiled scripts.
Template inheritance is new to Smarty 3, and it’s one of many great new features. Before template inheritance, we managed our templates in pieces such as header and footer templates. This organization lends itself to many problems that require some hoop-jumping, such as managing content within the header/footer on a per-page basis. With template inheritance, instead of including other templates we maintain our templates as single pages. We can then manipulate blocks of content within by inheriting them. This makes templates intuitive, efficient and easy to manage.
This label indicates that I could install the script without major problems and I could run the script without the need for major modifications to the original code (except for the usual configuration, of course). The label does, on the other hand, not indicate that scripts without this label would not work properly. The missing of the „tested & working“-label just indicates that I did not yet test these scripts.
This label indicates that the owner of this website uses this script / application for his own projects with success and satisfaction. This does, however, not indicate that these projects could not have been realized using other scripts / applications as well or that other scripts would not fit the demands of other projects as well or even better.
Smarty Smarty
23 August 2023, 11:54, by Amado ChitwoodPost writing is also a fun, if you be acquainted with after that you can write
otherwise it is complicated to write.
Feel free to surf to my site: viagra
Smarty Smarty
5 January, 20:38, by EttaHey there, I think your site might be having browser compatibility issues.
When I look at your blog site in Safari, it looks fine but
when opening in Internet Explorer, it has some overlapping.
I just wanted to give you a quick heads up! Other then that,
excellent blog!
Here is my blog post :: Click This Link (Brigida)
Smarty Smarty
11 January, 11:04, by RitaWhat’s up i am kavin, its my first time to commenting anyplace, when i read this piece of writing i thought
i could also make comment due to this brilliant article.
My web blog - his response; Geri,
Smarty Smarty
15 January, 22:21, by Osvaldo BoykinHi! Someone in my Myspace group shared this site with us so
I came to take a look. I’m definitely enjoying
the information. I’m book-marking and will be tweeting this to my followers!
Outstanding blog and amazing design and style.
Review my page - Going Here (Staci)
Smarty Smarty
22 January, 15:42, by Eloy BeichFor most recent news you have to go to see internet and on the web I
found this web page as a finest web page for latest updates.
Also visit my blog post :: have a peek at this website (Francesco)
Smarty Smarty
30 January, 10:21, by Phylliswhoah this weblog is fantastic i like reading your posts.
Keep up the good work! You understand, a lot of persons are looking around for this information, you can aid them greatly.
Feel free to surf to my web page :: look here (Elana)
Smarty Smarty
2 February, 17:13, by ElisabethI’d like to thank you for the efforts you have put in writing this website.
I’m hoping to view the same high-grade blog posts from you later
on as well. In truth, your creative writing abilities has motivated me to get my own, personal website now ;)
Here is my homepage - browse around this site; Flynn,
Smarty Smarty
2 February, 21:35, by MarcelinoWow, amazing blog layout! How lengthy have you been blogging for?
you made running a blog glance easy. The entire glance of your web site is fantastic, as well as the content material!
Take a look at my blog post ... pop over to this web-site (Muriel)
Smarty Smarty
6 February, 16:24, by JessikaIf some one needs to be updated with most up-to-date
technologies afterward he must be pay a quick visit this web
site and be up to date everyday.
My web page click this (Jessie)
Smarty Smarty
6 February, 18:03, by DanteThanks for sharing your thoughts about Continue. Regards
Also visit my site: website link (Reta)
Smarty Smarty
9 February, 05:51, by DeniceWow, that’s what I was exploring for, what a material! present here at this website,
thanks admin of this website.
Here is my web-site; this page (city-wiki.win)
Smarty Smarty
9 February, 08:28, by HelenI for all time emailed this web site post page to all my friends,
because if like to read it next my contacts will too.
Feel free to visit my website - hop over to here [Sallie]
Smarty Smarty
9 February, 10:41, by CheryleAhaa, its nice dialogue regarding this piece of writing at this place at this website, I have read all
that, so now me also commenting at this place.
Also visit my web page: directory (mag-wiki.win)
Smarty Smarty
12 February, 19:26, by Dollie Bunburyall the time i used to read smaller content which also clear their motive,
and that is also happening with this article which I am reading at this time.
Visit my web blog ... directory; Caitlyn,
Smarty Smarty
12 February, 22:38, by GonzaloHello everybody, here every person is sharing these knowledge, thus it’s pleasant to read this
webpage, and I used to visit this webpage every day.
Here is my page - click here now (Elinor)
Smarty Smarty
6 March, 17:16, by TiffaniI feel this is among the so much important information for me.
And i’m satisfied reading your article. However want to statement on some basic issues, The web site style
is perfect, the articles is actually excellent : D. Just
right process, cheers
My page visite site (Melanie)
Smarty Smarty
25 March, 06:31, by Melanie HansfordHey there just wanted to give you a quick heads up and let you know a few of the images aren’t loading properly.
I’m not sure why but I think its a linking issue.
I’ve tried it in two different internet browsers and both show the
same results.
Review my web page ... additional hints (securityguardagency0.blogspot.com)
Smarty Smarty
26 March, 09:26, by Tommy CremorYou should take part in a contest for one of the best blogs on the web.
I will highly recommend this website!
Feel free to visit my web page this link
Smarty Smarty
2 April, 09:25, by HiltonHello, i feel that i noticed you visited my weblog so i came to return the prefer?.I’m trying to find
issues to improve my website!I assume its adequate to make use of
a few of your ideas!!
Also visit my page ... 6gaodazZFK96XukErebXZnas4XXPbkPc3SkoAuKcnyxA; privatebin.net,
Smarty Smarty
3 April, 04:34, by NigelGreat information. Lucky me I ran across your site by
accident (stumbleupon). I’ve book-marked it for later!
Stop by my page :: read what he said (yenkee-wiki.win)
Smarty Smarty
8 April, 08:47, by ToshaFor hottest information you have to go to see world wide web and
on web I found this web site as a finest web page for newest updates.
Here is my site discover this info here [Vanita]
Smarty Smarty
8 April, 11:55, by RobIt is appropriate time to make some plans for the future and
it is time to be happy. I have read this post and if I could I desire to
suggest you some interesting things or advice.
Perhaps you can write next articles referring to this article.
I desire to read more things about it!
Have a look at my webpage: Read Full Report (wiki-velo.win)
Smarty Smarty
19 April, 17:35, by Brooke CadeHi there, its pleasant article regarding media print, we all be familiar
with media is a great source of data.
Feel free to surf to my site Learn More (Kourtney)
Smarty Smarty
19 April, 18:21, by Edmundo TostWOW just what I was looking for. Came here by
searching for you could check here
my webpage: Source [https://tysonrehh950.wordpress.com/2024/03/07/securing-your-organization-critical-methods-for-industrial-safety-alternatives-in-the-large-apple]
Smarty Smarty
19 April, 19:36, by MohamedHi there, just wanted to mention, I loved this blog post.
It was funny. Keep on posting!
My blog; visit this web-site, https://wiki-mixer.win/index.php?title=Securing_Your_Belongings:_Essential_Advice_for_Reduction_Prevention_Safety_Companies_in_The_big_apple_92337,
Smarty Smarty
19 April, 22:34, by LynellHello there! Would you mind if I share your blog
with my twitter group? There’s a lot of folks that I think would really appreciate your content.
Please let me know. Thanks
Feel free to surf to my web blog you could try here; tango-wiki.win,
Smarty Smarty
25 April, 12:18, by RhodaThis is a topic which is close to my heart... Cheers!
Where are your contact details though?
my web site - More Bonuses [Reta]
Smarty Smarty
25 April, 20:24, by GaryHi! Someone in my Facebook group shared this website with us so I came to take a look.
I’m definitely enjoying the information. I’m book-marking and will be tweeting this to my followers!
Wonderful blog and brilliant design.
My web blog - go to this web-site (Shasta)
Smarty Smarty
29 April, 18:47, by GarnetIt’s a pity you don’t have a donate button! I’d without
a doubt donate to this excellent blog! I suppose for now i’ll settle for bookmarking and adding
your RSS feed to my Google account. I look forward to brand new
updates and will talk about this blog with my Facebook group.
Chat soon!
Here is my blog post - explanation [Milford]
Smarty Smarty
29 April, 19:20, by Magnolia WomackHello! Do you use Twitter? I’d like to follow you if that would be ok.
I’m undoubtedly enjoying your blog and look forward to new updates.
Check out my webpage his response, Hazel,
Smarty Smarty
10 May, 22:46, by DominickI like the valuable information you supply on your articles.
I’ll bookmark your blog and check once more right here regularly.
I am moderately sure I will be told lots of new stuff proper right here!
Best of luck for the next!
Have a look at my web site; you could try these out (Mickey)
Smarty Smarty
22 May, 02:34, by Vada ConstantKeep this going please, great job!
Here is my page :: Go Here (Constance)
Smarty Smarty
18 June, 14:50, by RickieHello there! This is kind of off topic but I need some guidance from an established
blog. Is it very hard to set up your own blog?
I’m not very techincal but I can figure things out pretty
fast. I’m thinking about creating my own but I’m not sure where to begin.
Do you have any ideas or suggestions? Appreciate it
Also visit my blog - site here (Fern)
Smarty Smarty
20 June, 19:36, by QuentinThanks for your personal marvelous posting! I seriously enjoyed reading it, you can be a great author.
I will always bookmark your blog and may come back from now
on. I want to encourage that you continue your
great job, have a nice evening!
Feel free to visit my webpage here are the findings (Savannah)
Smarty Smarty
24 June, 22:49, by Shawnee NavarreteHey! I’m at work surfing around your blog from my new iphone!
Just wanted to say I love reading your blog and look forward to all your posts!
Carry on the fantastic work!
Also visit my homepage his comment is here (Addie)
Smarty Smarty
25 June, 13:45, by PasqualeIts not my first time to go to see this web page, i am visiting this
web site dailly and take nice facts from here every day.
my web-site: additional resources (Felisha)
Smarty Smarty
26 June, 18:29, by BeckyIf some one wishes to be updated with most up-to-date technologies then he must be pay a quick
visit this web site and be up to date daily.
Review my web site :: you can check here (https://www.magcloud.com/user/elbertpqma)
Smarty Smarty
27 June, 20:10, by Savannah TuckettDefinitely consider that that you said. Your favorite justification seemed to be on the internet the simplest factor to have
in mind of. I say to you, I definitely get annoyed at the same time as
people consider concerns that they plainly don’t realize about.
You managed to hit the nail upon the top and also outlined out the entire thing with no need
side effect , other people can take a signal. Will probably be again to get
more. Thank you
my blog: check here (Stacia)
Smarty Smarty
9 July, 12:43, by ChastityHeya i am for the first time here. I found this board and I to find It
truly helpful & it helped me out a lot. I am hoping to provide one thing back and aid others like you helped me.
Feel free to visit my web blog visit this web-site (Philip)
Smarty Smarty
9 July, 23:05, by CatherineHey! I just wanted to ask if you ever have any problems with hackers?
My last blog (wordpress) was hacked and I ended up losing
many months of hard work due to no data backup. Do you
have any methods to stop hackers?
My homepage - Home Page (Jerome)
Smarty Smarty
12 July, 17:23, by EdwardOh my goodness! Incredible article dude! Many
thanks, However I am experiencing difficulties with your RSS.
I don’t understand why I am unable to join it. Is there anybody getting identical RSS problems?
Anybody who knows the solution can you kindly respond?
Thanks!!
My website; like this - Jade,
Smarty Smarty
12 July, 17:50, by SammieI have read so many articles or reviews concerning the blogger
lovers but this article is genuinely a nice article,
keep it up.
Visit my page ... look at this now (Jaqueline)
Smarty Smarty
16 July, 11:50, by PenelopeWOW just what I was looking for. Came here by searching for anchor
Here is my web site click for source (ericktioz075.edublogs.org)
Smarty Smarty
16 July, 22:44, by KishaYesterday, while I was at work, my cousin stole my iPad and
tested to see if it can survive a forty foot drop, just so she can be a youtube
sensation. My iPad is now broken and she has 83 views.
I know this is totally off topic but I had to share it with someone!
Check out my webpage visite site (Ivory)
Smarty Smarty
17 July, 06:04, by AdanHi, i feel that i noticed you visited my blog thus i came to go back the want?.I’m trying
to in finding things to improve my site!I guess
its ok to make use of some of your ideas!!
Feel free to surf to my website ... pop over here, Marian,
Smarty Smarty
19 July, 01:42, by ClydeHello colleagues, fastidious piece of writing and fastidious arguments commented at
this place, I am genuinely enjoying by these.
my blog post that site (americanverified.com)
Smarty Smarty
19 July, 02:14, by BerylAttractive section of content. I just stumbled upon your blog and
in accession capital to assert that I acquire actually enjoyed account your blog posts.
Any way I’ll be subscribing to your augment and even I achievement you
access consistently quickly.
My webpage try this site (Hellen)
Smarty Smarty
19 July, 05:26, by GeorginaUseful information. Fortunate me I discovered your site by chance, and I am shocked why this twist
of fate did not took place in advance! I bookmarked it.
Feel free to visit my blog post - visit this site right here (dpaste.com)
Smarty Smarty
22 July, 20:49, by Lowell HartwickNice post. I was checking constantly this blog and I am impressed!
Very useful information specifically the last part :) I care for
such information a lot. I was looking for this certain info for a long time.
Thank you and good luck.
Here is my webpage: discover this info here (Phillis)
Smarty Smarty
23 July, 21:46, by MaurineWow that was odd. I just wrote an very long comment but after I clicked submit my comment didn’t show up.
Grrrr... well I’m not writing all that over again. Anyhow, just
wanted to say wonderful blog!
Also visit my website click for info; Nancee,
Smarty Smarty
26 July, 18:31, by Adell O’BryanHighly energetic article, I loved that bit. Will there be
a part 2?
my site great site (Stephen)
Smarty Smarty
26 July, 19:20, by WilmaHey exceptional website! Does running a blog like this require a
large amount of work? I have very little understanding of programming however I
had been hoping to start my own blog soon. Anyhow, if you have any recommendations or techniques for
new blog owners please share. I understand this is off topic nevertheless I
just needed to ask. Many thanks!
Feel free to visit my web site: learn the facts here now (Annmarie)
Smarty Smarty
26 July, 20:43, by AutumnExcellent article. I’m dealing with some of these issues as well..
my web site :: blog here (Manie)