I've made a custom view and display for it like this: enter image description here

How do I get the Views Header (Global Summary here) ? I'm able to get the Views title like this:

$views = Views::getView('items_list','page_2');
$view_results = $views->result;
print_r( $views->getTitle());exit;

Hope someone could help me out.

  • I think that you can use $view->getHandler('display_id', 'footer', 'footer_id'); and the same for the header just 'header' instead. – user72672 Aug 31 '19 at 15:41
  • Please clarify what you want to do. Normally you would get the header and footer in the views template: {{ header }} and {{ footer }}. – 4k4 Aug 31 '19 at 16:29

Step1 - You will create two files header.php and footer.php. Step2 - Create a folder "include" in your theme directory. Step3 - Suppose that your theme directory is "abc" sites/all/themes/abc. Put header.php and footer.php file in "sites/all/themes/abc/include" theme folder. Step3 - By using html and php you can write code in header.php and footer.php. Step4 - Now you can include both files in page.tpl.php in header area and footer area like PHP.


hope this will help

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.