Forum Moderators: coopster
IF ($detail_page==1) echo <<<END
<script>
this is some script code
</script>
END;
Now in the detail pages you add a line
$detail_page=1;
before the line that includes the header. It's a one time operation, and the next time you want to modify the javascript you can just change it in the header.
So what does this do? If the header is being included in e.g. a welcome page, the javascript won't be shown. If it's being included in a detail page, the javascript will be shown.
Well in that case its quite simple.
Save your javascript into a file that has a JS extension.
Then in the files you DO want the javascript, put this code.
<?
include("myFilename.JS");
?>
Now, this can be used in any number of ways, for instance, if you where using form or URL variables
across pages, you could create a function that checks
to see if a certain variable is present and then the function woould include the Javascript or not depending on said variable.
cheers