3 |
// $Id$ |
// $Id$ |
4 |
// ------------------------------------------------------------------------- |
// ------------------------------------------------------------------------- |
5 |
// $Log$ |
// $Log$ |
6 |
|
// Revision 1.4 2002/12/23 11:33:32 jonen |
7 |
|
// + minor changes |
8 |
|
// |
9 |
// Revision 1.3 2002/12/19 06:21:37 joko |
// Revision 1.3 2002/12/19 06:21:37 joko |
10 |
// + loadTemplate |
// + loadTemplate |
11 |
// + case 'template' for 'function loadComponent' |
// + case 'template' for 'function loadComponent' |
23 |
|
|
24 |
var $site; |
var $site; |
25 |
|
|
26 |
function includeFile($filename) { |
function includeFile($filename, $args = array()) { |
27 |
|
|
28 |
// TODO: try to remove these globals! |
// TODO: try to remove these globals! |
29 |
global $site; |
global $site; |
30 |
global $site_state; |
global $site_state; |
31 |
global $uservars; |
//global $uservars; |
32 |
global $request; |
global $request; |
33 |
global $http_referer; |
global $http_referer; |
34 |
|
|
35 |
|
global $page_state; |
36 |
|
|
37 |
$this->site->log( get_class($this) . "->includeFile( filename $filename )", LOG_DEBUG); |
$this->site->log( get_class($this) . "->includeFile( filename $filename )", LOG_DEBUG); |
38 |
$site = &$this->site; |
$site = &$this->site; |
39 |
if (include($filename)) { |
if (include($filename)) { |
40 |
return 1; |
return 1; |
41 |
} |
} |
42 |
|
|
43 |
} |
} |
62 |
$prefix = $this->site->config[path][base] . 'core/pages/'; |
$prefix = $this->site->config[path][base] . 'core/pages/'; |
63 |
$postfix = ".page"; |
$postfix = ".page"; |
64 |
$includefile = "$prefix$name$postfix"; |
$includefile = "$prefix$name$postfix"; |
65 |
return $this->includeFile($includefile); |
return $this->includeFile($includefile, $arguments ); |
66 |
break; |
break; |
67 |
|
|
68 |
case "template": |
case "template": |
86 |
return $this->loadComponent($name, "handler"); |
return $this->loadComponent($name, "handler"); |
87 |
} |
} |
88 |
|
|
89 |
function loadPage($name) { |
function loadPage($name, $args = array()) { |
90 |
$this->site->log( get_class($this) . "->loadPage( name $name )", LOG_DEBUG); |
$this->site->log( get_class($this) . "->loadPage( name $name )", LOG_DEBUG); |
91 |
return $this->loadComponent($name, "page"); |
return $this->loadComponent($name, "page", $args); |
92 |
} |
} |
93 |
|
|
94 |
function loadTemplate($name, $template_variables = array(), $cache_key = "") { |
function loadTemplate($name, $template_variables = array(), $cache_key = "") { |
95 |
$this->site->log( get_class($this) . "->loadTemplate( name $name cache_key $cache_key )", LOG_DEBUG); |
$this->site->log( get_class($this) . "->loadTemplate( name $name cache_key $cache_key )", LOG_DEBUG); |
96 |
return $this->loadComponent($name, "template", array( cache_key => $cache_key, vars => $template_variables) ); |
return $this->loadComponent($name, "template", array( 'cache_key' => $cache_key, 'vars' => $template_variables) ); |
97 |
} |
} |
98 |
|
|
99 |
function loadClass() { |
function loadClass() { |