I'm just arriving at this point in my first web2py project, and I'm still a bit unclear what the result of this discussion is. I would just like to clarify what is supported in web2py.
The sample scenario is this. In view 'default/index.html': * This might be the 'front page' of a site * You include the line {{extend 'foo/bar.html'}} In view 'foo/bar.html': * This might implement a sidebar (or some other common 'applet') * You include the line {{=some_db_records}} * You have an {{include}} in the file When you hit the URL 'appname/default/index': * It is the responsibility of the function index() in the controller file default.py to return an item called 'some_db_records' * The function bar() in controller foo.py is not called Is this correct? Thanks guys, I just wanted to be sure I interpreted these posts correctly. Eddie On May 7, 2:57 am, Ted G <tedg...@gmail.com> wrote: > If you do a search onjDivyou 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. asjDiv'sand 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, yourapplet'sview would > contain only that html specific to thatapplet'slayout so that it is > easily re-used. Since theappletwill 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 theappletso 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 <joe.barnh...@gmail.com> 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 eachappletdiv, 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 web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---