00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 function &templateInit( $name = false )
00031 {
00032 if ( $name === false )
00033 $tpl =& $GLOBALS["eZPublishTemplate"];
00034 else
00035 $tpl =& $GLOBALS["eZPublishTemplate_$name"];
00036 if ( get_class( $tpl ) == "eztemplate" )
00037 return $tpl;
00038 include_once( "lib/eztemplate/classes/eztemplate.php" );
00039 include_once( 'kernel/common/eztemplatedesignresource.php' );
00040 include_once( 'lib/ezutils/classes/ezextension.php' );
00041
00042 $tpl = eZTemplate::instance();
00043
00044 include_once( 'lib/ezutils/classes/ezini.php' );
00045 $ini =& eZINI::instance();
00046 if ( $ini->variable( 'TemplateSettings', 'Debug' ) == 'enabled' )
00047 eZTemplate::setIsDebugEnabled( true );
00048
00049 $compatAutoLoadPath = $ini->variableArray( 'TemplateSettings', 'AutoloadPath' );
00050 $autoLoadPathList = $ini->variable( 'TemplateSettings', 'AutoloadPathList' );
00051
00052 $extensionAutoloadPath = $ini->variable( 'TemplateSettings', 'ExtensionAutoloadPath' );
00053 $extensionPathList = eZExtension::expandedPathList( $extensionAutoloadPath, 'autoloads' );
00054
00055 $autoLoadPathList = array_unique( array_merge( $compatAutoLoadPath, $autoLoadPathList, $extensionPathList ) );
00056
00057 $a =& $autoLoadPathList;
00058 $tpl->setAutoloadPathList( $a );
00059 $tpl->autoload();
00060
00061 $tpl->registerResource( eZTemplateDesignResource::instance() );
00062 $tpl->registerResource( eZTemplateDesignResource::standardInstance() );
00063
00064 return $tpl;
00065 }
00066
00067
00068 ?>