Re: Basic use of #extends
Chris Stoyles <[email protected]> Thu, 25 Mar 2010 08:47:05 +0800
| Newsgroups | gmane.comp.python.cheetah |
|---|---|
| Message-ID | <[email protected]> |
Wow that works beautifully :) Thanks! Chris. On Thu, Mar 25, 2010 at 8:33 AM, Tavis Rudd <[email protected]> wrote: > Hi Chris, > You can also use the cheetah import hooks to compile the base class > dynamically (see the module Cheetah.ImportHooks). > Cheers, > Tavis > > > On Thu, 25 Mar 2010, Chris Stoyles wrote: > > Ok so I worked it out last night. What wasn't obvious to me (which perhaps >> would have been had I read the user guide in its entirety) was that you >> create your HTML template (base.tmpl) first. You then run the "cheetah >> compile /path/to/base.tmpl" which creates your base.py file. I followed >> the >> same steps for my page template and then everything fell into place. >> Hopefully I've not wasted anyone's time. >> >> Thanks, >> Chris. >> >> On Wed, Mar 24, 2010 at 2:12 PM, Chris Stoyles <[email protected]> wrote: >> >> Hi Everyone, >>> >>> I am trying to do something which I think should be fairly trivial, but >>> am >>> yet to work out how to do it in Cheetah. I want a base template for my >>> site >>> (base.html) with a block in it (#block main_content) which I can fill-out >>> or >>> override in another template. >>> >>> In Django I would include the following statement at the top of my other >>> template: >>> {extends "/var/www/my/app/templates/base.html"} >>> >>> Then to fill in one of the blocks defined in base.html I would just do >>> this: >>> {% block main_content %} >>> ...html... >>> {% endblock %} >>> >>> I've tried my best to understand this page: >>> >>> http://www.cheetahtemplate.org/docs/users_guide_html_multipage/inheritanceEtc.extends.htmlbut >>> with no luck. >>> >>> Hopefully someone out there can quickly explain to me how I should go >>> about >>> this. >>> >>> Thanks, >>> Chris. >>> >>> >> ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Cheetahtemplate-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss