You mention the welcome app, but the path you provided is in the examples 
app (which is the web2py.com website). Also, I cannot find a user_bar 
function in the default controller of the examples app (or the welcome 
app). Can you point to where that function is defined in the Github repo 
(https://github.com/web2py/web2py)?

In any case, if you want to call a function from a view, it would either 
have to be defined in a model file, imported from a module, or returned by 
the controller in the dictionary.

Anthony

On Saturday, August 16, 2014 4:28:19 PM UTC-4, Rob_McC wrote:
>
>
> Not sure why, but the *welcome application  *has a custom navbar in 
> controller. userbar()
>       I don't think it is used for anything...
>
> I want to  use it to learn how customize navbar menu but -
>     * How do I call this from the view?   *
>
> Thanks, 
>
> Rob
>
>
> /Contents/Resources/applications/examples/controllers/*default.py*
>
> def user_bar():
>     action = '/user'
>     if auth.user:
>         logout=A('logout', _href=action+'/logout')
>         profile=A('profile', _href=action+'/profile')
>         password=A('change password', _href=action+'/change_password')
>         bar = SPAN(auth.user.email, ' | ', profile, ' | ', password, ' | '
> , logout, _class='auth_navbar')
>     else:
>         login=A('login', _href=action+'/login')
>         register=A('register',_href=action+'/register')
>         lost_password=A('lost password', _href=action+
> '/request_reset_password')
>         bar = SPAN(' ', login, ' | ', register, ' | ', lost_password, 
> _class='auth_navbar')
>     return bar
>
>
> /Contents/Resources/applications/welcome/views/*layout.html*
>
>  <ul id="navbar" class="nav pull-right">{{='auth' in globals() and 
> auth.navbar(mode="dropdown") or ''}}</ul>
>
>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to