Tomas, I use the templating very little, as most of my code is Ajax, but I
originally did this with templates.  I think you can do what you're
suggesting, by building your menu in python and passing the text to the
render function.

I think you prefer to avoid ajax and inject the menu into the render?  So,
assuming you already built your menu html into a string:

admin_menu = "some html"
class home:
    def GET(self):
        return render.home(admin_menu)

Then, in the home.html file in the templates directory, the first line
would be:
$def with (content, menuhtml)

and somewhere on the page you'd have:
<div id="menu">$menuhtml</div>

I never did this with the 'base' template, but I'm sure it's similar.

Good luck!
S




On Tue, Oct 16, 2012 at 4:30 PM, Tomas Schertel <[email protected]> wrote:

> Could I have a specific render for my menus and concatenate my base html
> with my menu and the page body?
>
>
>
> On Monday, 15 October 2012 18:55:14 UTC-3, NSC wrote:
>
>> It's a bit unusual but here's what I do.
>>
>> My menu is a static HTML file called _x_menu.html. Using jquery Ajax, I
>> load that into the header div on page load.
>>
>> Now here's the magic. There are multiple menu files, one for each user
>> "level" ( i have 4). My get_menu web method determines which menu to
>> deliver.
>>
>> Hack proof? No, but it'd take some savvy. So, as a final protection
>> mechanism, I have a hash in my python code that associates content with
>> user levels. That way, even if a user did try to directly access a
>> forbidden page, the auth_processor would deny the request.
>>
>> Make sense?
>>
>>
>> On Oct 15, 2012, at 3:37 PM, Tomas Schertel <[email protected]> wrote:
>>
>> Hi every body!
>>
>> I'm planning to have different access profiles in an application I'm
>> writing.
>> How can I have a different menu for each access profile?
>> I'm wondering how accomplish it, but I'm kind of stuck...
>>
>> Can someone help?
>>
>> Thanks.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "web.py" group.
>> To view this discussion on the web visit https://groups.google.com/d/**
>> msg/webpy/-/VTruxTA7McoJ<https://groups.google.com/d/msg/webpy/-/VTruxTA7McoJ>
>> .
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to webpy+un...@**
>> googlegroups.com.
>>
>> For more options, visit this group at http://groups.google.com/**
>> group/webpy?hl=en <http://groups.google.com/group/webpy?hl=en>.
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "web.py" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/webpy/-/gLA0GFeMeg0J.
>
> 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.
>

-- 
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.

Reply via email to