2014-11-24 118 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