Branches
Releases
|
Version
|
Focus
|
Date
|
|
2.6.10
|
Minor bugfixes |
20-Oct-2005 11:02 |
|
2.6.8
|
Minor security fixes |
23-Mar-2005 17:59 |
|
2.6.6
|
Minor bugfixes |
02-Nov-2004 11:29 |
|
2.6.5
|
Minor bugfixes |
14-Sep-2004 03:08 |
|
2.6.4
|
Minor bugfixes |
07-Sep-2004 19:29 |
|
2.6.3
|
Minor bugfixes |
17-Jun-2004 03:52 |
|
2.6.1
|
Minor bugfixes |
17-Jan-2004 07:18 |
|
2.6.0
|
Major feature enhancements |
20-Nov-2003 00:08 |
|
2.5.0
|
Minor feature enhancements |
12-Apr-2003 18:21 |
|
2.4.2
|
Major feature enhancements |
12-Feb-2003 21:39 |
Articles referencing this project
Comments
[»]
design problem with smarty
by dyuti_leo - May 2nd 2006 00:33:07
while using php we can show various category name rowwise with more than
one column in each row.
like: using while loop with mysql_fetch_array()
we can loop the result.
within the loop if we use mysql_fetch_array()
again, then the pointer jumps to next record.
I found it impossible using smarty. We cant go to next record within any
loop. For this purpose we have to make static pages while it can be made
dynamic if written in raw php.
if anybody faced this problem and has a solution pls reply.
[reply]
[top]
[»]
Re: design problem with smarty
by endless552001 - Mar 14th 2007 06:51:21
Smarty can use foreach within foreach like below.
{foreach from=$sample item=test}
{foreach from=$test item=item}
{$item.value}
{/foreach}
{/foreach}
[reply]
[top]
[»]
Re: design problem with smarty
by marionconsulting - Jun 20th 2007 22:32:53
> while using php we can show various
> category name rowwise with more than one
> column in each row.
>
> like: using while loop with
> mysql_fetch_array()
> we can loop the result.
> within the loop if we use
> mysql_fetch_array()
> again, then the pointer jumps to
> next record.
>
> I found it impossible using smarty. We
> cant go to next record within any loop.
> For this purpose we have to make static
> pages while it can be made dynamic if
> written in raw php.
>
> if anybody faced this problem and has a
> solution pls reply.
Smarty can definitely handle the situation. Pleaes provide code and an
example of exactly what you want to do and I'll show you how to do it in
Smarty.
-- www.marionweb.com Expert web development specializing in PHP, Smarty, MySQL, Apache, LAMP.
[reply]
[top]
[»]
What a bad idea
by Jeremy - Mar 30th 2006 12:52:44
Smarty is quite possibly the worst idea for a template engine I have ever
seen. It says in their documentation that it makes it so that web page
designers do not have to deal with PHP code syntax, but instead an
easy-to-use templating syntax not much different than plain HTML
(http://smarty.php.net/rightforme.php). Consider the following Smary
“Code”
{if $smarty.session.user and ( $user_type eq "editor" or
$user_type eq "admin" )}
<input type=checkbox name=edit value="y"> edit
<br>
{/if}
That looks a lot like a programming language to me, and Smarty is nothing
like HTML. It is just another programming language with HTML embedded into
it just like PHP. If the designer has to learn how to program anyways why
not just use PHP? Now if a PHP programmer ever has to change something in
the presentation layer he has to learn a new language. It’s kind of like
writing a windows program in C# then using VB for the presentation layer.
There really isn’t anything wrong with it but there is no point either, why
not just write the whole thing in C#? That would save the trouble of
learning 2 languages for no reason. Smarty is just a big waste of time and
resources.
-- Jeremy
[reply]
[top]
[»]
Re: What a bad idea
by Monte Ohrt - Sep 19th 2007 12:36:24
You obviously haven't used Smarty if you think it's sole purpose is an
alternative syntax for template designers. That is a very small part of it,
and more of a side-effect than a purposed feature.
> Smarty is quite possibly the worst idea
> for a template engine I have ever seen.
> It says in their documentation that it
> makes it so that web page designers do
> not have to deal with PHP code syntax,
> but instead an easy-to-use templating
> syntax not much different than plain
> HTML
> (http://smarty.php.net/rightforme.php).
> Consider the following Smary “Code”
>
> {if $smarty.session.user and (
> $user_type eq "editor" or
> $user_type eq "admin" )}
> <input type=checkbox name=edit
> value="y"> edit <br>
> {/if}
>
> That looks a lot like a programming
> language to me, and Smarty is nothing
> like HTML. It is just another
> programming language with HTML embedded
> into it just like PHP. If the designer
> has to learn how to program anyways why
> not just use PHP? Now if a PHP
> programmer ever has to change something
> in the presentation layer he has to
> learn a new language. It’s kind of like
> writing a windows program in C# then
> using VB for the presentation layer.
> There really isn’t anything wrong with
> it but there is no point either, why not
> just write the whole thing in C#? That
> would save the trouble of learning 2
> languages for no reason. Smarty is just
> a big waste of time and resources.
>
[reply]
[top]
[»]
Re: What a bad idea
by Monte Ohrt - Sep 7th 2008 02:15:00
> Consider the following Smary “Code”
>
> {if $smarty.session.user and (
> $user_type eq "editor" or
> $user_type eq "admin" )}
> <input type=checkbox name=edit
> value="y"> edit <br>
> {/if}
>
> That looks a lot like a programming
> language to me, and Smarty is nothing
> like HTML.
You didn't read the whole page. That is an example of what NOT to put in
the template page (application logic.)
[reply]
[top]
[»]
What actual benefit do I get?
by streetjesus - Jun 8th 2002 06:33:17
Hi there.
I testet Smarty and had a look at the documentation. Now, however, there
remain some questions.
The syntax within Smarty templates is similar to the common PHP syntax. I
output a variable using the notation {$MyVar} - in a PHP script, I would
write <?=$MyVar?>. Then I have modifiers and plugins like
"upper" doing tasks that are already covered by native PHP
funktions (e/g strtoupper()) - yet the Smarty stuff is less flexible in use
(and probably slower since PHP functions are called via the "template
engine detour"). All in all, any template designer will have to dig
into the Smarty syntax and learn it before they can create working
templates.
If I got it right, the compilation of templates means that files are
translated from the "Smarty language" to PHP, meaning of course
that these compiled scripts will be parsed again by the PHP parser on
request.
Nothing against that - but when the syntax is so similar, why do we need
the Smarty templates in the first place?
So from my point of view this template engine just looks a little like a
big wrapper that does things you could do with plain PHP - and yet it is
not much easier to use than PHP itself.
With those drawbacks - tpl designer having to learn a "language"
similar to real scripting, a lot of overhead code on every request and
nothing really you couldn't achieve with plain PHP code just as easily -
what do I get out of using Smarty?
[reply]
[top]
[»]
Re: What actual benefit do I get?
by Yaro - Jul 6th 2002 21:26:24
> The syntax within Smarty templates is
> similar to the common PHP syntax. I
> output a variable using the notation
> {$MyVar} - in a PHP script, I would
> write <?=$MyVar?>. Then I have
> modifiers and plugins like
> "upper" doing tasks that are
> already covered by native PHP funktions
> (e/g strtoupper()) - yet the Smarty
> stuff is less flexible in use (and
> probably slower since PHP functions are
> called via the "template engine
> detour"). All in all, any template
> designer will have to dig into the
> Smarty syntax and learn it before they
> can create working templates.
>
> If I got it right, the compilation of
> templates means that files are
> translated from the "Smarty
> language" to PHP, meaning of course
> that these compiled scripts will be
> parsed again by the PHP parser on
> request.
> Nothing against that - but when the
> syntax is so similar, why do we need the
> Smarty templates in the first place?
> So from my point of view this template
> engine just looks a little like a big
> wrapper that does things you could do
> with plain PHP - and yet it is not much
> easier to use than PHP itself.
>
> With those drawbacks - tpl designer
> having to learn a "language"
> similar to real scripting, a lot of
> overhead code on every request and
> nothing really you couldn't achieve with
> plain PHP code just as easily - what do
> I get out of using Smarty?
You even get no close to the idea and technology of Smarty. Smarty doesn't
parse already compiled scripts! They are pure PHP which executed as fast as
other PHP scripts. So Smarty syntax give you a Power of flexibility, whean
you want to make "every day task" in one line of template code.
Smarty is the best thing which I use in my projects.
[reply]
[top]
[»]
Re: What actual benefit do I get?
by Monte Ohrt - Jul 11th 2002 18:01:38
> Hi there.
>
> I testet Smarty and had a look at the
> documentation. Now, however, there
> remain some questions.
>
> The syntax within Smarty templates is
> similar to the common PHP syntax. I
> output a variable using the notation
> {$MyVar} - in a PHP script, I would
> write <?=$MyVar?>. Then I have
> modifiers and plugins like
> "upper" doing tasks that are
> already covered by native PHP funktions
> (e/g strtoupper()) - yet the Smarty
> stuff is less flexible in use (and
> probably slower since PHP functions are
> called via the "template engine
> detour"). All in all, any template
> designer will have to dig into the
> Smarty syntax and learn it before they
> can create working templates.
>
> If I got it right, the compilation of
> templates means that files are
> translated from the "Smarty
> language" to PHP, meaning of course
> that these compiled scripts will be
> parsed again by the PHP parser on
> request.
> Nothing against that - but when the
> syntax is so similar, why do we need the
> Smarty templates in the first place?
> So from my point of view this template
> engine just looks a little like a big
> wrapper that does things you could do
> with plain PHP - and yet it is not much
> easier to use than PHP itself.
>
> With those drawbacks - tpl designer
> having to learn a "language"
> similar to real scripting, a lot of
> overhead code on every request and
> nothing really you couldn't achieve with
> plain PHP code just as easily - what do
> I get out of using Smarty?
The benefits are countless, but one good point is the separation of
application logic from presentation logic. The application programmer can
change application logic without worrying about messing up the presentation
of content, and a template designer can modify the presentation without
breaking application logic.
[reply]
[top]
[»]
Re: What actual benefit do I get?
by Tim - Sep 30th 2002 08:17:56
Hi,
The benefits of using smarty are that you get a *structured* system for
templating that is standardised. If you use PHP, you still need to develop
your own system for including sub elements and setting variable scope and
you also end up with having to use <?php print 'web design leeds; ?> when you want to
include small sections. This would be a lot cleaner if it is set inside the
php and included in the page as a variable {$webAddress}. On top of this
the argument about speed is a stupid one that most people really need to
get their heads around. we are talking milliseconds for page build when the
average delivery time is seconds. Thats a 1000x difference. Even if you are
running a VERY busy site, you are unlikely to get more than 10 simultaneous
hits on your server at once. This means that at the worst your pages will
be maybe 0.2s slower through the use of templating and typically about
0.02s.
As an example of speed, our website www.pollenation.net is built using
smarty and we've tested it at 100 hits per second and it handles it fine.
And this is with mod rewrite overhead and an application server in front of
it and database abstraction etc etc.
-- web design leeds
[reply]
[top]
[»]
Re: What actual benefit do I get?
by di11rod - Sep 25th 2007 22:06:26
I can't believe the negativity people have posted about this clever
development package. For starters, it's plain rude for someone to step up
and criticize people who put their own time, energy, and money into making
something for others to use for free. If you think the engineering behind
it is flawed, recommend improvements, fix the code yourself, or just move
along to a better project. Show a little sensitivity towards the people who
got off their as$es and did something for the community.
Secondly, I have to back leeds on the performance impact of
dual-layered interpretation. Anyone faulting a publishing environment for
this is speaking from an academic perspective rather than
years-in-the-trenches experience. Believe me. I used to travel around the
country auditing web site performance and this ain't something to be
worried about. Bigger performance issues can be found by:
1. Configure memory caching for Apache.
2. Turn off logging or set it up on a different device (not
network-mounted, either).
3. Tune your DB. Make sure common SQL queries are set up as stored
procedures. Make sure indexes are configured properly. Make sure none of
your code hits the DB unnecessarily. Nested for-loops making calls to the
DB for each row returned in the parent loop is a horrible drag.
Oh,
well. Smarty looks cool to me.
Seth
[reply]
[top]
[»]
Re: What actual benefit do I get?
by Brian Takita - Oct 26th 2002 20:18:27
Hello,
I have a project named PHP Object Oriented
Framework.
POOF uses PHP itself as its template engine. Nested templates are also
easily supported. Using PHP as the template language means there is very
little script overhead and no compilation is necessary. POOF is still in
alpha stage however.
However the template syntax might be harder to use for template
designers.
What do you all think about having PHP as the template language?
Sincerely,
Brian Takita
[reply]
[top]
[»]
Re: What actual benefit do I get?
by Monte Ohrt - Apr 15th 2003 07:46:59
> Hi there.
>
> I testet Smarty and had a look at the
> documentation. Now, however, there
> remain some questions.
>
> The syntax within Smarty templates is
> similar to the common PHP syntax. I
> output a variable using the notation
> {$MyVar} - in a PHP script, I would
> write <?=$MyVar?>. Then I have
> modifiers and plugins like
> "upper" doing tasks that are
> already covered by native PHP funktions
> (e/g strtoupper()) - yet the Smarty
> stuff is less flexible in use (and
> probably slower since PHP functions are
> called via the "template engine
> detour"). All in all, any template
> designer will have to dig into the
> Smarty syntax and learn it before they
> can create working templates.
>
> If I got it right, the compilation of
> templates means that files are
> translated from the "Smarty
> language" to PHP, meaning of course
> that these compiled scripts will be
> parsed again by the PHP parser on
> request.
> Nothing against that - but when the
> syntax is so similar, why do we need the
> Smarty templates in the first place?
> So from my point of view this template
> engine just looks a little like a big
> wrapper that does things you could do
> with plain PHP - and yet it is not much
> easier to use than PHP itself.
>
> With those drawbacks - tpl designer
> having to learn a "language"
> similar to real scripting, a lot of
> overhead code on every request and
> nothing really you couldn't achieve with
> plain PHP code just as easily - what do
> I get out of using Smarty?
This is a fairly good explanation to your questions:
http://smarty.php.net/whyuse.php
[reply]
[top]
[»]
Re: What actual benefit do I get?
by Monte Ohrt - Sep 19th 2007 12:43:09
Instead of regurgitating explanations here, read the "Right for me" and
"Why use it" links from the Smarty home page. That should tell you plenty,
and you can make an informed decision if Smarty is a good choice for your
application. It isn't meant to be the be-all end-all template toolkit for
PHP, it is just another tool in the toolbox.
> Hi there.
>
> I testet Smarty and had a look at the
> documentation. Now, however, there
> remain some questions.
>
> The syntax within Smarty templates is
> similar to the common PHP syntax. I
> output a variable using the notation
> {$MyVar} - in a PHP script, I would
> write <?=$MyVar?>. Then I have
> modifiers and plugins like
> "upper" doing tasks that are
> already covered by native PHP funktions
> (e/g strtoupper()) - yet the Smarty
> stuff is less flexible in use (and
> probably slower since PHP functions are
> called via the "template engine
> detour"). All in all, any template
> designer will have to dig into the
> Smarty syntax and learn it before they
> can create working templates.
>
> If I got it right, the compilation of
> templates means that files are
> translated from the "Smarty
> language" to PHP, meaning of course
> that these compiled scripts will be
> parsed again by the PHP parser on
> request.
> Nothing against that - but when the
> syntax is so similar, why do we need the
> Smarty templates in the first place?
> So from my point of view this template
> engine just looks a little like a big
> wrapper that does things you could do
> with plain PHP - and yet it is not much
> easier to use than PHP itself.
>
> With those drawbacks - tpl designer
> having to learn a "language"
> similar to real scripting, a lot of
> overhead code on every request and
> nothing really you couldn't achieve with
> plain PHP code just as easily - what do
> I get out of using Smarty?
[reply]
[top]
[»]
Poor Performance
by August - Jan 26th 2001 21:00:08
Did a quick benchmark of Smarty vs phplibs templating. On a simple test of
a 3 variable block of code repeated 20 times Smarty served 65 page/s with
compile_check = true and 80 with compile_check = false.
phplib on the other hand served 90 pages/s at all times. Not sure why this
is.
[reply]
[top]
[»]
Re: Poor Performance
by Monte Ohrt - Jan 31st 2001 16:25:13
> Did a quick benchmark of Smarty vs
> phplibs templating. On a simple test of
> a 3 variable block of code repeated 20
> times Smarty served 65 page/s with
> compile_check = true and 80 with
> compile_check = false.
>
> phplib on the other hand served 90
> pages/s at all times. Not sure why this
> is.
The performance problem you are seeing here is the overhead of PHP
compiling the op-tree for the PHP scripts on each request. Smarty is a more
complex templating engine than phplib (and probably most others), therefore
it has more code for PHP to compile on each invocation. If you do some
benchmark tests using a PHP cache solution, such as Zend cache or APC, you
will see that Smarty runs at least as fast, but most likely faster than
conventional template solutions since there is no template parsing
overhead.
See the smarty mailing list archive for more a more detailed discussion of
this very subject.
[reply]
[top]
[»]
Re: Poor Performance
by Monte Ohrt - Mar 7th 2001 20:41:07
FYI, version 1.3.1 has some good speed improvements by narrowing the amount
of code PHP must compile after the initial template compilation.
[reply]
[top]
[»]
Re: Poor Performance
by Brent R. Matzelle - Aug 14th 2001 09:26:41
> FYI, version 1.3.1 has some good speed
> improvements by narrowing the amount of
> code PHP must compile after the initial
> template compilation.
I can attest to these speed improvements. I converted a single very
complex page running on PHPLIB template with multiple set_block() and
parse() calls to Smarty. The page came up much faster with Smarty and my
code is much cleaner than before! Plus, I am successfully using Smarty
along with APC for even more speed. This is a truly excellent product. I
can also use it in commercial products because of the license. Not
surprising but I am converting everything to Smarty.
[reply]
[top]
[»]
Re: Poor Performance
by Monte Ohrt - Mar 20th 2002 18:26:23
>
> % FYI, version 1.3.1 has some good
> speed
> % improvements by narrowing the amount
> of
> % code PHP must compile after the
> initial
> % template compilation.
>
>
> I can attest to these speed
> improvements. I converted a single very
> complex page running on PHPLIB template
> with multiple set_block() and parse()
> calls to Smarty. The page came up much
> faster with Smarty and my code is much
> cleaner than before! Plus, I am
> successfully using Smarty along with APC
> for even more speed. This is a truly
> excellent product. I can also use it in
> commercial products because of the
> license. Not surprising but I am
> converting everything to Smarty.
The 2.0 release has _major_ speed improvements, and Smarty now has a
benchmark page to compare for yourself.
[reply]
[top]
[»]
Alternative
by deekayen - Jan 26th 2001 10:47:41
If you can't use this class, and you have access to the php.ini file, you
might be able to still add the APC Alternative PHP Cache
zend extension and use a different template class.
[reply]
[top]
[»]
Re: Alternative
by Monte Ohrt - Jan 31st 2001 16:35:24
> If you can't use this class, and you
> have access to the php.ini file, you
> might be able to still add the APC
> Alternative PHP Cache zend extension and
> use a different template class.
I think there is some confusion about what Smarty is. Smarty is not a PHP
caching solution. Smarty is a template engine. APC will merely speed up
compilation of the PHP scripts themselves, but nither is an alternative to
the other. They actually work very well together.
[reply]
[top]
[»]
Re: Alternative
by deekayen - Jan 31st 2001 17:01:52
No, I'm not confused. I was just 1) plugging APC
because I think it's cool and 2) letting people
know about it because of people that can't use
Smarty because it might not be a practical
solution for them. I have nothing against Smarty.
[reply]
[top]
[»]
Re: Alternative
by Andrei Zmievski - Feb 2nd 2001 15:11:04
Plug APC all you want - it is cool, but apparently you have very little
understanding of what Smarty is and what it does, because otherwise you
would not have said what you have.
[reply]
[top]
[»]
Re: Alternative
by deekayen - Feb 2nd 2001 23:01:43
Fair enough. I'll admit I haven't downloaded
Smarty, so I have said all of the previous without
even having looked at the code.
[reply]
[top]
[»]
Limitation of Smarty
by Haohoa - Jan 25th 2001 22:53:11
This cached template system for PHP is a very good idea, but it works only
for directory trees that are owned by the user running Apache. It's totally
useless for a Unix user publishing in its private public_html directory.
[reply]
[top]
[»]
Re: Limitation of Smarty
by Monte Ohrt - Jan 31st 2001 16:17:48
> This cached template system for PHP is a
> very good idea, but it works only for
> directory trees that are owned by the
> user running Apache. It's totally
> useless for a Unix user publishing in
> its private public_html directory.
One workaround to this problem, you can create a world writable directory
for the compiled templates (owned by yourself obviously), then once the
templates are initially compiled, change it back to read-only. Smarty will
no longer need to write more files there once the initial compile is
complete.
[reply]
[top]
|