| Newsgroups |
gmane.comp.python.cheetah |
| Message-ID |
<[email protected]> |
Can you tell how to have a hierarchy of superclass templates as mixins in
Cheetah?
Thanks
The proper way is with #def. You can put all your snippets in one
template of #def's and #extends it, *or have a hierarchy of superclass
templates as mixins.*
We deliberately tried to keep #include simple, to avoid the kind of
spaghetti code people were doing with PHP when Cheetah was invented.
If you have arguments and a return value, you want to use #def. If
you can get by with just sharing the searchList and possibly a couple
'#set global' variables, you can use #include.
On Sun, Feb 18, 2007 at 2:16 PM, Mike Orr <[email protected]> wrote:
> On 2/18/07, Jon McLean <[email protected]> wrote:
> > I've been using PHP's Smarty for a while now. In my Smarty projects, I
> > usually end up with some include files which get re-used with
> > different parameters. A simple example might be a template for an HTML
> > select box, which might get included as:
> >
> > {include file="forms/select.tpl" name="country" options=$countries
> default="fr"}
> >
> > Cheetah doesn't appear to allow this in the same manner (the closest
> > analogy seems to be a bunch of #set globals followed by an #include).
> > I get the feeling that I'm missing the point here -- what's the
> > recommended way to do the same thing in Cheetah?
>
> The proper way is with #def. You can put all your snippets in one
> template of #def's and #extends it, or have a hierarchy of superclass
> templates as mixins.
>
> We deliberately tried to keep #include simple, to avoid the kind of
> spaghetti code people were doing with PHP when Cheetah was invented.
> If you have arguments and a return value, you want to use #def. If
> you can get by with just sharing the searchList and possibly a couple
> '#set global' variables, you can use #include.
>
> --
> Mike Orr <[email protected]>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Cheetahtemplate-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
>
--
Bidegg worlds best auction site
http://bidegg.com
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
_______________________________________________
Cheetahtemplate-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss