For example, you can create a new metadata field, named, say "special_js". This is done in Project Properties.
Then go to page properties of the said page, and make the value of that metadata, to, '1'.
Then after this it's some php coding. I can do this for you as an example if you let me. Basically in the layout editor/head section, you add some php code to check whether the metadata is set, and if it is, output the javascript.
Here's one example: <? if (!empty($page["meta"]["title"])) { echo $page["meta"]["title"]; } ?>
Adding Javascript to the section of a page
I was wondering if there is a way to modify the <head> section of an individual page in order to add javascript code to that page.
27 posts 1 year, 9 months agoedited
Yes there is always a way :-)
For example, you can create a new metadata field, named, say "special_js". This is done in Project Properties.
Then go to page properties of the said page, and make the value of that metadata, to, '1'.
Then after this it's some php coding. I can do this for you as an example if you let me. Basically in the layout editor/head section, you add some php code to check whether the metadata is set, and if it is, output the javascript.
Here's one example:
<?
if (!empty($page["meta"]["title"]))
{
echo $page["meta"]["title"];
}
?>
Here's another:
<?
if (!empty($page["meta"]["special_js"]))
{
?><script type="text/javascript"> alert('Got here'); </script><?
}
?>