2011-08-23 18 views
0

我有三列Drupal首頁的圖形項目,它有一個自定義內容的第一列和兩個爲最新消息(一個內容類型)設計的其他列顯示在圖像下方:Drupal的頭版 - 最新消息的兩列

enter image description here

我很新的Drupal和到目前爲止,我創建了自己page.front.tpl.php在我的PHPTemplate主題,像頁眉,頁腳,菜單,search_box等,當然還有內容的區域。現在我有$content區域的問題,其中應該有列如上所述。我的問題是:我如何設計它們(CSS?在Drupal的管理中的某個地方?使用單獨的塊?某些模塊?)以在項目中看起來像?

page.front.tpl.php片段:

<?php if ($content): ?><div class="content-middle"><?php print $content; ?></div><?php endif; ?> 

輸出簡化HTML結構(到目前爲止,只有兩個最近的新聞),我想以某種方式樣式是:

<div class="content-middle"> 

    <div class="node"> 
    <h2 class="title"> 
    <div class="content"> 

    <div class="node"> 
    <h2 class="title"> 
    <div class="content"> 

回答

1

您可以在主題中創建3個新區域。修改你的.info文件(例如MyThemeName.info),並寫:

regions[content_center_left] = Left Sidebar 
regions[content_center_middle] = Middle Sidebar 
regions[content_center_right] = Right Sidebar 

下一步是修改page.tpl.php中,或者如果你想在這兩個部分只在頭版您提供可以修改page-front.tpl.php。寫要顯示的部分如下:

<?php if ($content_center_left): ?> 
    <div class="content-left"> 
     <?php print $content_center_left?> 
    </div><!-- /content_center_left --> 
<?php endif; ?> 
<?php if ($content_center_middle): ?> 
    <div class="content-middle"> 
     <?php print $content_center_middle?> 
    </div><!-- /content_center_middle --> 
<?php endif; ?> 
<?php if ($content_center_right): ?> 
    <div class="content-right"> 
     <?php print $content_center_right?> 
    </div><!-- /content_center_right --> 
<?php endif; ?> 

現在你可以創建你的意見(如塊),並在這些部分顯示出來。

+0

我決定使用類似的解決方案:我沒有創建單獨的'page-front.tpl.php',但使用了<?php if($ is_front):?>'page.tpl.php'內部和創建了兩個基本相同的視圖,顯示一個最近的新聞與不同的偏移量(0和1)。 – Xaerxess

1

我建議使用Panels module

從項目頁面:

的面板模塊允許網站管理員來創建定製 佈局用於多種用途。它的核心是一個拖放內容管理器,可讓您在視覺上設計佈局並將內容 放置在該佈局中。與其他系統的集成允許您創建使用此的節點,使用此的着陸頁,甚至覆蓋系統頁面(如分類和節點頁面),以便您可以使用非常細粒度的 權限自定義網站的佈局。

+0

感謝Panels模塊的推薦,但它對我來說似乎過火了 - 我目前對CCK + Views + Features感到滿意(因此我可以在VC庫中保留我的觀點)。 – Xaerxess

0

與拉克斯曼13約定,小組肯定是要走的路,你可以用Views模塊,這將讓您獲取最新的新聞或任何查詢,你可以對你的內容顯示一倍。