I see you are using ob_end_clean() - that clears the Output buffers and turns off output buffering. I am not sure, but that might mean that your include 'all.php'; will not be used at all.
Try removing that line - ob_end_clean(); - and then at the very end of your code on that page, have ob_end_flush();
The OB functions are for Output Buffering - ob_start() holds all php output in the buffer until it receives the ob_end_flush() command. Then is sends all the output to the browser and clears the buffer. ob_end_clean() just clears the buffers without sending the contents to the browser.
RoryGren
Junior Poster in Training
60 posts since Oct 2007
Reputation Points: 12
Solved Threads: 8
try using a different content type like text/javascript.
and capitalizing the php start tag does nothing.
kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
ok, sorry. i saw the capitalized PHP in red and thought you meant to capitalize it. i didn't see s/he didn't use the full start tag in the original post.
kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
this is a short script file in php that works
file:: script.js.php
<?php header ('content-type: text/javascript');
ob_start("ob_gzhandler"); ?>
function newuntill(date) {
var newimg = "./images/new.gif";
var expdate = new Date(date);
var curdate = new Date();
if (expdate.getTime() > curdate.getTime()) {
document.write('<img align="left" src=' + newimg + '>');
}
else {
document.write('');
}
}
function movein(which,html) {
which.style.background='turquoise'
window.status=html
}
function moveout(which) {
which.style.background='#d4d0c8'
window.status=''
}
<?php ob_flush(); ?>
header ('content-type: application-x, .........
looks for an external handler,
javascript is supposed to run in the browser
gzhandler, compresses the files before sending
almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
""
that's not the right way to do it.. the code above does not call an external javascript
it2051229
Junior Poster in Training
82 posts since May 2007
Reputation Points: 7
Solved Threads: 1
""
that's not the right way to do it.. the code above does not call an external javascript
Dont believe it
this is a php script that monitors page access for sites that arent given access to server logs,
internally it is javascript
php is a flexible language,
's why the header is able to send anycontent-type information
is also valid
depending on circumstance
almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376