Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用户登录joomla 1.5后更改模板_Joomla_Joomla1.5 - Fatal编程技术网

用户登录joomla 1.5后更改模板

用户登录joomla 1.5后更改模板,joomla,joomla1.5,Joomla,Joomla1.5,有人试图在代码中更改joomla 1.5模板吗?不知道如何在当前版本上执行此操作。我只是想在用户登录后更改模板 因此,我编写了如下代码: $mainframe->setTemplate('newtemplate'); 但它不起作用。当我看到joomla application.php时,哎呀,那里没有setTemplate函数,但它在1.5之前就已经存在了(基于我在web上的搜索)。 有人知道怎么做吗 更新: 似乎我们可以设置用户状态并读取该用户状态,然后进行渲染。但我不知道joomla

有人试图在代码中更改joomla 1.5模板吗?不知道如何在当前版本上执行此操作。我只是想在用户登录后更改模板

因此,我编写了如下代码:

$mainframe->setTemplate('newtemplate');
但它不起作用。当我看到joomla application.php时,哎呀,那里没有setTemplate函数,但它在1.5之前就已经存在了(基于我在web上的搜索)。 有人知道怎么做吗

更新: 似乎我们可以设置用户状态并读取该用户状态,然后进行渲染。但我不知道joomla在哪里呈现模板,因为我在library/joomla/application.php的insite render()中放置了一段代码,但没有执行。这就是我所做的:

function render()
{
    $params = array(
        'template'     => $this->getTemplate(),
        'file'        => 'index.php',
        'directory'    => JPATH_THEMES
    );

    // I added this code, where i set the user state $option.template somewhere else
    $template = $mainframe->getUserState( "$option.template", 'FoxySales01VIP' );
    if(!empty($template)){
        $params['template'] = $template;
    }

    $document =& JFactory::getDocument();
    $data = $document->render($this->getCfg('caching'), $params );
    JResponse::setBody($data);
}

没关系,我解决了

只需将核心库(JDocument类)中的代码更改为从会话中读取模板,就可以了

谢谢