Only include javascript if used by an editable view?

Author Message

Douglas Hammond

Thursday 29 May 2003 7:32:20 pm

sorry i hope i describe this ok.

I am makeing my own edit date view( i guess you call it that) that uses a date popup picker and need to include a javascript in the <head> of the document, plus for each date field add a piece of javascript in a function that gets called by the body onload.

I can hard code it ito the head but i prefer the head section to only be added if the date control is used.

plus to add the code for each date field into a function that get called by the <body onload="initFunc">

any ideas?

is {include} an option? or how using the templates can i add code to another template section?

Paul Forsyth

Friday 30 May 2003 12:28:16 am

you could use something like the following code:

{section show=is_set($use_date_control)}
{include uri="design:page_body.tpl"}
{section-else}
<normal body>
{/section}

where page_body.tpl is located at "design/<you>/templates/page_body.tpl"

other includes could be used to include the javascript required etc.

hope this is what you had in mind ;)

paul

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.