hi,

is it possible to use components in related tables? lets say like the
blog that have a comment related, i want to make the comment as a
components that can be use in list index and show itself. thank you so
much before.

e.g.
=== index.html ===
{{extend 'layout.html'}}
{{for i, row in enumerate(rows):}}
    {{if i == items_per_page: break}}
    {{=DIV(A(row.title,
             _href = URL(show_link,
                         args = row.id),
           _title = row.title))}}
    {{=DIV(row.content)}}
    {{=LOAD('default', 'blog_comment_show.load', ajax = True)}}
    {{=LOAD('default', 'blog_comment_add.load', ajax = True, target =
'blog_comment_show')}}
    {{=BR()}}
{{pass}}
{{if page:}}
    {{=A(T('Previous'),
         _href = URL(args = [page - 1]),
         _title = T('Previous'))}}
{{pass}}
{{if len(rows) > items_per_page:}}
    {{=A(T('Next'),
         _href = URL(args = [page + 1]),
         _title = T('Next'))}}
{{pass}}

=== blog_comment_show.load ===
{{if len(results):}}
    {{=DIV(A(T('View Comments (%s)' % len(results)),
             _href = '#'),
           _id = 'view')}}
    <div class = "comments hidden">
    {{for blog_comment in results:}}
        {{=SPAN(db.auth_user[blog_comment.created_by].first_name,
                T(' on '),
                blog_comment.created_on,
                T(' Said '),
                blog_comment.comment)}}
    {{pass}}
    </div>
{{else:}}
    {{=DIV(B(T('No Comments Posted Yet')))}}
{{pass}}

=== blog_comment_add.load ===
{{=SCRIPT(_src = URL('static',
                     'js/comments.js'))}}

{{=DIV(A(T('Post a Comment'),
         _href = '#'),
       _class = 'post')}}

{{=DIV(form,
       _class = 'form hidden')}}

Reply via email to