> > Topic (new)

Rendering Pages

Dec 14, 2006 / pixtur
Jan 5, 2009 / phsouzacruz

Attached files

No files uploaded

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
         $page->options=array( # create options
            $page->title="Thomas Mann"; # set page-title
            $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:


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.

  • fast
  • small code
  • easily adjustable by deriving and tuning pageElement-classes
  • 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

No Comments