HI Alex,
 

> (1) where do you keep it so it persists in the navbar?    How is 3_menu.py 
> called?
>
>
My 3_menu.py file is located in the /<your_application>/models/ directory.  
The files in the directory are processed in alphabetical order (which is 
why I prefixed a number as my database models are in 2_models.py; my db 
connection and some other general init stuff is in 1_init_db.py.

For a look into how web2py processes this stuff (in fact that entire 
chapter is useful) see:  
http://www.web2py.com/books/default/chapter/29/04/the-core?search=alphabetical#Workflow
 

> (2) How did you get your mail_count to run when user first logged in? 
>  Where is that function located?
>

 in 3_menu.py I have:
# Set up general menu items here (for both logged in and non-logged in 
users.
response.menu = (............

if auth.user:       # User is logged in, set up menu for a logged in user 
here.
    response.menu += (...)  
    
    email_cnt = db(db.unknown_emails).count()   # Runs the query each time 
a request is served (and user is logged in).
    if email_cnt:
        response.menu += (...)

else:     # User not logged in, set up any nonlogged menu options here.
    response.menu += (...)
    ...


HTH,


Jose
 

 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to