Class includes works via AJAX, not regular page?
Posted: Sat Mar 01, 2008 10:11 am
My PHP class file (where obviously all my classes for PHP are set) seems to allow me to use classes in pages called via AJAX just fine. However when I included the class file on my news page locally PHP suffered a heart attack and dropped dead just when the party was getting good!
Maybe I shouldn't have reverse-spiked the punch. 
The issue on the news page (half way through the content) is that it didn't like the first line of the second snippet of code below. So I tried to encase it with headers_sent...
It didn't revive the news page...it was more like after everyone has been staring at the victim for two minutes and a moose enters and just sits on the victim (which would be my news page).
I'd like to not have to create two PHP class files because it's obvious it would be a total pain to maintain two files when I added more classes though I'm not sure what I can do in this situation?
* EDIT *
I should note that the PHP class is not working for some reason.
Here is a quick run down of what my class file looks like with the audio class...
The issue on the news page (half way through the content) is that it didn't like the first line of the second snippet of code below. So I tried to encase it with headers_sent...
Code: Select all
if (!headers_sent()) {
//class settings {//stuff here}
}I'd like to not have to create two PHP class files because it's obvious it would be a total pain to maintain two files when I added more classes though I'm not sure what I can do in this situation?
* EDIT *
I should note that the PHP class is not working for some reason.
Here is a quick run down of what my class file looks like with the audio class...
Code: Select all
class settings {//stuff here}
if ($_GET['audio'] == "0") {$trueaudio = 0; if (!headers_sent()) {setcookie('audio','0',time()+2592000,'/');}}
else if ($_GET['audio'] == "1") {$trueaudio = 1; if (!headers_sent()) {setcookie('audio','1',time()+2592000,'/');}}
else if ($_GET['audio'] == "2") {$trueaudio = 2; if (!headers_sent()) {setcookie('audio','2',time()+2592000,'/');}}
else if ($_COOKIE['audio'] == "0") {$trueaudio = 0;}
else if ($_COOKIE['audio'] == "1") {$trueaudio = 1;}
else if ($_COOKIE['audio'] == "2") {$trueaudio = 2;}
else {$trueaudio = 0;}
$settings = new settings();
$settings->set('audio',$trueaudio);