Hi there,

I'm new to Drupal theming (I'm more a Wordpress themer)so I'm looking and trying to get my way through the theming process for a Drupal website.

So here's the thing, I have a small blog website to make for a small customer and he want's his front page to have small parts of the entire site, so basically what should be on the front page are these blocks:

  • About Me
  • Latest News
  • Latest Mixes (yes he's a DJ ;p)
  • Photo Gallery

All of these parts are already coded in plain HTML.
I understand the work process for a Drupal theme because it's very similar to Wordpress (at basic level).

I'm struggeling and looking for a way to show these blocks on the front page of his website and I don't find a usefull documentation of how to get this done.
The About me page is going to be a Page not a Story, so how to show this block on the page along with the rest?
And how about to show the rest (latest news etc...)?

Comments

chrislabeard’s picture

When using blocks you can specify the page that it needs to show up on.

Blocks >> Block_Name >> Configure

Then check out the "Page specific visibility settings." For it to show only on the front page use "".

Ideas by Nature
www.ideasbynature.com

chrislabeard’s picture

Also,

If you want to have specific design changes for the front page only. You can do this buy copying "page.tpl.php" and renaming it "page-front.tpl.php" and then make your changes this will effect only the front page. Its pretty similiar to wordpress. Your theme must also use phptemplate.

Ideas by Nature
www.ideasbynature.com

Yaeko-1’s picture

Thanks for the reply.

I did this but which variable will actualy print this out? I've just tried print $content; but then I get the "configure your website stuff" and the block that I've just created.

chrislabeard’s picture

On page.tpl.php to show blocks you need to have the region printed so

print $region_name

that will print all of the content in that region including blocks.

Also, you might want to check out views so you can have dynamic content instead of manually updating it.

Ideas by Nature
www.ideasbynature.com

56rosa’s picture

Hi,

I decide to join in and ask my question here, since I need to modify the layout of a node.
I have been advised to copy the page-front.tpl.php file and name it node-[nid]-page.tpl.php for a starting point.

I just want to change the layout slightly of each language page which I will create when I have the content.

At the moment, our front page i.e. homepage has a Header, a Navigation bar, a Banner region, and then the main container with a sidebar-left, a Content Top and a Content bottom, a sidebar-right as well as a Footer and a Closure.

I only want to get rid of the sidebar-left, since I want to simplify the layout of the main container to only 2 columns instead of 3 then (sidebar-left, content in the middle and sidebar-right).

Here is some of the code where I think that I need to modify something:

 <div id="homepagecontainer" class="clear-block">
    <div id="main" class="column">
      <div id="squeeze" class="clear-block">
        <div id="homepagecontent"> <?php print $content; 

I'm not sure what to do. Do I need to create another class? How can we see where the sidebar-left is?

Any suggestions or help welcome, as it is my first time doing something like this!

Thanks

chrislabeard’s picture

Hey,

Can you paste the code from the whole page? You need to find the Sidebar-Left Div.

Another thing you could do if you don't want to modify code is use path alias and give it to all of the node types and then use the block visibility settings.

Show on every page except:

node-type/*

Ideas by Nature
www.ideasbynature.com

56rosa’s picture

There is none. That's the problem. The Front page i.e homepage has 4 boxes instead of a content with 2 sidebars (left and right).
So, how can I specify that I want a sidebar-right then with a main content on the left then?

I was thinking of using this code that I have just found on the forum and replace the word left by right to make the right sidebar show:

<?php if ($right): ?>
        <div id="sidebar-left"><div id="sidebar-right-inner" class="region region-right">
          <?php print $right; ?>
        </div></div> <!-- /#sidebar-right-inner, /#sidebar-right -->
<?php endif; ?>

Here's the full code of the page, but there isn't any sidebar-left or right. May be I should use a copy of the page.tpl.php instead?

Code for the page-front.tpl.php:

<head>
<title><?php print $head_title; ?></title>
<?php print $head; ?><?php print $styles; ?><?php print $scripts; ?>
</head>
<?php /* different classes allow for separate theming of the home page */ ?>
<body class="<?php print $body_classes; ?>">
<div id="page">
  <div id="header">
    <div id="logo-title"> <?php print $search_box; ?>
      <div id="nav-login"><a href="http://blabal.com">Bla</a> <a href="http://blabla.com">Lol</a>  <a href="/user">Log in</a></div>
      <?php if (!empty($logo)): ?>
      <a href="<?php print $base_path; ?>" title="<?php print t('Home'); ?>" rel="home"> <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" id="logo" /> </a>
      <?php endif; ?>
      <div id="navigation" class="menu<?php if ($primary_links) { print " withprimary"; } if ($secondary_links) { print " withsecondary"; } ?> ">
        <?php if (!empty($primary_links)): ?>
        <div id="primary" class="clear-block"> <?php print theme('links', $primary_links); ?> </div>
        <?php endif; ?>
      </div>
      <div id="name-and-slogan">
        <?php if (!empty($site_name)): ?>
        <div id='site-name'><strong> <a href="<?php print $base_path ?>" title="<?php print t('Home'); ?>" rel="home"> <?php print $site_name; ?> </a> </strong></div>
        <?php endif; ?>
        <?php if (!empty($site_slogan)): ?>
        <div id='site-slogan'> <?php print $site_slogan; ?> </div>
        <?php endif; ?>
      </div>
    </div>
    <?php if (!empty($header)): ?>
    <div id="header-region"><?php print $header; ?></div>
    <?php endif; ?>
  </div>
  <div id="homepagecontainer" class="clear-block">
    <div id="main" class="column">
      <div id="squeeze" class="clear-block">
        <div id="homepagecontent"> <?php print $content; ?> </div>
      </div>
    </div>
  </div>
  <div id="footer-wrapper">
    <div id="footer"> <?php print $footer_message; ?></div>
  </div>
  <?php print $closure; ?></div>
chrislabeard’s picture

Yeah, I believe you can just do instead of node-[type].tpl.php, do page-[node-type].tpl.php.

That should fix you problem. Sometimes you have to add some custom code to the template.php

Check this out.

http://drupal.org/node/249726#comment-1935604

Ideas by Nature
www.ideasbynature.com

56rosa’s picture

Hi,

Thanks.

I guess that the only way of finding out how it's going to look like, is actually to create one.

I don't feel too confident to mess around with variables. If I use that solution, how can I still make appear a 2 column layout?
It's not that clear to me.

56rosa’s picture

Hi again,

I have tried to modify the page above and also tried to change the page-[node-type].tpl.php but without any success.

Could someone let me know how I can customize this page. Feel free to comment the code above.

I only want a main content with a sidebar-right. No sidebar-left.

I thought that it would be more straight-forward than that, but obviously, it is not working out for me!

I have found a way to have the layout I want by using Firebug and I can see that it seems possible by using css. But how can I link the css file to this new node-[nid]-page.tpl.php or page-node-type.tpl.php

Hope that I'm making sense right now.

And thanks for your help and time

chrislabeard’s picture

If you just want to use css I like to use conditional statments like.

">

Then in your main content you do main-content.sidebar-right #sidebar-left {display:none;}

Or however you get the point.

Ideas by Nature
www.ideasbynature.com