Thanks Massimo,

Your guess is right, only all pages have footer, but let's say 90% of them 
have the same block_footer, and other 10% have original, unique 
block_footer, so I don't want to copy-paste content of first page with 
is_index == True,  but at the same time leave a possibility to define 
custom block_footer content for some page. 

On Thursday, July 25, 2013 10:24:53 AM UTC+3, Massimo Di Pierro wrote:
>
> 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, shapova...@gmail.com 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to