Re: Basic use of #extends

Tavis Rudd <[email protected]> Wed, 24 Mar 2010 17:33:05 -0700 (PDT)
Newsgroups gmane.comp.python.cheetah
Message-ID <alpine.LNX.2.00.1003241730221.4878@o3>
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.html but
>> with no luck.
>>
>> Hopefully someone out there can quickly explain to me how I should go about
>> this.
>>
>> Thanks,
>> Chris.
>>
>

------------------------------------------------------------------------------
Download Intel&#174; 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