On May 23, 3:16 pm, infodoc <[email protected]> wrote:
> Hello,
>
> New to web2py. First post.
>
> What is the best way to serve static html content such as contact
> info, privacy policy, etc.  As I want the content to extend a base
> html layout, putting it in the static subdir and using the static
> controller doesn't work since I just get the raw html without the
> extended layout file.  I could set up a function, return a dict with
> the content, and display wiht an html page of the same name, but that
> seems overkill to just display some static html.

There are a couple of ways to do what you want:  One is to simply
return the entire static function from
the static directory, and use the css etc. from that file, i.e.
http://localhost:8000/myapp/static/myinfo.html
(this is the way I reference help and documentation files I generate
as static files, with Sphinx).

You can also use a standard controller function with a redirect to the
same.
(search for redirect() in http://www.web2py.com/book)

Another way, you hinted at - and perhaps this is what you'll want to
try first:
create a controller function, return a dict (no content - basically,
pass nothing to
the view; just use the controller name to select the appropriate
view).

In your view,  you can now extend your standard layout, and use
{{include ...}} to include the static
content the way that you want within your layout.

I am sure others will chime in with many more suggestions.

Welcome - hope you have lots of fun with web2py!

Regards,
- Yarko

>
> I just want a simple way to return static html in the context of the
> same layout file I use for dynamic content.
>
> If this is a repeat question I apologize, & would appreciate a link to
> the solution.
>
> Thanks in advance,
>
> R

Reply via email to