2010-02-12 110 views
0

現在,我的博客文章被生成爲我主要內容區域中的節點。在我的內容區塊中,只有一個區塊,這是爲了博客導航,它需要在博客文章的頂部,它有非常自定義的標記 - 我怎麼能扭轉順序?我不確定在哪裏移動這些帖子。重新排列博客帖子與內容塊的排序?

澄清:我需要我的區塊才顯示在主頁上,博客文章位於哪裏,我需要它顯示在博文以上。

回答

1

上市頁遺憾的是,並不是通過圖形管理界面完成此操作的簡單方法,因此您可能必須進入主題代碼才能進行此更改。海事組織,最簡單的方法是定義一個新的塊區域。

如果您使用的是貢獻/核心主題,則可能需要定義當前主題的子主題以進行更改。有關子主題的更多信息,請參閱http://drupal.org/node/225125

要創建新的塊區域,你需要將它添加到你的主題.info文件


name = My Theme 
description = Example 
core = 6.x 
engine = phptemplate 

regions[left] = Left Sidebar 
regions[right] = Right Sidebar 
regions[content] = Content 
regions[header] = Header 
regions[footer] = Footer 
regions[above_content] = Above content 

在這裏,除了默認的區域(左,右,內容,頁眉,頁腳)時,主題有一個名爲above_content的自定義區域。

然後,編輯您的主題的page.tpl.php文件,並將$above_content變量添加到將顯示在內容上方的模板中。例如,如果你延長加蘭主題,您可以添加$above_content變量,像這樣:

... 
<div id="center"><div id="squeeze"><div class="right-corner"><div class="left-corner"> 
      <?php print $breadcrumb; ?> 
      <?php if ($mission): print '<div id="mission">'. $mission .'</div>'; endif; ?> 
      <?php if ($tabs): print '<div id="tabs-wrapper" class="clear-block">'; endif; ?> 
      <?php if ($title): print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>'; endif; ?> 
      <?php if ($tabs): print '<ul class="tabs primary">'. $tabs .'</ul></div>'; endif; ?> 
      <?php if ($tabs2): print '<ul class="tabs secondary">'. $tabs2 .'</ul>'; endif; ?> 
      <?php if ($show_messages && $messages): print $messages; endif; ?> 
      <?php print $help; ?> 
      <div class="clear-block"> 
      <?php print $above_content ?> 
      <?php print $content ?> 
      </div> 
      <?php print $feed_icons ?> 
      <div id="footer"><?php print $footer_message . $footer ?></div> 
     </div></div></div></div> <!-- /.left-corner, /.right-corner, /#squeeze, /#center --> 
... 

然後,您可以將塊添加到塊管理頁面上的「以上內容」區域,並將其設置爲只顯示在首頁。

0

您可以控制它的設置塊的知名度在三個方面:

  • PHP語句
  • 在所有頁面上,除了上市
  • 只有在
+0

對不起,我還希望它在博客文章上方。碰巧知道該怎麼做? – 2010-02-12 11:35:05

+0

只是列出您想要顯示的頁面。 – googletorp 2010-02-12 12:03:56