6 replies [Last post]
simonswiss's picture
Offline
Joined: 02/13/2010

I am trying to figure out how to get the title of my views display in page display. Whenever i switch to other themes like garland, the title is displayed. However, it doesn't show up in my starfish theme.

Actually, only the "page" content type allows me to display the title...

Any idea why?

Thanks!

Simon

simonswiss's picture
Offline
Joined: 02/13/2010

Ok i found the answer to my own question. I think it was because

<?php print $title ?>

is called in node.tpl.php and not in page.tpl.php like some other themes do.

Because i wanted to display the title in views also, i moved<?php print $title ?> into page.tpl.php, along with the proper html layout (div class="node-title",h1).

I have now the title of my views displaying nicely!

Rob D.'s picture
Offline
Joined: 04/09/2008

Yeah, that was the reason. I'm not sure why I chose to do it that way in the first place. I'll make sure to fix it when the theme is updated. :)

jeanprobert's picture
Offline
Joined: 11/29/2009

I'm going to need just a bit more help on this. If I add

<?php print $title ?>

to page.tpl.php and assign the appropriate class, I get the title on my view, but on regular pages I get the title twice.

What do I need to do additionally to get only one page title, but still get all my node titles and also get my view title?

(I'm a bit new to Drupal theming, that's why I bought a theme)

Thanks!

Rob D.'s picture
Offline
Joined: 04/09/2008

Hi,

The reference to <?php print $title ?> in node.tpl.php (for the full node, not the teasers) also had to be removed. I've attached an altered version of the node.tpl.php file and I think that should work, provided you still have the reference in page.tpl.php.

AttachmentSize
node.tpl_.php.txt 1.83 KB
jeanprobert's picture
Offline
Joined: 11/29/2009

That worked, thanks. : )

(I thought I tried the same thing earlier, and lost my regular page titles, but I probably removed the wrong thing from the node template.)

jeanprobert's picture
Offline
Joined: 11/29/2009

Actually, that wasn't enough. I also had to add the conditional statement to the print title request, because I have some pages where the title is handled in a panel, and I was getting unwanted styling (borders) when the page did not have a title.

Edit: I can't use the pre tag so I can't include the entire thing here.

But my site requires a conditional title, I can't simply print the title.

Support hours: 9AM - 5PM EST, Mon - Fri

Follow us on: