I need to have a page heading in a design that i can hide on some pages. Can this be done without having an alternate design?
You don't need a different design, but you will need a different design customisation. You can do this using a Declared Vars Design Area.
I can't find any info about a declared vars design area in the design manual. Can you give me a quick idea of how i should use it?
Page 69 of the design manual. Something like this should do the trick:
then customise/print as appropriate.
<MySource_AREA id_name="headings" design_area="declared_vars" print="yes">
<MySource_DECLARE name="main_heading" value="<h1>%asset_name%</h1>" type="text" description="Heading used for foo" />
</MySource_AREA>
I tried this and nothing gets printed at all. Is there a problem with using %asset_name% in the value or something?
Ahh, that's not going to work. First of all, in a parse file, you would need to use:
rather than %asset_name%, but I doubt this will work inside the value of a declared var. What you may need to do is:
.hideme { display: none; }
<MySource_AREA id_name="headings" design_area="declared_vars" print="yes">
<MySource_DECLARE name="main_heading" value="hideme" type="text" description="Heading used for foo" />
</MySource_AREA>
<h1 class="<MySource_PRINT id_name="headings" var="main_heading" />"><mysource_print id_name="__global__" var="asset_name" /></h1></pre>
Ok, I've done that, and it prints out class="hideme" in the H1 by default, which is what I want. I have a customisation of the design which is set to print=no for the headings design area, but the class="hideme" is still being printed, which is not correct.
There is a simpler way, and one that doesn't require CSS hiding. Just create a design area that contains your H1. It doesn't really matter which one, but I'd use a menu_normal:
Then, you can just flip the print=yes or print=no on a customisation. Notice that I don't actually use any <mysource_asset> tags, because I don't really want to print any menu stuff. I'm just using it as a wrapper.
Thanks Avi, that worked.
No worries. :)