Make the templates working again.

This commit is contained in:
Jakob Sack 2011-03-02 18:21:08 +01:00
parent 66ac355f78
commit ede34c17dd
1 changed files with 11 additions and 5 deletions

View File

@ -66,7 +66,7 @@ class OC_TEMPLATE{
} }
public function append( $a, $b ){ public function append( $a, $b ){
if( array_key_exists( $this->vars[$a] )){ if( array_key_exists( $a, $this->vars )){
if( is_a( $this->vars[$a], "array" )){ if( is_a( $this->vars[$a], "array" )){
$this->vars[$a][] = $b; $this->vars[$a][] = $b;
} }
@ -150,7 +150,7 @@ class OC_TEMPLATE{
// Execute the template // Execute the template
ob_start(); ob_start();
oc_include( $this->template ); include( $this->template ); // <-- we have to use include because we pass $_!
$data = ob_get_contents(); $data = ob_get_contents();
ob_end_clean(); ob_end_clean();
@ -167,7 +167,9 @@ class OC_TEMPLATE{
*/ */
public static function printUserPage( $application, $name, $parameters = array() ){ public static function printUserPage( $application, $name, $parameters = array() ){
$content = new OC_TEMPLATE( $application, $name, "user" ); $content = new OC_TEMPLATE( $application, $name, "user" );
$content->assign( $parameters ); foreach( $parameters as $key => $value ){
$content->assign( $key, $value );
}
return $content->printPage(); return $content->printPage();
} }
@ -180,7 +182,9 @@ class OC_TEMPLATE{
*/ */
public static function printAdminPage( $application, $name, $parameters = array() ){ public static function printAdminPage( $application, $name, $parameters = array() ){
$content = new OC_TEMPLATE( $application, $name, "admin" ); $content = new OC_TEMPLATE( $application, $name, "admin" );
$content->assign( $parameters ); foreach( $parameters as $key => $value ){
$content->assign( $key, $value );
}
return $content->printPage(); return $content->printPage();
} }
@ -193,7 +197,9 @@ class OC_TEMPLATE{
*/ */
public static function printGuestPage( $application, $name, $parameters = array() ){ public static function printGuestPage( $application, $name, $parameters = array() ){
$content = new OC_TEMPLATE( $application, $name, "guest" ); $content = new OC_TEMPLATE( $application, $name, "guest" );
$content->assign( $parameters ); foreach( $parameters as $key => $value ){
$content->assign( $key, $value );
}
return $content->printPage(); return $content->printPage();
} }
} }