[web2py] Re: Help for creating template

2011-11-16 Thread miroslavgojic
Hi, Thanks for this replay, showed example with if logic is very interesting, Regards Miroslav On Nov 15, 11:59 am, Khalil KHAMLICHI wrote: > Hi, > > you can as well put you logic in the menu.py file like this : > > if auth.user: >     if auth.user.id > 10 and auth.user.team == "admins": >    

Re: [web2py] Re: Help for creating template

2011-11-15 Thread Christopher Steel
For multiple menus you can define them like this as well: response.menu_top = [ bla bla bla ] response.menu_bottom = [ bla bla bla ] response.menu_side = [ bla bla bla ]

Re: [web2py] Re: Help for creating template

2011-11-15 Thread Khalil KHAMLICHI
Hi, you can as well put you logic in the menu.py file like this : if auth.user: if auth.user.id > 10 and auth.user.team == "admins": response.menu = . . . . else: response.menu = . . . . I use this as a way to make custom menus depending on user logged in. Sent from my A

Re: [web2py] Re: Help for creating template

2011-10-12 Thread Anthony
By default, @auth.requires_login() should be redirecting to the 'user' action in the 'default' controller, which will then look for the /views/default/user.html view file for rendering. Do you have the standard user.html file? If so, it extends layout.html. If you don't want it to extend layout

Re: [web2py] Re: Help for creating template

2011-10-12 Thread Miroslav Gojic
I use this @auth.requires_login() in my controller before DEF but with that option I get login, form but my menu is visible, it not redirect my page to my login page, just put login form in place of my conteten. after that I tray tu put if statement in layout.html and in if that is checked logi

Re: [web2py] Re: Help for creating template

2011-10-12 Thread Anthony
Have you read the chapter on access control: http://web2py.com/book/default/chapter/08? The Auth system should be able to handle this kind of thing for you. You can use @auth decorators on your actions to require login, group membership, or other arbitrary conditions. If the user is not logged

Re: [web2py] Re: Help for creating template

2011-10-11 Thread Miroslav Gojic
I have login form (I can regiser, or log in, ...) but how to apply this login to some site page. from login.form I can get user.name or user.id I need something like if to check this {{ if user.name == 'user':}} go to some page or some content {{else:}} open login form {{pass}} this is what is

[web2py] Re: Help for creating template

2011-10-10 Thread Massimo Di Pierro
In fact this {{if {{=request.function}} == index:}} is wrong because web2py would look for the first {{ and the first }} and try interpret the code in between as python. By "if {{=request.function" is not valid python. You want: {{if request.function == 'index':}} On Oct 10, 4:28 pm, Anthony

Re: [web2py] Re: Help for creating template

2011-10-10 Thread Anthony
> > {{if {{=request.function}} == index:}} Yes, once you're inside a {{}}, you can write any Python and refer to any global (or local) variables -- so no need to nest another {{=}} in there.

Re: [web2py] Re: Help for creating template

2011-10-10 Thread Miroslav Gojic
This is much better ... just how to define condition only for index page (or function or controller) {{if condition:}} how to make definition of condition - there no need to be request.url it can be request.controller when I tray this I get an error: {{if {{=request.function}} == index:}} your h

Re: [web2py] Re: Help for creating template

2011-10-10 Thread Anthony
On Monday, October 10, 2011 4:03:49 PM UTC-4, miroslavgojic wrote: > > with > {{=request.url}} > i will get > /some/my/url/address > > but when I tray next example it is not working: > > {{ > myurl = request.url: > i = /some/my/url/address: > if i == myurl: > response.writ('my first HTML output') >

Re: [web2py] Re: Help for creating template

2011-10-10 Thread Miroslav Gojic
with {{=request.url}} i will get /some/my/url/address but when I tray next example it is not working: {{ myurl = request.url: i = /some/my/url/address: if i == myurl: response.writ('my first HTML output') else: response.write('my other HTML output') pass }} how to resolve this, I need one part l

Re: [web2py] Re: Help for creating template

2011-10-09 Thread Anthony
On Sunday, October 9, 2011 1:56:18 AM UTC-4, miroslavgojic wrote: > > What if I need more than one menu. > > Usually I have 2 or 3 menus (top, bottom, and side) > > Can I do someting like this: > in controller > var1 = (response .menu > =(...)) >

Re: [web2py] Re: Help for creating template

2011-10-08 Thread Miroslav Gojic
What if I need more than one menu. Usually I have 2 or 3 menus (top, bottom, and side) Can I do someting like this: in controller var1 = (response .menu =(...)) var2 = (response .menu =(...)) in

Re: [web2py] Re: Help for creating template

2011-10-07 Thread Anthony
See http://web2py.com/book/default/chapter/05#Custom-Helpers for details on using the MENU helper. You can see an example of using it in conjunction with Superfish (which is a Javascript library that turns the list structure generated by MENU into a dynamic menu) in the 'welcome' app: http://c

Re: [web2py] Re: Help for creating template

2011-10-07 Thread Miroslav Gojic
this is my controller from gluon.tools import Crud crud = Crud(db) def index(): form=SQLFORM(db.poruke,fields=['poruka','post_author']) if form.accepts(request.vars,session): session.flash="new post accepted!" redirect(URL(r=request)) poruke=db().select(db.poruke.ALL)

Re: [web2py] Re: Help for creating template

2011-10-07 Thread Anthony
On Friday, October 7, 2011 1:31:08 AM UTC-4, miroslavgojic wrote: > > Thanks for blocks - that work, this is similar to modules in joomla, I can > write small block and get content on specific place at layout. > > I tray to use next code: > response

Re: [web2py] Re: Help for creating template

2011-10-06 Thread Miroslav Gojic
Thanks for blocks - that work, this is similar to modules in joomla, I can write small block and get content on specific place at layout. I tray to use next code: response .menu = [('Google', False, 'http://www.google.com',[]), ('

Re: [web2py] Re: Help for creating template

2011-10-06 Thread pbreit
Generally you only need one include, {{include}}, which is going to incorporate the content from your view. But you can also use include to specify another view file to incorporate: http://web2py.com/book/default/chapter/05#Page-Layout Example: {{include 'page.html'}} You also might check out "

Re: [web2py] Re: Help for creating template

2011-10-06 Thread Miroslav Gojic
For now I have problem to put different view in specific position on page/layout I don't have to much problems with HTML/CSS - three or more columns - at 2006 I resolved this :) My problem is how to have more than one include, but I see that is possible to use include page.html and I will tray th

Re: [web2py] Re: Help for creating template

2011-10-06 Thread Anthony
- Header: http://code.google.com/p/web2py/source/browse/applications/welcome/views/layout.html#90 - Status Bar: http://code.google.com/p/web2py/source/browse/applications/welcome/views/layout.html#100 - Main Body (including two optional sidebars): http://code.google.com

Re: [web2py] Re: Help for creating template

2011-10-06 Thread Miroslav Gojic
I didn't find any simple example, I look at my layout.html but it is to much complicated for my needs, or I must my template from beginning to end that I can understood. I look in the book but nothing helpful for beginners, and where is that thing commented, here on the group. - - Miroslav Gojic

[web2py] Re: Help for creating template

2011-10-06 Thread pbreit
The default layout.html is configured with a Header, Body and Footer. It's well-commented so that's a good place to start.