Thanks for the replies. A great help!

On Oct 1, 10:29 am, "Tito Garrido" <[EMAIL PROTECTED]> wrote:
> Hey morningovermidnight,
>
> Try something like that:
>
> *layout.html:*
>
>        {{try:}}{{pagetitle()}}
>        {{except: pass}}
>
> *in your view that needs pagetitle:*
>
> {{def pagetitle():}}
>        <div id="title">
>                <h1>{{=pagetitle}}</h1>
>                {{if subtitle:}}
>                <h2>{{=subtitle}}</h2>
>                {{pass}}
>        </div>
> {{pass}}
>
> Regards,
>
> Tito
>
>
>
> On Wed, Oct 1, 2008 at 9:53 AM, Timothy Farrell <[EMAIL PROTECTED]> wrote:
>
> > If you don't pass a variable named 'pagetitle' to your template then it
> > will raise an exception because you're trying to access something that
> > isn't there.  It's the same thing as opening a clean python shell and
> > typing "a" (without quotes).   You have to pass something to the
> > template in a, but you should use response.title instead.
>
> > morningovermidnight wrote:
> > > I am trying to add some code to my layout as follows:
>
> > >       {{if pagetitle:}}
> > >       <div id="title">
> > >               <h1>{{=pagetitle}}</h1>
> > >               {{if subtitle:}}
> > >               <h2>{{=subtitle}}</h2>
> > >               {{pass}}
> > >       </div>
> > >       {{pass}}
>
> > > I have the {{IF}} there because not everypage using the layout will
> > > have a page title. However, even though I have the if, I still get an
> > > error when I access a view for a controller function which does not
> > > contain pagetitle. The error reads that pagetitle is not defined.
> > > Isn't the "if" supposed to be taking care of this for me. Or mabe it
> > > is because pagetitle is not defined in the function. But I don't want
> > > to use it in every function that has a view. How can I make its
> > > inclusion conditional?
>
> --
> Linux User #387870
> .........____
> .... _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:_______
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to