I need to make this change quickly and don't have time to read through the forums.

I have a basic Drupal 5 site - Garland theme. Goto www.madronestudio.com

I need to be able to hide the display of the title. Do you see the little dot (period) just above and to the left of the "Art of Wood" image. This is the title of the page, and I need to hide it.

I need exact instructions on what to do.

Thanks in advance to anyone who can help.

Comments

johsw’s picture

...or just on the one on the frontpage?

/Johs.

zahor’s picture

The Solution: in your css file add the following:

#node-55 h2 a {visibility: hidden!important;}

That should do it.

Your css on the front page needs some work also. Look at what happens when the window is resized.

Let me know if that works.

alanburke’s picture

page.tpl.php of your Garland theme
in
themes/garland

change the start of line 68
from

 if ($title): print ...
</

to

 if ($title &&!$is_front): print ...
</

This removes the title, on the home page only.[where your little dot is.]
Let us know if it works.

andrew7’s picture

Thank you Alan.

manoloka’s picture

Can this be done in other pages (i.e. no front page)?

alanburke’s picture

Just remove the whole
print $title;
and that will get rid of the title

Alan

manoloka’s picture

That worked great for me :-)

Thanks

dsellinger’s picture

I just wanted to say that

<?php
if ($title &&!$is_front): print ...
</
?>

worked great for cleaning up my front page. (drupal 6)

bojanz’s picture

Go to themes/garland, and you will see node.tpl.php. This is the template of every article on your site.
Open it.
You will see this code:

<?php if ($page == 0): ?>
  <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>

This is displaying your title.

Solution: make a sepparate template
Copy node.tpl.php to node-frontpage.tpl.php.
node-frontpage.tpl.php is the node template for the frontpage only, as you can see from it's name.
Open node-frontpage.tpl.php and delete the code above.

This will remove the title from any node you put on the frontpage (in the future, if you change the frontpage node to some other node, the title will still be removed).
I think this is a better solution than the css fix, since this works for any node on the frontpage, and only removes the title if the node is on the frontpage.

Hope this helps.
Bojan

milksamsa’s picture

I have some problems understanding a thing in Drupal template system.

I've been able to customize the frontpage in this way:

- I created a new homepage aliased "homepage" with the panels module.
- I modified the default homepage in /admin/settings/site-information
- I've been able to customize the page listing view by duplicating page.tpl.php into page-homepage.tpl.php
(in this way I've been able to delete the breadcrumbs, to modify the padding, delete the H2 title, etc. etc)

I'm not able to customize the nodes being listed in the new homepage though!

I would like the title to display inside .content class DIV, but I'm not able to reference the nodes properly!
I tried creating node-homepage.tpl.php and alternatively node-frontpage.tpl.php but the things I modify in this files simply won't appear...

What am I missing? Where am I wrong? Can someone help me on the matter?

Thank you.

rileyspiller’s picture

Same problem... any advice?

gladideg’s picture

I have the same issue with Panels.

A Panels page is called /category4 and lists 3 types of nodes, from different terms. When I name a tpl file "node-category4.tpl.php", it isn't read, but uses the default node.

Any suggestions?

Solution:

I added this code to the "template.php" file, which resides in the folder of my current theme.

function _phptemplate_variables($hook, $vars = array()) {
  if ($hook == 'node')
  {
    // Additional node templates based on original path, path alias and type.
    // More specific paths have more weight. Path aliases have more weight
    // than original paths. Suggestions with node type have more weight than without.

    $alias = $_GET['q'];
    $suggestions = array();
    $name_prefix = 'node';
    $node_type = !empty($vars['node']->type) ? '-' . $vars['node']->type : '';
    $add_path = '';

    // generating additional node template names, based on original path
    foreach (explode('/', $alias) as $path_part) {
      $add_path .= !empty($path_part) ? '-' . $path_part : '';
      $suggestions[] = $name_prefix . $add_path;
      $suggestions[] = $name_prefix . $node_type . $add_path;
    }

    // adding suggestions
    $vars['template_files'] = $suggestions;

    // using aliases?
    if (module_exists('path')) {
      $alias = drupal_get_path_alias($_GET['q']);

      if ($alias != $_GET['q']) {
        $suggestions = array();
        $add_path = '';
        // generating additional node  template names, based on alias path
        foreach (explode('/', $alias) as $path_part) {
          $add_path .= !empty($path_part) ? '-' . $path_part : '';
          $suggestions[] = $name_prefix . $add_path;
          $suggestions[] = $name_prefix . $node_type . $add_path;
        }
      }
      // adding suggestions
      $vars['template_files'] = array_merge($vars['template_files'], $suggestions);
    }
  }
  return $vars;
}

I can now use a file called node-CATEGORY4.tpl.php as the node-template.

PS: If the script fails and tells you that the function has allready been called, replace that code with this one if it doesn't kill the rest of your page.

Cheers

joachim’s picture

I can't get node-frontpage.tpl.php to work -- the template is using node.tpl.php even for nodes displayed on the front page, whether as promoted to the feed or set as the entire front page in the site information options.

add1sun’s picture

I amy be wrong but as far as I know, *node*-frontpage is not a default suggestion in phptemplate engine, *page*-front is. You will need to add that suggestion to your template.php for that to work. While this handbook page (http://drupal.org/node/117491) is for adding path alias' as suggestions, you can see how the $vars['template_files'] is the var that you need to add the suggestion to the _phptemplate_variables hook.

Drupalize.Me, The best Drupal training, available all the time, anywhere!

bgilday’s picture

Zahor's fix to make the simple one-liner addition to my style.css did the trick. Since his was the first post, he gets the bounty.

I haven't tried the other suggestions yet, but I will since they seem more robust.

Much appreciated.

Brian Gilday
Municode
www.municode.com

BradleyT’s picture

the CSS "fix" is the worst one to impliment. I'd give my vote to the php one that checks to see if the page is the front page.

And for the guys trying to make a template for the homepage -

I created my own front page this week and followed http://drupalzilla.com/tutorial/theming/drupal-custom-front-page
without any problems.

dmurphy’s picture

I'm trying to do the same thing in Drupal 6, but it looks like things have changed. I just have a print $content , and that is printing the title along with the content. Any ideas on the best way to change that?

Thanks!

dmurphy’s picture

What is it about posting a question that you always find the answer two seconds later?

I was looking in the page.tpl.php. Once I created node.tpl.php, it worked as expected.