eZ Publish  [4.0]
template.php
Go to the documentation of this file.
00001 <?php
00002 //
00003 // Created on: <16-Apr-2002 12:37:51 amos>
00004 //
00005 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00006 // SOFTWARE NAME: eZ Publish
00007 // SOFTWARE RELEASE: 4.0.x
00008 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS
00009 // SOFTWARE LICENSE: GNU General Public License v2.0
00010 // NOTICE: >
00011 //   This program is free software; you can redistribute it and/or
00012 //   modify it under the terms of version 2.0  of the GNU General
00013 //   Public License as published by the Free Software Foundation.
00014 //
00015 //   This program is distributed in the hope that it will be useful,
00016 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 //   GNU General Public License for more details.
00019 //
00020 //   You should have received a copy of version 2.0 of the GNU General
00021 //   Public License along with this program; if not, write to the Free
00022 //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00023 //   MA 02110-1301, USA.
00024 //
00025 //
00026 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00027 //
00028 
00029 
00030 function templateInit( $name = false )
00031 {
00032     if ( $name === false &&
00033          isset( $GLOBALS['eZPublishTemplate'] ) )
00034     {
00035         return $GLOBALS['eZPublishTemplate'];
00036     }
00037     if ( isset( $GLOBALS["eZPublishTemplate_$name"] ) )
00038     {
00039         return $GLOBALS["eZPublishTemplate_$name"];
00040     }
00041     //include_once( 'lib/eztemplate/classes/eztemplate.php' );
00042     //include_once( 'kernel/common/eztemplatedesignresource.php' );
00043     //include_once( 'lib/ezutils/classes/ezextension.php' );
00044 
00045     $tpl = eZTemplate::instance();
00046 
00047     //include_once( 'lib/ezutils/classes/ezini.php' );
00048     $ini = eZINI::instance();
00049     if ( $ini->variable( 'TemplateSettings', 'Debug' ) == 'enabled' )
00050         eZTemplate::setIsDebugEnabled( true );
00051 
00052     $compatAutoLoadPath = $ini->variableArray( 'TemplateSettings', 'AutoloadPath' );
00053     $autoLoadPathList = $ini->variable( 'TemplateSettings', 'AutoloadPathList' );
00054 
00055     $extensionAutoloadPath = $ini->variable( 'TemplateSettings', 'ExtensionAutoloadPath' );
00056     $extensionPathList = eZExtension::expandedPathList( $extensionAutoloadPath, 'autoloads' );
00057 
00058     $autoLoadPathList = array_unique( array_merge( $compatAutoLoadPath, $autoLoadPathList, $extensionPathList ) );
00059 
00060     $tpl->setAutoloadPathList( $autoLoadPathList );
00061     $tpl->autoload();
00062 
00063     $tpl->registerResource( eZTemplateDesignResource::instance() );
00064 
00065     if ( $name === false )
00066     {
00067         $GLOBALS['eZPublishTemplate'] = $tpl;
00068     }
00069     else
00070     {
00071         $GLOBALS["eZPublishTemplate_$name"] = $tpl;
00072     }
00073 
00074     return $tpl;
00075 }
00076 
00077 
00078 ?>