Rendering Pages
The prototype still uses a weird type of OOP based render-Engine. It is best understood by looking at this code from pages/home.php:
function home() {
global $PH; # give pagehandler
### set up page ####
{
$page= new Page(); # create new page
$page->cur_tab='home'; # the the section tab
$page->crumbs=array( # create bread-crumbs
"Home",
);
$page->options=array( # create options
$PH->getLink('error','Discussions'),
);
$page->title="Thomas Mann"; # set page-title
$page->type="Home";
$page->title_minor="May 25th";
echo(new PageHeader); # write the pageheader and headline
}
All html-rendering is done through classes defined in the render/-directory. Here we define derived class of PageElements. PageElements overwrite the __toString()-method. So when used in string-context the will return it's html-code:
echo (new PageContentOpen_Columns); # start the content-div
alternatively you could use the render-method:
$list->render_tfoot();
The whole render-stuff is not very brillant and should be replaced by a template-engine in the long term. But for now it gives a far more flexible handling than the netoffice2.x-blockClass.
Pros:
- fast
- small code
- easily adjustable by deriving and tuning pageElement-classes
Cons:
- overwriting already defined class is tricky
- implementing different themes would require to reimplement the complete render-directory
- passing html-fragments in blockList-Colums is ugly
Read more about
render-classes...
also see:
Common Page Elements