I'm honestly not sure how to explain this without an example, so I'm going to give an example:
Basically I need to be able to set various javascript-related variables, functions, etc. throughout my code - loading javascript, setting timers, etc. even as far into the page as the footer. Now, heres my problem - I want all the javascript centrally located in the header, like its supposed to be... But how would I pull this off?
I plan on setting these javascript variables and such through a class (In PHP), and the data will be added into an array - I just need to figure out how to empty that array using a function in the same class, before the variables are set (But yet printing those variables).
It is incredibly confusing, so I'll attempt to write an example:
<?php
$js->dump_array();
(General PHP code)
$js->add_var("test", $test);
(More PHP code)
$js->add_var("test2", $test2);
etc.
?>
I'd need test, and test2 to be dumped from the array, before they're even set... I know I could use some mutilated form of ob_start() (Unless I'm misusing it and this was its designed function), but theres got to be a better way.