If you put {{include 'recentPosts.html'}} in layout.html than the view
'recentPosts.html' is included in the layout but the corresponding
action is not called.
Try replace
{{include 'recentPosts.html'}}
with
{{=LOAD('default','recentPosts',ajax=True)}}
On Dec 21, 6:53 am, nic <[email protected]> wrote:
> Hi,
>
> I am using the plugin_wiki (which is fantastic by the way) and the
> Rambling plugin_layout.
> I am trying to make it a bit more blog like by listing recent posts.
>
> I have created a file recentPosts.html which is:
>
> <ul>
> {{for recent in recents:}}
> <li>
> <a href=/bs/plugin_wiki/page/{{recent.slug}}> {{=recent.slug}}
> </a>
> </li>
> {{pass}}
> </ul>
>
> and in the default.py controller defined:
>
> def recentPosts():
> return dict(recents=db().select(db.plugin_wiki_page.slug,
> db.plugin_wiki_page.created_on ))
>
> this works fine when I load the page /myApp/default/recentPosts
>
> However:
>
> I want to show the recent posts in the sidebar.
> So I have put {{include 'recentPosts.html'}} in layout.html
> and written the index.html as:
>
> {{left_sidebar_enabled=right_sidebar_enabled=False}}
> {{extend 'layout.html'}}
> {{=plugin_wiki.embed_page('home') or ''}}
>
> When I run this I get an error:
>
> Traceback (most recent call last):
> File "/home/www-data/web2py/gluon/restricted.py", line 188, in
> restricted
> exec ccode in environment
> File "/home/www-data/web2py/applications/myApp/views/default/
> index.html", line 53, in <module>
> NameError: name 'recents' is not defined
>
> OK, so I add to index() in default.py
>
> return dict(message=T('Hello World'),
> recents=db().select(db.plugin_wiki_page.slug,
> db.plugin_wiki_page.created_on ))
>
> And this works fine until I try to select another wiki page.
> Where I get the error:
>
> Traceback (most recent call last):
> File "/home/www-data/web2py/gluon/restricted.py", line 188, in
> restricted
> exec ccode in environment
> File "/home/www-data/web2py/applications/myApp/views/plugin_wiki/
> page.html", line 79, in <module>
> NameError: name 'recents' is not defined
>
> So the problem seems to be that the recents definition does not seem
> to be cascading down from the layout.html.
>
> I have tried to define it under plugin_wiki.py, but no luck.
>
> I hope I have defined the problem as clearly as possible.
> Any help, much appreciated.