blueshoes php application framework and cms            applications_cms
[ class tree: applications_cms ] [ index: applications_cms ] [ all elements ]

Class: Bs_Layout

Source Location: /applications/cms/Bs_Layout.class.php

Class Overview

Bs_Object
   |
   --Bs_XAtom
      |
      --Bs_Layout

Layout Class


Author(s):

Version:

  • 4.3.$Revision: 1.2 $ $Date: 2003/08/09 15:22:34 $

Copyright:

  • blueshoes.org

Variables

Methods


Inherited Variables

Inherited Methods

Class: Bs_XAtom

Bs_XAtom::Bs_XAtom()
Constructor.
Bs_XAtom::datetimeInRange()
Tells if this element is ALIVE.
Bs_XAtom::getFailedReason()
Tells what went wrong.
Bs_XAtom::init()
Init this object using UID (Unified ID).
Bs_XAtom::isAlive()
Tells if something (page, node, block, whatever) with the given properties is alive or not.
Bs_XAtom::matchBrowser()
tells if the current user browser (manufacturer and version) matches.
Bs_XAtom::matchFeature()
tells if the current user browser features match.
Bs_XAtom::matchPlugin()
tells if the current user browser plugins match.
Bs_XAtom::normalizeRef()
Normalize the references to the varius elements and return an hash
Bs_XAtom::normalizeVersion()
Normalize a version string and return it See info in header of this file.
Bs_XAtom::persist()
Use the XStorage to persist any XAtom
Bs_XAtom::reset()
Reset the whole object
Bs_XAtom::toXml()
Generate a XML output of the element (Node, Page, Layout, Block ...)
Bs_XAtom::_basicInit()
Init some very basic setup stuff that is directly related to the UID
Bs_XAtom::_normalizeContainer()
This may have to be done if the input is from a soucre that is written by human.

Class: Bs_Object

Bs_Object::Bs_Object()
Bs_Object::getErrors()
Basic error handling: Get *all* errors as string array from the global Bs_Error-error stack.
Bs_Object::getLastError()
Basic error handling: Get last error string from the global Bs_Error-error stack.
Bs_Object::getLastErrors()
Basic error handling: Get last errors string array from the global Bs_Error-error stack sinc last call of getLastErrors().
Bs_Object::persist()
Persists this object by serializing it and saving it to a file with unique name.
Bs_Object::setError()
Basic error handling: Push an error string on the global Bs_Error-error stack.
Bs_Object::toHtml()
Dumps the content of this object to a string using PHP's var_dump().
Bs_Object::toString()
Dumps the content of this object to a string using PHP's var_dump().
Bs_Object::unpersist()
Fetches an object that was persisted with persist()

Class Details

[line 17]
Layout Class



Tags:

copyright:  blueshoes.org
pattern:  singleton: (pseudostatic)
access:  public
version:  4.3.$Revision: 1.2 $ $Date: 2003/08/09 15:22:34 $
author:  Sam Blum <at blueshoes dot org>, andrej arn <andrej at blueshoes dot org>


[ Top ]


Class Variables

$emptyBloProp = array(
        'type'         => 'standard',         'name'         => '',                 'version'      => '',                 'mime'         => '',                 'source'       => '',                 'require_once' => FALSE,              'element'      => '',                 'UID'          => NULL,               'part'         => '',                 'sandwichProp'   => array( 
           'tag'       => '',                      'attr'      => NULL                   ),'ref'=>array('parentUni'=>'','coreName'=>'',),'xpath'=>NULL,)

[line 73]


Type:   mixed


[ Top ]

$_blocks =  NULL

[line 99]


Type:   mixed


[ Top ]

$_dataContainer = array(        'layout'        => array(
        'name'         => '',               'version'      => '',               'access'       => 'public',         'cacheExpire'  => '',               'value'     => array(              'cruncher'   => '',                'crunchdelay'=> 0,                 'data'       => '',               ),),'headRef'=>array(),'layoutRef'=>array(),'bloceboRef'=>array(),'blockRef'=>array(),'rendered'=>'','renderedTime'=>NULL,)

[line 47]

STRUCTURE DETAILS:

BloceboRef / BlockRef Hash: BlockRef[<bloc-Name>] = array( 'type' => 'standard', // <- "standard"|"sandwich". "standard" is a normal <bs:blockref ... "sandwich" e.g <img blockref="name='lala'; ref='/foo'; part='bar'" src="" ... /> 'name' => '', // <- base name (no ext.) 'version' => '', // <- version-mask of the layout 'mime' => '' // <- this will describe the what type of block it is e.g. text, pic, ... 'source' => '', // <- "file" | "db" 'require_once' => FALSE, // <- If TRUE the referenced element will only be included once per page. 'element' => '', // <- Used to know what we are lookiong at if this hash structure is passed to a function 'UID' => NULL, // <- AFTER _resolveBlockRefs() this will contain the block-UID. (See _resolveBlockRefs()) 'part' => '', // <- block part 'sandwichProp' => array( 'tag' => '', // <- if "sandwich": The tag name in which the BloceboRef / BlockRef was found. Used to rebuilt the tag. 'attr' => NULL // <- if "sandwich": The other attributes of the tag in which the BloceboRef / BlockRef was found. ), 'ref' => array( // <- A ref stucture to an element ( see XATOM->normalizeRef() ) 'parentUni' => '', // <- parent Node UNI 'coreName' => '', // <- core name of element (No version, no extention) ), 'xpath' => xpath, // <- abs. xpath-key to the BloceboRef / BlockRef as we have to replace it. );



Type:   mixed


[ Top ]

$_subLayouts =  NULL

[line 98]

The child sub-Layout and Blocks we determined



Tags:


Type:   mixed


[ Top ]

$_xPath =  NULL

[line 104]


Type:   mixed


[ Top ]



Class Methods


constructor Bs_Layout [line 110]

Bs_Layout Bs_Layout( object $node)

Constructor.



Parameters:

object   $node  

[ Top ]

method determineLayout [line 155]

object initialized determineLayout( object &$parentNode, hash $refAttr)

Determines the right Layout.

If we have to determine an XAtom element, that always means that we haven't got the UID (Unified ID) to init it directly. We expect to receive the parent Node as parameter and a so called refAttr (reference attribute hash) of following min. structure: $refAttr = array( // <- Ref attrbute array of the found LayoutRef 'ref' => array(), // <- A ref stucture to an element ( see XATOM->normalizeRef() ) 'parentUni' =>'', // <- parent Node UNI 'coreName' =>'' // <- core name of element (No version, no extention) ), 'version' => '', // <- version-mask of the layout 'source' => '', // <- "file" | "db" ),

NOTE: Bs_Layout::determineLayout() and Bs_Block::determineBlock() are currently (7.12.2001) identical in what they do. So changes here may also have to be made there.




Tags:

return:  Layout.
throws:  FALSE on error
access:  public


Parameters:

object   $parentNode   The parent Node object of where the Layout is expected to be.
hash   $refAttr   See above

[ Top ]

method getRendered [line 690]

void getRendered( )



[ Top ]

method init [line 125]

bool init( mixed $UID)

Init this object using UID (Unified ID).



Overrides Bs_XAtom::init() (Init this object using UID (Unified ID).)

Parameters:

mixed   $UID   (see Bs_XAtom->init().)

[ Top ]

method parseCoreXml [line 699]

bool parseCoreXml( )

Parse the core XML data and get all bockrefs and blocebos.



[ Top ]

method preRenderLayout [line 276]

bool preRenderLayout( mixed &$originNode, mixed &$page)

************************************************************************ Do all the work that has to be done, without rendering.

This function is called upon a http request to a Node and cascades through all XAtom-types to do a pre rendering: We are in stage C) a) Create Node and determine Page and Guard b) Page tries to determine Layout -> c) Layout tries to determine sub-Layouts and Blocks <- We're here d) sub-Layouts determin Blocks (and subsub Layouts a.s.o.)

Together with the Session- and bs- environment we try to find the matching XAtom belonging below us. In this case sub-Layouts and Blocks. We trigger then the sub-Layout to also do a pre render and to find it's child XAtoms as well. At the end we schould have following tree stucture:

We're here a) b) c) d) Node +--> _guard +--> _page +--> _layout +--> _subLayouts[0] | +--> _blocks[0] (part xxx) | +--> _blocks[1] (part xxx) +--> _subLayouts[1] | +--> _blocks[0] (part xxx) +--> _block[0] (part xxx) +--> _block[1] (part xxx) Main Goal:

  • To append a valid (sub) Layout(s) as a child to this Layout.
  • To append a valid Block(s) as a child to this Layout.
NOTE: At the end of this routine there will be an array Layouts/Blocks appended to this Layout for every layoutRef/blockRef (incl blocebo) found in the Layout itself. BUT they may *not* all be valid. The reason is that the invalid elements represents the *invalid* elements and contains error and trace information, that is used for the GUI or for debugging.




Tags:

return:  TRUE on success; FLASE otherwise.
see:  see Bs_Node::preRenderNode()
access:  public


[ Top ]

method render [line 673]

string render( )

renders the master (top most) layout.



Tags:

access:  public


[ Top ]

method _renderLayout [line 494]

bool _renderLayout( mixed &$layout)

Render the sub-Layouts and Blocks recursively

There are a few possibilities to walk through the tree to render the Blocks and sub-Layouts. The way I've chosen here is to render the highest blocks first and then handle the sub-Layer (if existent) by rendering it's Blocks a.s.o. So it's a more "top down" rendering; (instead of a possible "bottom up" rendering).

Rendering Path Top Layout / / \ \ ^ Bl Bl Lay +-+ Lay ^ >>---------+ / \ | | / \ | |Bl Bl| |Bl Lay | +------+ +-+ / \ | | Bl Bl| +------+ The Reason: The "require_once" attribute Block- and layout-refs can have a "require_once" attirbute e.g. (<bs:blockref name="xxx" ... require_once="TRUE">) This tells us (the renderer) to include the Block/Layout only once per page. As the top elements have priority over the lower elements, it made sense to render the page with a "top down" approach.




Tags:

access:  public


[ Top ]


Documentation generated on Mon, 29 Dec 2003 21:11:40 +0100 by phpDocumentor 1.2.3