http://docs.joomla.org/Search_Engine_Optimisation
在Dynamic MetaDesc in a list of articles by category
部分
我遵循了,我得到了一个致命的错误,指出Call to a member function GetOne() on a non-object in D:'xampp'htdocs'zoomla'includes'application.php on line 391
有人能帮我处理一下吗?非常感谢。顺便说一句,上一节不适合Joomla 2.5,你也能帮我吗?
Add Heading Tags in the Titles for More Relevance
怎么样????对于Joomla 2.5
这似乎适用于Joomla的旧版本。
此代码片段:
if (strcasecmp($_GET['view'],'category')==0) {
$description = $database->GetOne("SELECT description FROM #__categories WHERE id={$_GET['id']}");
}
很可能与(Joomla 2.5中)相同:
if (strcasecmp($_GET['view'],'category')==0) {
$db = JFactory::getDBO();
$db->setQuery("SELECT description FROM #__categories WHERE id=".(int)$_GET['id']);
$description = $db->loadResult();
}
请注意,我的代码没有经过测试。
那篇文章与Joomla无关!2.5.对于初学者来说,类别视图已经包括元描述和关键字(如果它们存在于view.html.php
中)
if ($this->category->metadesc)
{
$this->document->setDescription($this->category->metadesc);
}
elseif (!$this->category->metadesc && $this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->category->metakey)
{
$this->document->setMetadata('keywords', $this->category->metakey);
}
elseif (!$this->category->metakey && $this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
}
这同样适用于为文章标题添加标题标签的部分:
<?php if ($params->get('show_title')) : ?>
<h2>
<?php if ($params->get('link_titles') && !empty($this->item->readmore_link)) : ?>
<a href="<?php echo $this->item->readmore_link; ?>">
<?php echo $this->escape($this->item->title); ?></a>
<?php else : ?>
<?php echo $this->escape($this->item->title); ?>
<?php endif; ?>
</h2>
<?php endif; ?>
如果您确实希望更改输出的方式,则应在模板中为com_content
创建模板覆盖。