thank you so much for your explaination.
pardon, because i'm a newbie in python n web2py, i just learn, try to
implement what have been written in the http://web2py.com/book/default/
 <http://web2py.com/book/default/>the other controller that can't be passed
is *blog_result* like on below :

def blog():
    title = T('Blog')
    form = FORM(INPUT(_id = 'keyword', _name = 'keyword', _onkeyup = "ajax('
*blog_result*', ['keyword'], 'result');"))
    result = DIV(_id = 'result')
    if len(request.args):
page = int(request.args[0])
    else:
page = 0
 items_per_page = 20
limitby = (page * items_per_page, (page + 1) * items_per_page + 1)
 rows = db().select(db.blog.ALL, limitby = limitby)
    return dict(title = title, form = form, result = result, rows =
rows, page = page, items_per_page = items_per_page)

could someone can explain to me, where is my fault code?

thank you very much,

steve van christie

On Sun, Apr 10, 2011 at 9:53 AM, pbreit <[email protected]> wrote:

> T() is for text translations and I'm not sure you can use it (or would want
> to) with non-static text.
>
> That dict() looks a little messy. For one thing, you can simply include
> blogs=blogs. Some of those things I would put in the view instead
> (MARKMIN(().xml(), URL('blog_show')). Also, since views are typically
> linked to one controller, you would not ordinarily pass hard-coded text to
> the view. And request.now is available in the view.
>
> I would expect to see a controller like this:
>
> def blog_feed():
>     blogs = db().select(db.blog.ALL, orderby = db.blog.title)
>     return(blogs=blogs)
>
> And then the view blog_feed.html something like this (not tested):
>
> {{extend layout.html}}
> <h2>Blog Feed</h2>
> <a href="{{=URL(c='main', f='blog')}}">Home</a>
> <p>Blog RSS Feed - created on {{=request.now}}</p>
> <ul>
> {{for blog in blogs:}}
>   <li><a href="{{=URL('blog_show')}}">{{=blog.title}}</a> - created on
> {{=blog.created_on}}<br>
>   {{=MARKMIN(blog.content).xml()}}</li>
> {{pass}}
> </ul>
>
> I would definitely suggest going through Chapter 3 of the book:
> http://web2py.com/book/default/chapter/03
>

Reply via email to