Also, note that you don't use "print" in web2py -- printing prints to the 
console and has no effect on the HTML returned by the server to the 
browser. In web2py, a controller action returns a dictionary of data, and 
the view then uses that data in constructing the HTML. Controllers do not 
directly write into the view -- that is why controllers and views are 
separate layers -- they each have their own roles.

Anthony

On Tuesday, May 12, 2015 at 5:56:47 PM UTC-4, Massimiliano wrote:
>
> In your controller:
>
> a = [1,2,3]
>
> return locals()
>
> In your view:
>
> {{for i in a:}}
>      {{=i}}
> {{pass}}
>
>
>
>
> On Tue, May 12, 2015 at 11:46 PM, KevC <kevin.capuchin...@gmail.com> 
> wrote:
>
>> Hi!
>>
>> I got a problem, I wanna print a list or string on a 'view' using  a 
>> 'for' but the view only show me the last number or letter. For example:
>>
>> My controller...
>>
>> for i in 'hola':
>>      print i
>>      return locals()
>>
>>
>> My view...
>>
>> {{=i}}
>>
>> The view only show me the letter 'a'.
>> Other example:
>>
>> a = [1,2,3]
>> for i in a:
>>      print i
>>      return locals()
>>
>> My view...
>>
>> {{=i}}
>>
>> The view only show me the number 3.
>>
>> I got a mistake? Somebody help me.
>> I used the console and It's ok, print all list and string.
>>
>> My best regards.
>>
>>
>>
>>
>>  -- 
>> 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.
>>
>
>
>
> -- 
> Massimiliano
>  

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