You have various options and it really depends on the logic behind the
two columns.
If one the second column is independent on the main controller you can
just implement it in layout.
If the two columns are both generated by the action you can use
web2py's html functions.
example: views/layout.html
<html><body>
{{include}}
<table>
<tr>
<td><h1>Column One</h1>{{col1()}}</td>
<td><h1>Column Two</h1>{{col2()}}</td>
</tr>
</table>
</body></html>
default.py
def index() return dict()
views/default/index.html
{{extend 'layout.html'}}
{{def col1():}}
<h2>this is column 1</h2>
{{return}}
{{def col2():}}
<h2>this is column 2</h2>
{{return}}
Hope this helps.
On Feb 22, 4:02 pm, Joe Barnhart <[email protected]> wrote:
> I'm having a conceptual problem. Eventually I would like to implement
> a web site that has more than one column of information. These
> columns would be in different divisions and controlled by a CSS style
> sheet. My difficulty comes from this -- how do I support multiple
> columns with only one controller function?
>
> For example, on the default layout.html page, there is one column
> defined and the {{include}} directive is inside that single column's
> division. IIRC the {{include}} directive is where the html for the
> controller's web page will be rendered. How do I expand this into
> more than one column? Do I have more than one {{include}} in the
> layout.html file? If so, how does web2py know which controller
> function maps to which {{include}}?
>
> Or does my layout.html file need to avoid defining the columns
> altogether, leaving that function to the view html page? That seems
> more likely. I suppose I could map different dictionary items from my
> single controller into different columns if they were all defined in
> the view page. Is this the best practice? Are there any alternatives
> I have not considered?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---