【问题标题】:AddStyleSheet Error on Joomla 3.0Joomla 3.0 上的 AddStyleSheet 错误
【发布时间】:2013-10-01 00:50:18
【问题描述】:

我收到了错误

Fatal error: Call to a member function addStyleSheet() on a non-object in /home/[hidden]/public_html/msa/templates/protostar/index.php on line 187

当我尝试仅查看我网站上的某些页面时。我正在使用 Joomla 3.1.5,这是我的模板代码:

<?php defined( '_JEXEC' ) or die( 'Restricted access' );?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<!-- Include Joomla Header -->
<jdoc:include type="head" />
<!-- Get page title -->
<?php $article = JTable::getInstance("content"); $article->load(JRequest::getInt("id")); $pageTitle = $article->get("title"); ?>
<!-- Open Graph -->
<meta property="og:title" content="<?php echo $pageTitle; ?>"/>
<meta property="og:site_name" content=""/>
<!-- Google Analytics + Webmaster -->
<!-- CSS --->
<link rel="stylesheet" href="/templates/[hidden]/css/responsive-grid.css" media="screen, print, handheld" />
<link rel="stylesheet" href="/templates/[hidden]/css/style.css" media="screen, print, handheld" />
<?php

$document = JFactory::getDocument();
$document->addStyleSheet('templates/[hidden]/style.css');
$document->addStyleSheet(JUri::base().'templates/[hidden]/css/style.css');

JHtml::stylesheet('templates/[hidden]/css/style.css');
?>

【问题讨论】:

    标签: php joomla-extensions joomla3.1


    【解决方案1】:

    经过深思熟虑和寻找,我发现这个错误是因为我的模板没有设置为默认值。不知道为什么它只发生在某些页面上,但将模板设置为默认值解决了这个问题。

    【讨论】:

      猜你喜欢
      • 2012-12-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-01
      • 1970-01-01
      • 2013-01-03
      • 2012-12-10
      • 1970-01-01
      • 2013-05-10
      相关资源
      最近更新 更多