Re: Smarty-like #include?
"R. Tyler Ballance" <[email protected]>
| Newsgroups | gmane.comp.python.cheetah |
|---|---|
| Message-ID | <[email protected]> |
On Wed, May 27, 2009 at 04:52:27PM -0700, [email protected] wrote: > Tyler > Can you tell me if you have shared this tutorial somewhere > thanks a lot Second time you've sent the same email. If you haven't heard anything about it, it's probably because I've not finished it yet (Cheetah is not my day job). The impatient rapidly find themselves piped to /dev/null ;) > > On Mon, May 25, 2009 at 2:02 PM, R. Tyler Ballance <[email protected]> > wrote: > > Since this seems to be a common question i'll write up a tutorial later > today on dealing with template inheritance and mixins with both > precompiled and dynamically compiled templates > > (oblig. top post apologies from my mobile) > > ---------------------------------------------------------------------- > > From: mobiledreamers@gmailcom > Sent: Monday, May 25, 2009 1:14 > To: Mike Orr <[email protected]> > Cc: Jon McLean <[email protected]>; > [email protected] > Subject: Re: [Cheetahtemplate-discuss] Smarty-like #include? > > 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 > > -- > Bidegg worlds best auction site > http://bidegg.com -- -R. Tyler Ballance Slide, Inc. ------------------------------------------------------------------------------ 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 as they present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com _______________________________________________ Cheetahtemplate-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
signature.asc
(application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkod034ACgkQFCbH3D9R4W+t5QCfYUF9FZqKppPr/yCCNecSQrML XlQAn2ffmGB+tuOOT/SDHEMHC4/e1o/T =L/HU -----END PGP SIGNATURE-----