Wow, that is thorough and answers almost all of my other questions on 
helpers as well. Thanks.

New view is:

<ul class="thumbnails">
{{for i,post in enumerate(posts):}}
{{if i==items_per_page: break}}
<li class="span6">
    <div class="thumbnail">
        <a href="{{=URL("view", args=post.id)}}">
            <img src="{{=URL('static', 'content', 'thumbs', 
args=post.image)}}" class="img-polaroid">
        </a>
        <div class="caption">
            <h2>
                <a href="{{=URL("view", args=post.id)}}">{{=post.title}}</a>
            </h2>
            <span class="muted">{{=XML(post.caption)}}</span>
        </div>
    </div>
</li>
</ul>



On Monday, February 17, 2014 3:03:49 PM UTC-8, Anthony wrote:
>
> Yes, there should be some performance benefit to raw HTML. Also, in terms 
> of style, I think raw HTML is preferred in views, unless you are making use 
> of some of the special functionality of the helpers (see 
> http://stackoverflow.com/a/8095585/440323).
>
> Anthony
>
> On Monday, February 17, 2014 5:19:19 PM UTC-5, HittingSmoke wrote:
>>
>> I'm curious if there's any notable performance overhead with using 
>> helpers. I have the following to list database entries on my home page:
>>
>> <ul class="thumbnails">
>> {{for i,post in enumerate(posts):}}
>> {{if i==items_per_page: break}}
>> {{=LI(
>>     DIV(
>>         A(IMG(_src=URL('static', 'content', 'thumbs', args=post.image), 
>> _class="img-polaroid"), _href=URL("view", args=post.id)),
>>         DIV(
>>             H2(A(post.title, _href=URL("view", args=post.id))),
>>             SPAN(XML(post.caption), _class="muted"),
>>         _class="caption"),
>>     _class="thumbnail"),
>> _class="span6")}}
>> {{pass}}
>> </ul>
>>
>> I mostly nested all the helpers so I could better learn web2py's helper 
>> syntax. Now that I think I have a decent grasp of it I'm wondering if I 
>> should convert what I can of this to raw HTML in the view so there is less 
>> server-side code parsing.
>>
>> Would representing this view in raw HTML instead of building it with 
>> helpers provide any performance benefit since the server wouldn't have to 
>> convert it to HTML?
>>
>

-- 
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/groups/opt_out.

Reply via email to