How to fetch Views total number of records in page.tpl.php before views.tpl called.

firoz2456's picture

See this image http://prntscr.com/7idx70 for more understanding.

I want to fetch Views total number of records in page.tpl.php before views.tpl called. Is it possible to fetch that row total before views rendered? I am also using contextual filter for this view. Views have page type display.

I have also used module https://www.drupal.org/project/views_record_count. but this will print total number of records on Views header or footer. (Not outside of views)

Comments

Wrong group? Anyway to answer

Marcus_Johansson's picture

Wrong group?

Anyway to answer your question.

One way is to get the count in the hook_views_pre_render and put it in a global or session and get it at the preoprocess of the page. Not the best solution.

or

Get the view via views_get_view() or views_get_current_view() in the preprocess of the page, since the view is cached in a static. The count should be in that object.

Consulting and Business

Group events

Add to calendar

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week