my js files are included through header. i dont want to have some .js files included in certain pages, while that particular page is loading. is it is possible.??? help me please.....
+2
A:
<?php
if (! some_condition() ) {
?>
<script …></script>
<?php
}
?>
David Dorward
2010-04-06 09:56:40
A:
What specifically is the page? Can you just re-write the header on the one page? Or, if you use a header function, just rewrite the function like:
<?php
echo "<html>";
echo "<head>";
if (use a regexp to extract the page URL ) {
echo "<script> .... </script>
}
echo "</head>";
.........
dscher
2010-04-06 12:43:30
A:
You could use an array of files to include.
In your main file:
$jsFiles=array('jquery.js','mylib.js','test.js');
In your header file:
foreach($jsFiles as $jsFile){
print("<script type='text/javascript' src='$jsFile'></script>");
}
Code is not tested but that should give you the idea.
zaf
2010-04-06 13:33:14
A:
<?php
if($_SERVER['PHP_SELF'] == 'page.php'){
?><script ...></script>
<?php } ?>
bradenkeith
2010-04-06 15:12:29