I'm looking for a way to show the original post on the first page only.
Is there any known solution to do this?

Comments

aymerick’s picture

Here is one way to do that. This is probably not the most efficient way to do it, but it is the one I use :)

1. copy the function phptemplate_node() you find in /themes/engines/phptemplate/phptemplate.engine, then past it in the template.php file of your theme.

2. rename this function to yourtheme_node()

3. Add the following code at the top this function:

  if ($page && ($node->type == 'forum') && !empty($_GET['page'])) {
    // Do not display node in every pagined forum pages
    return '';
  }

So, for example, I use the zen theme, and so I have added this function is the template.php file of the zen theme folder:

/**
 * Theme override for phptemplate.engine
 */
function zen_node($node, $teaser = 0, $page = 0) {
  if ($page && ($node->type == 'forum') && !empty($_GET['page'])) {
    // Do not display node in every pagined forum pages
    return '';
  }
  
  if (module_exists('taxonomy')) {
    $taxonomy = taxonomy_link('taxonomy terms', $node);
  }
  else {
    $taxonomy = array();
  }

  $variables = array(
    'content'        => ($teaser && $node->teaser) ? $node->teaser : $node->body,
    'date'           => format_date($node->created),
    'links'          => $node->links ? theme('links', $node->links, array('class' => 'links inline')) : '',
    'name'           => theme('username', $node),
    'node'           => $node,  // we pass the actual node to allow more customization
    'node_url'       => url('node/'. $node->nid),
    'page'           => $page,
    'taxonomy'       => $taxonomy,
    'teaser'         => $teaser,
    'terms'          => theme('links', $taxonomy, array('class' => 'links inline')),
    'title'          => check_plain($node->title)
  );

  // Flatten the node object's member fields.
  $variables = array_merge((array)$node, $variables);

  // Display info only on certain node types.
  if (theme_get_setting('toggle_node_info_' . $node->type)) {
    $variables['submitted'] = t('Submitted by !a on @b.', array('!a' => theme('username', $node), '@b' => format_date($node->created)));
    $variables['picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', $node) : '';
  }
  else {
    $variables['submitted'] = '';
    $variables['picture'] = '';
  }

  return _phptemplate_callback('node', $variables, array('node-' . $node->type));
}

If someone have a simplier way to do that...

liam mcdermott’s picture

Status: Active » Fixed

Marking as fixed, am assuming the answer given worked.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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