By mouse77e on
I have a content type called “uprofile” and the template for this is in node-uprofile.tpl.php. in that content type I do not want to see the standard $title as used below in line 68 from my page.tpl.php
<?php if ($title): print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>'; endif; ?>
how do I get Drupal to say ‘if this is a uprofile page do not print the $title’? but leave it active in all the rest?
many thanks
Comments
hi, try something like: if
hi, try something like:
if ($node->type != 'uprofile') print $title;_______________________
Austrian Drupal Usergroup
________________________
Drupal Austria Association
node.tpl.php not page.tpl.php
shouldn't this be done in the node.tpl.php not the page.tpl.php-----and the code looks that was just submitted
henns20
In the default phptemplate,
In the default phptemplate, the heading (title) is output by the node.tpl.php iff there are multiple nodes being displayed on the page. Otherwise it is output by page.tpl.php.
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
Almost
just tried
... but it kills all titles... any ideas where i am going wrong?
can't be that hard...
only i just cant see it.... help pretty please
<?php if
tried to clean up the code but to no avail... the first if
if ($node->type != 'uprofile') {seems to be the issue... if i add a value to the next line i.e. 'print "TEST";' it appears on all pagesLooks like 'uprofile' is not
Looks like 'uprofile' is not the right string to use there ... if you change your print "" to print "$node->type" you should see what is required. Then you should be able to use code like:
Remember $node is only available to page.tpl.php if you are viewing a single node page.
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
Nope... but thanks GPK
Thanks mate but... still no joy...
What happens if you print
What happens if you print node->type ?
Also note that the logic in the last code you posted was reversed, i.e. your code would omit the title for nodes *not* of type uprofile and print it only for nodes of type uprofile.
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
sorry cant see it...
Also note that the logic in the last code you posted was reversed, i.e. your code would omit the title for nodes *not* of type uprofile and print it only for nodes of type uprofile.
sorry i just can't see what you are getting at (code blindness setting in)
<?php if
This code is saying:
If node is not uprofile then print an empty string in place of the title, otherwise print the title (if it is not an empty string).
In other words, print the title if and only if the node is uprofile.
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
Put the following styling
Put the following styling code on top of your node-uprofile.tpl.php, and the title will be there still, but it won't be displayed.
if ($title): print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>'; endif;Obviously, this rules out the use of h2 markups in other parts of your node-uprofile texts, possibly also in sidebars, but if you can live with that limitation, or if you use different styling for your sidebars, this approach easily does the trick.
Ludo
I managed to remove titles
Thank you for the info, I managed to remove h2 titles changing the code at line 68 page.tpl.php (garland theme).
Hope it helps
Node and Comments Form Setting Module
This module allows you to omit titles from certain node types, amongst other things: http://drupal.org/project/nodeformsettings