editing the $submitted content

Cosmy - January 14, 2008 - 11:06

Hello.
I'd like to delete the author from the "submitted" string. The content of the variable $submitted should be only date and hour, but i'm not able to do it from the administration.
What can i do?

You can override the

ugerhard - January 14, 2008 - 11:48

You can override the variable in the template.php of your theme, specifically in the function _phptemplate_variables. Have a look at

http://drupal.org/node/16383

The same mechanism applies for overriding existing variables.

Alternatively you could just delete the $submitted printout from your node.tpl.php and insert something like

<?php print format_date($node->created, 'small')) ?>

See http://api.drupal.org/api/function/format_date/5

Great it works. But if i

Cosmy - January 19, 2008 - 19:08

Great it works.
But if i want to use the format_date in template.php to override the $submitted variable that is the code:

function _phptemplate_variables($hook, $vars) {
switch($hook) {
case 'node' :
$vars['submitted'] = format_date($vars['node']->created, 'small');
break;
}
return $vars;
}

 
 

Drupal is a registered trademark of Dries Buytaert.