eZ Publish  [4.0]
eztemplatevariableelement.php
Go to the documentation of this file.
00001 <?php
00002 //
00003 // Definition of eZTemplateVariableElement class
00004 //
00005 // Created on: <01-Mar-2002 13:50:58 amos>
00006 //
00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00008 // SOFTWARE NAME: eZ Publish
00009 // SOFTWARE RELEASE: 4.0.x
00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS
00011 // SOFTWARE LICENSE: GNU General Public License v2.0
00012 // NOTICE: >
00013 //   This program is free software; you can redistribute it and/or
00014 //   modify it under the terms of version 2.0  of the GNU General
00015 //   Public License as published by the Free Software Foundation.
00016 //
00017 //   This program is distributed in the hope that it will be useful,
00018 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 //   GNU General Public License for more details.
00021 //
00022 //   You should have received a copy of version 2.0 of the GNU General
00023 //   Public License along with this program; if not, write to the Free
00024 //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00025 //   MA 02110-1301, USA.
00026 //
00027 //
00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00029 //
00030 
00031 /*!
00032   \class eZTemplateVariableElement eztemplatevariableelement.php
00033   \ingroup eZTemplateElements
00034   \brief Represents a variable element in the template tree.
00035 
00036   The element contains the variable and all it's operators.
00037 */
00038 
00039 class eZTemplateVariableElement
00040 {
00041     /*!
00042      Initializes the object with the value array and operators.
00043     */
00044     function eZTemplateVariableElement( $data )
00045     {
00046         $this->Variable = $data;
00047     }
00048 
00049     /*!
00050      Returns #variable.
00051     */
00052     function name()
00053     {
00054         return "#variable";
00055     }
00056 
00057     function serializeData()
00058     {
00059         return array( 'class_name' => 'eZTemplateVariableElement',
00060                       'parameters' => array( 'data' ),
00061                       'variables' => array( 'data' => 'Variable' ) );
00062     }
00063 
00064     /*!
00065      Process the variable with it's operators and appends the result to $text.
00066     */
00067     function process( $tpl, &$text, $nspace, $current_nspace )
00068     {
00069         $value = $tpl->elementValue( $this->Variable, $nspace );
00070         $tpl->appendElement( $text, $value, $nspace, $current_nspace );
00071     }
00072 
00073     /*!
00074      Returns the variable array.
00075     */
00076     function variable()
00077     {
00078         return $this->Variable;
00079     }
00080 
00081     /// The variable array
00082     public $Variable;
00083 }
00084 
00085 ?>