frankyonnetti
7/7/2013 - 8:35 PM

#drupal 7 submitted format

Drupal 7 - submitted format #drupal #d7

<?php if ($display_submitted): ?>
  <p class="submitted">
    <?php
      print t('@date',
      array('@date' => format_date($node->created, 'custom', 'l, F j, Y')));
    ?>
  </p>
<?php endif; ?>


<?php if ($display_submitted): ?>
  <div class="posted">
  <?php if ($user_picture): ?>
    <?php print $user_picture; ?>
  <?php endif; ?>
  <?php
    print t('Posted by !username on !datetime', array(
      '!username' => $name,
      '!datetime' => format_date($node->created, 'custom', ' l, F j, Y')
    ));
  ?>
  </div>
<?php endif; ?>


<?php
/*
 * template.php
 * http://www.tipstank.com/2011/06/02/drupal-7-submitted-by-customization
 */
function THEME_preprocess_node(&$variables, $hook) {
  $variables['submitted'] =  t('Submitted on !datetime by !username', 
		array(
		'!username' => $variables['name'], 
		'!datetime' => $variables['date'],
  ));
}

function THEME_preprocess_node(&$vars, $hook) {
  $vars['submitted'] = t('@date', array('@date' => date("l, M jS, Y", $vars['created'])));
}