I'm trying to change te prev/next links of the date_browser. In date-navigation.tpl.php i see the following line:

print l('« ' . ($block ? '' : date_t('Prev', 'date_nav')), $prev_url, $prev_options);

Is it possible to change this, so i'll see a list of months, for example:

nov 2010 dec 2010 Jan 2011 febr 2011 mar 2011

Comments

jmary’s picture

Issue summary: View changes

in D7 :
Copy the file date-views-pager.tpl.php in your templates directory.

Then modify it as follows :

<?php
/**
 * @file
 * Template file for the example display.
 *
 * Variables available:
 * 
 * $plugin: The pager plugin object. This contains the view.
 *
 * $plugin->view
 *   The view object for this navigation.
 *
 * $nav_title
 *   The formatted title for this view. In the case of block
 *   views, it will be a link to the full view, otherwise it will
 *   be the formatted name of the year, month, day, or week.
 *
 * $prev_url
 * $next_url
 *   Urls for the previous and next calendar pages. The links are
 *   composed in the template to make it easier to change the text,
 *   add images, etc.
 *
 * $prev_options
 * $next_options
 *   Query strings and other options for the links that need to
 *   be used in the l() function, including rel=nofollow.
 */
?>
<?php if (!empty($pager_prefix)) print $pager_prefix; ?>
<div class="date-nav-wrapper clearfix<?php if (!empty($extra_classes)) print $extra_classes; ?>">
  <div class="date-nav item-list">
    <div class="date-heading">
      <h3><?php print $nav_title ?></h3>
    </div>
    <?php //Here comes the mofication
      $now = strtotime("$nav_title"); // We assume that $nav_title is a formatted date "M Y", which is bad.
      $prev = date("M Y", strtotime('-1month',$now));
      $next = date("M Y", strtotime('+1month',$now));
    ?>
    <ul class="pager">
    <?php if (!empty($prev_url)) : ?>
      <li class="date-prev">
        <?php print l('&laquo;' . ($mini ? '' : ' ' . t($prev, array(), array('context' => 'date_nav'))), $prev_url, $prev_options); ?>
      &nbsp;</li>
    <?php endif; ?>
    <?php if (!empty($next_url)) : ?>
      <li class="date-next">&nbsp;
        <?php print l(($mini ? '' : t($next, array(), array('context' => 'date_nav')) . ' ') . '&raquo;', $next_url, $next_options); ?>
      </li>
    <?php endif; ?>
    </ul>
  </div>
</div>
?>
DamienMcKenna’s picture

Status: Active » Closed (outdated)

We're sorry but the D6 release of Date module is no longer being supported. You are encouraged to update to Drupal 7 or 8, or direct questions to Drupal Answers.