2014-11-24 115 views
0

在Joomla页面标题显示文章内部我想改变页面标题的位置,是否可以自定义页面标题位置?我想更改页面标题位置

我已经包括以下中模板/原恒星码/ index.php文件

<?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; 
} 
?> 
+0

是的,它是可能的。你试过什么了? – Lodder 2014-11-24 13:18:26

+0

我试着在**模板/原恒星/ index.php中添加该代码** params->获取( 'show_page_heading')):?> \t

user3555898 2014-11-24 13:37:04

+0

是的,但哪些代码?如果我们看不到任何代码,我们无法帮助您调试您的问题。请在** template/protostar/index.php ** <?php if($ this-> params-> get('show_page_heading',1))中使用 – Lodder 2014-11-24 13:37:49

回答

1

你可以做什么: 刚刚更新了正确的模板的css文件中的一个,才能正确显示页眉。如果标题只能在一些页面上重新格式化,而不是全部,那么你应该使用不同的模板。

你应该做的: 否则(如果你想改变PHP替代),可以覆盖组件/ com_content /视图/条/如default.php使用standard joomla override method

如果需要,您可以同时进行上述两项操作。

你不应该为了做到这一点而重写模板的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"); 
} 

对不起你就越需要给予更多的:)

PS。我在joomla 2.5上,但我知道joomla 3它或多或少是一样的东西。

来源:http://forum.joomla.org/viewtopic.php?t=525350 http://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core

+0

Protostar是Joomla 3.x模板和'JRequest'已经在Joomla 3.x中弃用;) – Lodder 2014-11-24 16:14:12

+0

感谢@Lodder的信息。代码需要稍微调整一下,但你明白了。 – tomjm 2014-11-25 10:37:06