Thanks. I want to define a number of "blocks" in the DB, say:

- the last 10 posts
- the last 10 posts for a specific category
- a list of categories
- a list of the most popular tags

I want to let users choose which of these blocks they want to display.
This is the part I'm struggling with.

On Apr 28, 10:33 pm, pbreit <[email protected]> wrote:
> LOAD() might not be a bad option. You can pass in args or vars to specify
> different snippets.
>
> I offer my users the ability to define the page header and have a simple
> function in models that picks the header based on the sub-domain.
>
> def _page_header():
>     sub_domain = request.env.http_host.split('.')[0]
>     header =
> db(db.auth_user.name==sub_domain).select(db.auth_user.header).first()
>     if header and len(header)>0:
>         return header.header
>     else:
>         return None
>
> page_header = XML(_page_header())
>
> And then in my layout.html:
>
>         {{block header}}
>             {{if page_header:}}
>                 {{=page_header}}
>             {{else:}}
>
> {{try:}}{{=auth.navbar(action=URL('default','user'))}}{{except:pass}}
>                 <div
> id="logo">{{=A(IMG(_src=URL('static','images/logo.png'), _width='200'),
> _href=URL(c='default', f='home'))}}
>                 </div>
>                 <div style="clear: both;"></div><!-- Clear the divs -->
>             {{pass}}
>         {{end}}  

Reply via email to