The devil is in the details. I understand you store pages and some may have
a block_footer and some may not. If they do not have a block_footer, how
should the footer be determined? What is an index page?
I am making a guess:
record = db(query).select(db.page).first()
default_footer=cache.ram('block_footer',lambda:db(default_query).select().first().block_footer,300)
{{block footer}}
{{=record.block_footer else default_footer}}
{{end}}
On Wednesday, 24 July 2013 17:20:48 UTC+2, [email protected] wrote:
>
> Hi!
>
> Let's say I've following table defined:
> db.define_table('page',
> Field('is_index', 'boolean'),
> Field('title', 'text', default=''),
> Field('block_content', 'text', default=''),
> Field('block_ad', 'text', default=''),
> Field('block_footer', 'text', default=''),
> format='%(title)s'
> }
>
> I've inserted several pages (rows) in it.
>
> What would be the best way for block_footer to have the same value as in
> 'index' rows, i.e. like the footer on many (if not all) pages of a web site
> stays the same.
>
> Basically I'm looking for a way to reference index row's block_footer
> value in other page's block_footer field leaving a possibility for
> customization in case some page would require a different footer.
>
>
>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.