Is there an easy way to detect if the currently processed node in node.tpl.php is the first or last node of the page's main content?

Comments

kbahey’s picture

There are two functions in /includes/pager.inc called:

- theme_pager_last()
- theme_pager_first()

http://drupaldocs.org/api/head/function/theme_pager_last
http://drupaldocs.org/api/head/function/theme_pager_first

I am not sure, but perhaps you can override them in the theme? Worst case is you can modify the pager.inc itself.

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

dors’s picture

Thanks for your reply, but I'm not sure that you understood me correctly. I'm not wanting to modify a pager, but rather output additional/different HTML for the first/last displayed main-content node of a page, e.g. the startpage.

Steven’s picture

There is no way to currently do this. You can use a static variable hack to detect the first node, but that's all. Considering opening a feature request for the theme engine. I think adding counters and totals to the data passed to the node template will be the easiest solution.

--
If you have a problem, please search before posting a question.