0

See this image 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 views_record_count. but this will print total number of records on Views header or footer. (Not outside of views)

  • I don't think it's possible before the view is rendered. You can always use css to move the count up from your view's header, if that's what you are looking for. – No Sssweat Jun 18 '15 at 23:58
  • Thanks for reply I have also tried to replicate total rows count div from views header See this – Firoz Sabaliya Jun 19 '15 at 11:02
0

You could use this code to print the count.

<?php

$view = views_get_view( 'test' );
$view->set_display('block');
$view->set_arguments( array( 1, 2, 3 ) );
$view->execute();
$count = count( $view->result );
print $count;

?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.