diff -r 6231a61dabfa -r 73a352526577 doc/book/en/B1060-templates.en.txt --- a/doc/book/en/B1060-templates.en.txt Mon Dec 29 15:37:12 2008 -0800 +++ b/doc/book/en/B1060-templates.en.txt Mon Dec 29 17:47:00 2008 -0800 @@ -1,5 +1,7 @@ .. -*- coding: utf-8 -*- +.. _templates: + Templates ========= @@ -156,17 +158,36 @@ --------------- .. _TheMainTemplate: +TheMainTemplate is responsible for the general layout of the entire application. +It defines the template of ``id = main`` that is used by the application. + +The default main template (`cubicweb.web.views.basetemplates.TheMainTemplate`) +builds the page based on the following pattern: + +.. image:: images/main_template_layout.png + +The rectangle containing `view.dispatch()` represents the area where the content +view has to be displayed. The others represents sub-templates called to complete +the page. A default implementation of those is provided in +`cubicweb.views.basetemplates`. You can, of course, overload those sub-templates +to implement your own customization of the HTML page. + +We can also control certain aspects of the main template thanks to the following +forms parameters: + +* `__notemplate`, if present (whatever the value assigned), only the content view + is returned +* `__force_display`, if present and its value is not null, no navigation + whatever the number of entities to display +* `__method`, if the result set to render contains only one entity and this + parameter is set, it refers to a method to call on the entity by passing it + the dictionnary of the forms parameters, before going the classic way (through + step 1 and 2 described juste above) + The MainTemplate is a bit complex as it tries to accomodate many different cases. We are now about to go through it and cutomize entirely our application. -TheMainTemplate is responsible for the general layout of the entire application. -It defines the template of ``id = main`` that is used by the application. Is -also defined in ``cubicweb/web/views/basetemplates.py`` another template that can -be used based on TheMainTemplate called SimpleMainTemplate which does not have -a top section. - -.. image:: images/lax-book.06-simple-main-template.en.png CSS changes ----------- @@ -180,7 +201,7 @@ apply a higher priority on the default CSS and you can not change that. Customized CSS will not be read first. -1 + [TODO] Add login menu in left column