Hide title for a specific content type

stonie10 - March 11, 2008 - 15:40

Hi everyone,

I created a new content type where I'd like to put in some quotes. The text itself is in the description-field - so there is no need for a title. Is there a possibility how I can hide the title on the site or leave the title blank?
This should only be for this single content type, not for the whole site!

Thanks for your help :-)

--stonie10

=-=

VeryMisunderstood - March 11, 2008 - 15:42

you can:

A) use a space for the title

B) investigate the autonodetitle.module

C) leave the title field nad use a custom.tpl.php file in the form of node-CONTENTTYPE.tpl.php and leave the title out.

_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

One of the quickest ways to

ronan - March 11, 2008 - 15:45

One of the quickest ways to do this is to add

<?php
if( $page ) {
$GLOBALS['supress_title'] = true;
}
?>

to your node-xxx.tpl.php file and

<?php if ($title != "" && !$GLOBALS['supress_title']  ): ?>
      <h2 class="content-title"><?php print $title ?></h2>
<?php endif; ?>

or similar to your page.tpl.php.

It's not the cleanest way to do it but it works and it's easy.
------------------------------------
Ronan - Gorton Studios - http://www.gortonstudios.com/

Thanks!

stonie10 - March 11, 2008 - 15:50

Wow, thanks for the fast help! :-)

I will try these two methods and see if it works for me.

--stonie10

Isn't there a way to

mr_dimsum - March 11, 2008 - 16:14

Isn't there a way to completely modify the Create Content Type pages so fields are completely withheld from the user? Would this be the approach to do it.. Or is there not an existing module that can apply this rather than making overriding thematic pages?

You may be talking about the

ronan - March 11, 2008 - 16:48

You may be talking about the contemplate.module which allows for altering the display of fields without editing templates. Unfortunately the title field is not handled at the content type level, but is displayed by page.tpl.php, so there's no good way to suppress the page title without touching that file. Somebody should correct me if they've found a better way to do this though.

------------------------------------
Ronan - Gorton Studios - http://www.gortonstudios.com/

Hello Ronan, Thanks for the

mr_dimsum - March 11, 2008 - 17:17

Hello Ronan,

Thanks for the quick reply. I never knew the Contemplate module also handles the Content Type creation pages as well. I assumed it was only able to modify/manipulate how the content is displayed and omit/remove items from being seen. I haven't had any experience with the module first hand, so I may be wrong. You're basically saying it can do both?

=-=

VeryMisunderstood - March 11, 2008 - 17:20

yes it can do both, if you don't want fields to be seen you just omit them (the varibales) from the tpl.php file.

Ultimatley you can add other variables as well, as contemplate will show you everything that is available to the tpl.php. What you use or don't use for that matter, is your choice.

_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

Hi, Is it then possible then

Summit - March 25, 2008 - 16:13

Hi,

Is it then possible then to hide a nodetype from the content create ("node/add") page, for instance a ""forumreply" nodetype, which you still want to show the users on other pages?
greetings,
Martijn

 
 

Drupal is a registered trademark of Dries Buytaert.