Producing Takeovers can be done simply and easily in the pagelayout of your ez publish site. The $module_result gives you all information you may need. By using the parameters in it you can target individual pages of your site or whole branches and add extra stylesheets and javascript into these pages.
To produce a takeover on a single page:
These are best setup using the variable {$module_result.node_id}. It is possible to use {$module_result.uri} but the uri will change based on whether the user is accessing the site through a specific site access. For instance, if my primary site access is called ‘eng’, I can access the page “Info” through the uris http://www.onequarterenglish.co.uk/Info and http://www.onequarterenglish.co.uk/eng/Info. In either case these uris will be different in the module result.
By using the node_id in a simple if statement I can use a custom stylesheet on my homepage and it will not be used elsewhere on the site (I’m creating mine on the homepage):
<link rel="stylesheet" href={"stylesheets/takeover.css"|ezdesign()} type="text/css"
media="screen" />
{/if}
This can be easily extended to automate start and end dates into the code using an extra if statement:
{def $takeover_start=makedate( 3, 27, 2010)}
{def $takeover_end=makedate( 3, 29, 2010)}
{if and(gt($now, $takeover_start),lt($now, $takeover_end))}
{if eq($module_result.node_id,2)}
<link rel="stylesheet" href={"stylesheets/takeover.css"|ezdesign()} type="text/css"
media="screen" />
{/if}
{/if}
{undef $now,takeover_start,takeover_end}
To produce a takeover on a subtree:
To setup one over a subtree, look in {$module_result.path}. You can base this at any level of your site. {$module_result.path[0]} will be the home folder of content and so if you want to set all of a tree from a first level object (for example news under the home folder), look at {$module_result.path[1]}.
You can base the if statement on two elements within the path, either the {$module_result.path[1].node_id} or {$module_result.path[1].text}. I would recommend using node_id again as this is the only of the two guaranteed to be unique. Updating the code from above, you can set up a takeover on a branch using the following code:
{def $takeover_start=makedate( 3, 27, 2010)}
{def $takeover_end=makedate( 3, 29, 2010)}
{if and(gt($now, $takeover_start),lt($now, $takeover_end))}
{if eq($module_result.path[1].node_id, 81)}
<link rel="stylesheet" href={"stylesheets/takeover.css"|ezdesign()} type="text/css"
media="screen" />
{/if}
{/if}
{undef $now,takeover_start,takeover_end}
