Your content variable acts like a dictionary, sort of, so you can do
this:
$if content.has_key('cssfiles'):
That will work if the variable isn't defined.
Cheers,
Justin
On Nov 1, 11:53 am, W P <[email protected]> wrote:
> In the Site Layout example, it shows that you should be able to do
> this in templates:
>
> > $if content.cssfiles:
> > $for f in content.cssfiles.split():
> > <link rel="stylesheet" href="$f" type="text/css"
> media="screen" charset="utf-8"/>
>
> But whenever I try this, I get an error if content.cssfiles does not
> exist.
>
> So far I have solved this by putting a blank "$var cssfiles:" in all
> my templates, but this seems like a hack-y workaround.
>
> Anyone know what I could be missing?
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.