I want to theme the text that appears on every node and says something like "Submitted by Jim on Tue, 06/17/2008 - 23:00". This seems to be produced by the following code in node.tpl.php:

if ($submitted):

endif;

So, how do I go about theming this output? What I would like to do first is remove the part that says who submitted the node, and just show the date it was submitted - not the time.

Any suggestions?

Comments

roopletheme’s picture

For D5, one way is to replace that code in node.tpl.php with something like this:

  if ($submitted): 
    print format_date($node->created, 'custom', 'M j Y');
  endif 

Using D6, the more elegant method would be to override theme_node_submitted.

ktleow’s picture

I use this code for Drupal 6 to print Submitted by admin on Saturday, 30 August, 2008 - 13:30

<span class="submitted">Submitted by <?php print $name ?> on <?php print format_date($node->created, 'custom', 'l, j F, Y - H:i'); ?></span>

Rob T’s picture

This comes in handy.

jim0203’s picture

Thanks to both of you; those solutions work great.

JohnnyHa’s picture

Is there any list somewhere that lists the variables you suggested here ? This solution is really valuable for theming.
Like what if i wanted to theme the title of a node and its content ? Not $content because that prints everything. I want to control every aspect.

ktleow’s picture

Yes there is a way to print out all the values in an easy way without PHP knowledge.
Download and use the Content Templates module.

-----
http://kahthong.com - A blog, personal and showcase site
My blog is proudly powered by Drupal CMS

JohnnyHa’s picture

Exactly what i was looking for thanks !

But i find it weird that this isnt a part of Drupal by default. No wonder why most Drupal sites look alike when you cant control the output 100% by default.

ktleow’s picture

Err, once you got those values right, you dont need Content templates anymore.
Basically those values are from Drupal itself.
You can even use print_r($node); for node values and print_r($block); for block values, I THINK?

-----
http://kahthong.com - A blog, personal and showcase site
My blog is proudly powered by Drupal CMS

avangelist’s picture

I want to pull the entire content of the user profile out on the end of story nodes based on the user.

So really just want a complete array list of what comes out of $submitted.

How do I find out what that array contains with Devel?
Web Developer
Music Photographer

jim0203’s picture

Have you got the theme developer part of devel activated? It's only in D6, but it should do what you're looking for.