Format the 'Submitted by' info of a Node in theme

By: admin

18 Jul 2011

Drupal's Hooks and API's are awesome. They make your life so easy :)
Below is the example of one of the API which returns the themed submitted-by string for the node.

In your thems's template.php you can specify the API :  phptemplate_node_submitted($node)

The usage is as below : 

 

/**
 * Format the submitted by site wide
 */
function phptemplate_node_submitted($node) {
 
  // Specific to the node type
  if ($node->type == 'blog') {
    $submittedBy = 'Posted by ' . theme('username', $node) . ', ' . date('F j', $node->created);
  } else {
    $submittedBy = 'By ' . theme('username', $node) . ', ' . date('F,Y', $node->created);
  }
  return $submittedBy;
}
 
This will change the submitted by text as per above :) 

 

No Responses yet to Format the 'Submitted by' info of a Node in theme

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

13 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

php.png    firefox.png    open_source.png    ubuntu.png    drupal.png    civicrm.png     jquery

About the Author

admin's picture

About Me

I am : Open source developer.

I love : Drupal & CiviCRM !!

Work : Consultant @ Capgemini

Recent comments

Follow Me

flickr.png    yahoo.png    facebook.png    twitter.png

google.png    youtube.png    wordpress.png   

       wordpress.png

Ohloh profile for rahulbile

User login