Joomla 我想改变页面标题的位置
在Joomla页面标题显示文章内部时,我想更改页面标题的位置,是否可以自定义页面标题位置 我在模板/protostar/index.php中包含了以下代码Joomla 我想改变页面标题的位置,joomla,Joomla,在Joomla页面标题显示文章内部时,我想更改页面标题的位置,是否可以自定义页面标题位置 我在模板/protostar/index.php中包含了以下代码 <?php if ($this->params->get('show_page_heading', 1)) : ?> <div class="page-header"> <h1> <?php echo $this->escape($this->param
<?php if ($this->params->get('show_page_heading', 1)) : ?>
<div class="page-header">
<h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1>
</div>
<?php endif;
if (!empty($this->item->pagination) && $this->item->pagination && !$this->item->paginationposition && $this->item->paginationrelative)
{
echo $this->item->pagination;
}
?>
你能做什么: 只需更新正确模板中的一个css文件,即可正确显示标题。如果标题只应在某些页面上重新格式化,而不是在所有页面上重新格式化,则应使用不同的模板 你应该做什么: 否则(如果您想改为更改php),您可以使用重写组件/com_content/views/article/default.php 如有必要,您可以同时执行上述两项操作 您不需要重写模板的index.php即可完成此操作。然而,如果你真的想,我会使用代码
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
if ($option=="com_content" && $view=="article") {
$ids = explode(':',JRequest::getString('id'));
$article_id = $ids[0];
$article =& JTable::getInstance("content");
$article->load($article_id);
echo $article->get("title");
}
抱歉,如果您想要更多,您需要提供更多:)
注:我在joomla 2.5上,但我知道joomla 3或多或少是一样的
资料来源:
是的,这是可能的。到目前为止您尝试了什么?我尝试在template/protostar/index.php中添加这段代码是的,但是是哪段代码?如果看不到任何代码,我们将无法帮助调试您的问题。请按照要求使用您在template/protostar/index.php中使用的代码编辑您的问题,请使用代码更新编辑您的问题。不要把它写在评论里,因为它更难读。您还需要提到当前使用的代码的结果。Protostar是Joomla 3.x模板,
JRequest
在Joomla 3.x;中已弃用)感谢@Lodder提供的信息。代码需要稍加修改,但你已经明白了。