McCule Wrote:chaosprime Wrote:Right, I'm sure the reason it displays the old value right now is an order-of-operations thing like you describe. It shouldn't take AJAX to resolve it, though. I don't know precisely how much effort it would be without seeing the code involved, but the math of the operations being performed can be run before the display code starts. Probably the difficulty involved is that the operations themselves produce direct output. Conceivably something like this:
<? include('/path/to/general_header.php') ?>
<? include('/path/to/sidebar.php') ?>
<? do_gym_training() ?>
<? include('/path/to/general_footer.php') ?>
The trouble is likely that do_gym_training() does both the math and the output, and it's not trivial to separate them. The reasonably easy, somewhat hackish fix for that is to do this:
<? include('/path/to/general_header.php') ?>
<?
ob_start();
do_gym_training();
$content = ob_get_flush();
?>
<? include('/path/to/sidebar.php') ?>
<?= $content ?>
<? include('/path/to/general_footer.php') ?>
That uses PHP's output buffering to trap do_gym_training()'s output while allowing its math to complete, and then sends the output after the sidebar is produced (with do_gym_training()'s math taken into account).
Yeah, I write a lot of PHP.
Whuh?! You lost me at "<? include('/path/to/general_header.php') ?>" ...and I can't speak a lick of Spanish.
i think that was some form of portugese...