Blocks in the header for certain pages only

Permalink
I have a block in the header that I need for certain pages only.

<?php  
   $a = new GlobalArea('Header Nav');
   $a->setBlockLimit(1);
   $a->display($c);
?>


What is the best way to go about this?

Right now I have a header.php file that I am including with all pages for this block.

 
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
Some solutions that come to mind. All require a little bit of coding of the page type:

- Don't use a global area and have a different set of page defaults for with/without the header

- A different page type for with/without the header

- A page type that renders the area according to a page attribute setting

- Some css to hide it attached to the pages you don't want it.

- Some jQuery to remove or hide it attached to the pages you don't want it.

There are no doubt more variations that others will contribute. Which you use all depends on the amount of coding you are happy to do and the exact circumstances and balance of show/hide.
nicolechung replied on at Permalink Reply
I went with the first, because it was the simplest, but I think the page attribute way would be useful.