0
votes

I have graphical project of three-column Drupal front page which has first column for one piece of custom content and two other colums designed for most recent news (one content type) as it is shown on image below:

enter image description here

I am quite new to Drupal and so far I created my own page.front.tpl.php in my PHPTemplate theme with regions like header, footer, menu, search_box etc and content of course. Now I have problem with $content region, in which there should be columns as I described above. My question is: How do I style them (CSS? somewhere in Drupal's admin? use separate blocks? Some module?) to look like in project?

page.front.tpl.php fragment:

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

Output simplified HTML structure (so far only two most recent news), I want to style this somehow:

<div class="content-middle">

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

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

3 Answers

1
votes

I recommend using the Panels module.

From the project page:

The Panels module allows a site administrator to create customized layouts for multiple uses. At its core it is a drag and drop content manager that lets you visually design a layout and place content within that layout. Integration with other systems allows you to create nodes that use this, landing pages that use this, and even override system pages such as taxonomy and the node page so that you can customize the layout of your site with very fine grained permissions.

1
votes

You can create 3 new sections in your theme. Modify your .info file (for example MyThemeName.info) and write the following :

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

The next step is to modify your page.tpl.php or if you want these sections to be available only in front page you can modify page-front.tpl.php. Write the following where you want the sections to be displayed:

<?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; ?>

Now you can create your views (as blocks) and display them in these sections.

0
votes

Agreed with Laxman 13 , Panels is definitely the way to go, you could double it with the Views module , which would allow you to retrieve the most recent news or whatever query you may have for you content display.