Re:Re: [pndev] Q: pnHTML vs Modelixe
| From: | LIMBOURG Arnaud | Date: | Wed, 06 Feb 2002 15:50:16 +0000 |
| Subject: | Re:Re: [pndev] Q: pnHTML vs Modelixe | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-2651@lists.php.net to get a copy of this message | ||
> Smarty _does_ separate content from layout. But, there is
> logic in both
> sides of the equation: logic that handles the content, and logic that
> handles the layout. The logic that handles content should be in the
> application, and the logic that handles the layout should be in the
> template. There is no reason for the application to care how
> content is
> displayed. If you want to display your content in a table, in 2,3,4
> columns, color every other row, etc., Smarty should be able to handle
> 100% of this. If you pass layout logic from the application, in most
> cases you just lost your separation and made things more
> complicated and
> unflexible.
That's right.
> As soon as you try to "remove logic from templates", you are
> right back
> to the paradigm of content not truly being separate from layout. Now
> maybe there could be a three-tier design where the layout logic is
> handled _after_ the content is passed, and _before_ it hits the
> templates, but Smarty was not designed this way since there was no
> perceivable need for it, and again adds a layer of unnecessary
> complexity.
Yep, as always it is bad to overuse something (in that case, layers can be
nice, but using too many of them just adds unnecessary complexity, as you
say)
> On the flip side, if you want your templates to pass some "template
> purity test" and you really want to leave all logic out of
> the template,
> go ahead and handle everything from the application. Smarty
> doesn't care
> how you do it.
I know, i'm using smarty, and not modelixe ;)
> Monte
>
>
> LIMBOURG Arnaud wrote:
> >
> > I agree templates shouldn't contain logic but it is utopia
> to hink you can
> > separate 100% of the content and layout. Not that the cost
> at simplyfing or
> > complexifying stuff that shouldn't.
> >
> > What the perfs with the content cache, i heard that modelixe is more
> > efficient than smarty in that regard.
> >
> > Arnaud.
> >
> > >
> > >
> > > It looks like the guy promoting his own system doesn't
> > > realize that smarty both compiles the template AND
> > > allows for content caching.
> > >
> > > Brian
> > > ------------------------------------
> > > "How should I know if it works? That's what beta testers are
> > > for. I only coded it." - Linus Torvalds
> > >
> > > ----- Original Message -----
> > > From: "BBB" <whyisityou2@yahoo.com>
> > > To: smarty@lists.ispi.net
> > > Date: 2/5/02 5:31:42 PM
> > >
> > > >
> > > >I came across this post from postnuke's mailing list.
> Any comments?
> > > >
> > > >----- Original Message -----
> > > >From: "ladyofdragonss" <ladyofdragons@dndresources.com>
> > > >To: <pndev@yahoogroups.com>
> > > >Sent: Tuesday, February 05, 2002 1:40 PM
> > > >Subject: Re: [pndev] Q: pnHTML vs Modelixe
> > > >
> > > >
> > > >> At Tuesday, 5 February 2002, you wrote:
> > > >>
> > > >> >Is there a reason that bringing Dusky Blue (DTS) into
> the core is
> > > >> off of the
> > > >> >table? Is it a resource hog? Is the developer
> difficult to work
> > > >> with? Is
> > > >> >it not GPL? Am I asking too may questions? <grin>
> > > >>
> > > >> here's what ahumphr (aiden) had to say in the pn-bui
> list. After
> > > >> that, a recent Benchmark test put Smarty down at the
> bottom of the
> > > >> list as far as speed is concerned.
> > > >>
> > > >> -Ladyofdragons
> > > >>
> > > >> --- In pn-bui@y..., "ahumphr" <ahumphr@g...> wrote:
> > > >> I had my attention drawn last week to the existence of the
> > > Dusky Blue
> > > >> Theme System (from dusky-blue.net). This is a theme
> > > template created
> > > >> using Smarty.
> > > >>
> > > >> I was quite ammused reading the code. The author's
> > > approach was more
> > > >> or less identical with the one that I evolved for the ModeliXe
> > > >> prototype. Now it's not worth me coding my own Smarty
> > > theme since I
> > > >> would be just replicating the DTS so I've uploaded the DTS
> > > package to
> > > >> the pn-template CVS at sourceforge.
> > > >>
> > > >> A couple of differences between the Smarty
> implementation and the
> > > >> ModeliXe implementation:
> > > >>
> > > >> 1) I would argue Smarty is total overkill for the type
> of approach
> > > >> used in the DTS templates. FastTemplate can do the same
> > > job (variable
> > > >> substitution and dynamic templates) and is much much more
> > > efficient.
> > > >>
> > > >> Smarty allows the template developer to include logic in
> > > the template
> > > >> like this:
> > > >>
> > > >> {include file="header.tpl" title="Home Page"}
> > > >> {if $Name eq ""}
> > > >> Hello, Noname!<br>
> > > >> {elseif $Name eq "Ned"}
> > > >> Hello, Neddy!<br>
> > > >> {else}
> > > >> Hello, {$Name}<br>
> > > >> {/if}
> > > >>
> > > >> {$FirstName}, {$LastName}<br>
> > > >> {$Address}, {$Zipcode}
> > > >> {include file="footer.tpl"}
> > > >>
> > > >> DTS does not use this kind of logic in the templates,
> > > therefore the
> > > >> advantage of Smarty would seem to be its interesting
> > > template to PHP
> > > >> compilation facility. In reality this is no advantage. To
> > > learn why
> > > >> see 3 below.
> > > >>
> > > >> 2) For some reason DTS OpenTable and CloseTable calles do
> > > not create
> > > >> tables using templates but just pump out HTML from echo
> > > statements -
> > > >> why? Efficiency?
> > > >>
> > > >> 3) The arguable gain of Smarty is its so called "caching"
> > > mechanism -
> > > >> which compiles each template into a PHP script (on first
> > > invocation).
> > > >> This then avoids the overhead of reparsing the templates
> > > every time
> > > >> the user requests a page. However the name "cache" is
> confusing.
> > > >> Smart's cache is a parser cache. There is page image
> instatitated
> > > >> with content in the cache. Smarty's cache contains a phtml
> > > page with
> > > >> <?php ?> islands. In each island there is PHP code to retrieve
> > > >> content from Smart's symbol table. The islands are
> > > executed each time
> > > >> the page is requested.
> > > >>
> > > >> This is a completely different concept to ModilXe's cache.
> > > ModeliXe
> > > >> tries to cache an _rendered_ page image, so that if the
> > > content of a
> > > >> block has been recently retreived (within a second or
> so) ModilXe
> > > >> returns the last _rendered_ version of that block from
> > > cache rather
> > > >> than repeating all the work to retrieve content. This
> > > could be much
> > > >> faster but also leads to dangers with fast changing content.
> > > >>
> > > >> How does the Smarty approach stack up against ModeliXe? Well
> > > >> syntactically ModeliXe is way ahead with its support of XML and
> > > >> logicless tags. ModeliXe's XML syntax makes it compatible with
> > > >> leading (X)HTML editors. There are plugins available for
> > > Dreamweaver
> > > >> and UltraEdit. However some might find ModeliXe's solution too
> > > >> complex - do we really need separate template tags for
> images and
> > > >> form elements?
> > > >>
> > > >> Where does Smarty win?
> > > >>
> > > >> Well, its a neat solution. The compilation cache saves
> > > reparsing the
> > > >> templates and the generated phtml code is more in sympathy
> > > with the
> > > >> PHP way of doing things. But why does Smarty make such
> a big deal
> > > >> about template parsing? Because Smarty templates can
> > > contain _logic_
> > > >> of the type I quoted above. Parsing the logic code
> into PHP is way
> > > >> more complex than the logicless tags used by ModeliXe and
> > > >> FastTempalte. There is more or less a mini compiler
> within Smarty.
> > > >>
> > > >> So since DTS sensibily doesn't use the ugly logic
> syntax, Smarty's
> > > >> cache mechanism is just a compensation mechanism for overkill
> > > >> features. and it holds no advantage over the cache-less
> > > FastTemplate.
> > > >>
> > > >> I haven't yet checked how fast Smarty is in relation to
> > > ModeliXe, (I
> > > >> will get round to that soon) but I would be surprised if it is
> > > >> significantly faster.
> > > >>
> > > >> Does anyone want on this list want to take up the chalenge
> > > of coding
> > > >> a module is a DTS like fashion?
> > > >>
> > > >> Aidan
> > > >> --- End forwarded message ---
> > > >>
> > > >>
> > > >>
> > > >
> > > >
> > > >
> > > >_________________________________________________________
> > > >
> > > >Do You Yahoo!?
> > > >
> > > >Get your free @yahoo.com address at
> > > >http://mail.yahoo.com
> > > >
> > > >
> > > >
> > > >
> > > >---
> > > >You are currently subscribed to smarty as: brian@massassi.net
> > > >To unsubscribe send a blank email to
> > > $subst('Email.Unsub')
> > > >Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
> > >
> > >
> > > ---
> > > You are currently subscribed to smarty as:
> arnaud.limbourg@cegetel.fr
> > > To unsubscribe send a blank email to
> > > $subst('Email.Unsub')
> > > Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
> > >
> >
> > ---
> > You are currently subscribed to smarty as: monte@ispi.net
> > To unsubscribe send a blank email to
> $subst('Email.Unsub')
> > Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
>
> --
> Monte Ohrt <monte@ispi.net>
> http://www.ispi.net/
>
> ---
> You are currently subscribed to smarty as: arnaud.limbourg@cegetel.fr
> To unsubscribe send a blank email to
> $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
>