А почему бы не сделать так:
Код:
lib.mainContent = USER_INT
lib.mainContent {
userFunc = user_view->justMain
whoiam = content
}
// пейджеры нужны только на определённых страницах
[PIDinRootline = {$PAGE_ID1}] [PIDinRootline = {$PAGE_ID2}] ...
lib.mainTopPager = USER_INT
lib.mainTopPager {
userFunc = user_view->justMain
whoiam = pagerTop
}
lib.mainBottomPager = USER_INT
lib.mainBottomPager {
userFunc = user_view->justMain
whoiam = pagerBottom
}
[GLOBAL]
и
PHP код:
class user_singleton{
static $instance;
static $generated;
static $content;
static $pagerTop;
static $pagerBottom;
private function __construct() {}
public static function getInstance() {
if (!self::$instance instanceof self) {
self::$instance = new self();
}
return self::$instance;
}
function justMain($content,$conf){
if (!$generated){
$this->content = $this->genContent();
$this->pagerTop = $this->genPagerTop();
$this->pagerBottom = $this->genPagerBottom();
$generated = true;
}
switch ($conf['whoiam']){
case 'content':return $this->content;
case 'pagerTop':return $this->pagerTop;
case 'pagerBottom':return $this->pagerBottom;
}
}
}
class user_view{
$inst;
function __construct(){
$this->inst = user_singleton::getInstance();
}
function justMain($content,$conf){
$this->inst->justMain($content,$conf);
}
}