And note, {{=some_expression}} only works when the "=" comes immediately after the "{{". It is a shortcut for:
{{response.write(some_expression)}} Also, note that "print" will have no effect on the generated HTML. Instead, you must write to the response.body (which is what response.write does). Anthony On Friday, February 26, 2016 at 2:35:10 PM UTC-5, Niphlod wrote: > > the correct syntax would be > > {{foreach element in elements:}} > {{=each}} > {{pass}} > > > please read the book (especially the part about views ( > http://web2py.com/books/default/chapter/29/05/the-views)) > > On Friday, February 26, 2016 at 7:49:07 PM UTC+1, Marty Jones wrote: >> >> I'm just getting started with web2py and I'm struggling to figure out how >> to call variables passed from the controller to the view, without using the >> {{=variable}} method. >> >> For example, I have the following code in my controller: >> >> def manage(): >> list = [] >> for row in db(db.auth_user.registration_key[0]=='p').select(): >> if row.company=='Chosen company': >> list.append({row.last_name:{"first":row.first_name}}) >> return dict(list=list) >> >> And the following code in my view: >> >> {{for each in =list}} >> {{print each}} >> {{pass}} >> >> Which generates an error... How do I call the list variable without using >> the = syntax? >> > -- 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.