Hi,
I would like to print out the total amount of nodes in a view in the page header of a view. I'm using views fastsearch to implement a site search and want to display
"Your search for keyword returned X results"
How can I insert the amount of nodes in my list into X.
Thanks,
Gary
Comments
Comment #1
merlinofchaos commentedIf you're using the pager, I believe you can look in the global variable (use global $pager_total) with the index of your element ID which is probably 0. So in most cases,
Comment #2
asak commented@merlinofchaos: This does calculate something.. but not the correct result.
In a table view with 4 (or 5) results i'm getting a "1" in the $pager_total.
With 17 results i'm getting "2".
I have no idea what this is calculating ;)
How do I know what is the "Element ID" ?
Comment #3
asak commentedOk i get it - i'm getting the number of PAGES and not the number of NODES.
Solution anybody (i know no PHP...) ?
Thanks!
Comment #4
merlinofchaos commentedThe element ID is probably 0. $pager_total might be giving the total number of pages, though I thought it gave total results. Looking at the code, I see I should've given $pager_total_items.
Sorry about that.
Comment #5
asak commentedHey merlin, that doesn't seem to work... Any other ideas? ;)
Thanks!
Comment #6
asak commentedVery sorry. this works perfectly. thank you.
To display num. of nodes:
To display num. of pages:
Comment #7
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #8
mattbk commentedThanks! For the record, this works in Drupal 7/D7 as well.