If you do a search on jDiv you will find a few recent threads
discussing this topic (related to the example link provided by
Massimo). I've been heading down this road myself, creating a site
where site pages are simply container based layouts containing re-
useable "applets". The pattern I've found that works so far is as
follows:

layout.html - contains common style sheets, javascript and layout
containers common across all pages (eg. Header, Menu, Body, Footer).
Provides  an {{include}} in the body area.

mypage.html - contains specific styles, javascript and layout
containers for the body area of a specific page that contains a number
of applets. Basically the "glue" that coordinates the interaction of
the various applets on the page. Within the layout defined in this
page are your applets {{=applet1}} , {{=applet2}}, etc.

The controller action for the mypage.html view creates applet1,
applet2, etc. as jDiv's and returns them to the view via dict
(applet1=applet1, applet2=applet2, ...)

The individual applets actions/views may be in the same controller as
mypage or in different controllers. Ideally, your applet's view would
contain only that html specific to that applet's layout so that it is
easily re-used. Since the applet will be able to utilize the
javascript and css in layout.html and mypage.html you can rely on
those layout pages to provide the CSS styling for the applet so that
it is easier to make site wide style changes later.

Making use of a CSS framework can help with consistent site wide
layout. I've used the blueprint css framework successfully with
web2py. CSS frameworks are not for everyone, but for CSS challenged
indviduals like myself, they are a real time saver.

Ted

On May 6, 3:15 am, Joe  Barnhart <[email protected]> wrote:
> I've been pondering the best way to create sites with rich pages that
> contain lots of "applets" or "tasklets".  It seems limiting to have
> the entire page tied to a single Python function.  Maintaining the
> site could be problematic if everything funnels through one
> "controller" function.
>
> Then I wondered about the structure of the layout files.  I like the
> "extend" and "include" functionality.  I imagine I could create a tree
> of html files --- one for each applet div, for example, with
> layout.html at the root.  Perhaps a "news" area and a "calandar" area
> in addition to the main body, for example.
>
> Each functional block could be represented by a file such as
> "news.html" and "calandar.html" included into layout.html.  The
> controller for each would then extend its own html file instead of the
> top-level "layout.html" file.
>
> Is there a still better way to organize a busy site?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to