You are here

function theme_mostpopular_item in Drupal Most Popular 6

Themes an individual entry in the most popular results. The $item includes a title, url and a count of the number of times it appears within the interval.

By default, this theme function returns HTML of the form:

<a href='$item->url'> <span class='title'>$item->title</span> <span class='count'>($item->count times)</span> </a>

If variable mostpopular_show_count is set to false, the <span class='count'>...</span> part will not appear.

Parameters

MostPopularItem $item: A single most popular item to show. It will have at least the following:

  • title: The title of the page
  • url: The URL of the page
  • count: The number of times the page was viewed.

integer $sid: The service ID of the currently-selected service.

integer $iid: The interval ID of the currently-selected interval.

1 theme call to theme_mostpopular_item()
theme_mostpopular_items in ./mostpopular.block.inc
Themes a list of the most popular items for the given service.

File

./mostpopular.block.inc, line 296
Defines all the pages, blocks and themes for rendering the most popular data to general users.

Code

function theme_mostpopular_item($item, $sid, $iid) {
  $text = '<span class="title">' . check_plain($item->title) . '</span>';
  if (variable_get('mostpopular_show_count', 1)) {
    $text .= ' <span class="count">' . t("(@count times)", array(
      '@count' => $item->count,
    )) . '</span>';
  }
  return l($text, $item->url, array(
    'html' => TRUE,
  ));
}