Dear all,
I want to change the display format from "title : page 2 0f 3" to " title (2/3) ". I want to create a module to use alter to overwrite the function "function theme_smart_paging_page_title_suffix($variable) " so that I can get I want. However, I don't know how to write the alter function....Could anyone help??

Also, if I want the first page also show the number like "title (1/3)", how could I do that??

Thank you all~~

Comments

kplee9c’s picture

Version: 7.x-1.x-dev » 7.x-1.8
arpeggio’s picture

Status: Active » Fixed

Hi,

Yes, the theme_smart_paging_page_title_suffix() is the one that you need to override to change the the page title suffix. You can override that at your template.php (found at your theme folder) and you can add something like this:

/**
 * Theme for smart_paging_page_title_suffix.
 */
function phptemplate_smart_paging_page_title_suffix($variable) {
  static $title_suffix;
  static $set_title_done;
  if (isset($variable['page'])) {
    $page = $variable['page'];
    if (isset($page['suffix']) && isset($page['current_page']) && isset($page['total_page'])) {
      $title_suffix = '(' . ($page['current_page'] + 1) . '/' . $page['total_page'] . ')';
      // $variable['bypass_drupal_set_title'] can be set at:
      // THEME_preprocess_smart_paging_page_title_suffix()
      // MODULE_preprocess_smart_paging_page_title_suffix()
      if (!$set_title_done && !isset($variable['bypass_drupal_set_title'])) {
        // Target head title (<title> tag)
        drupal_set_title(drupal_get_title() . check_plain ($title_suffix), PASS_THROUGH);
        $set_title_done = TRUE;
      }
    }
  }
  return $title_suffix;
}
kplee9c’s picture

Thank you~ The code works perfect~

arpeggio’s picture

You're welcome.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.