TinyPortal
Development => Support => Topic started by: butch2k on July 04, 2007, 03:05:47 PM
I'm having some troubles with my phpbox and the globals, or actually the way globals are evaluated within phpboxes.
Let's consider two blocs B1 and B2, with B1 on top of B2.
If i declare a global $G1 in bloc B1 it's visible to both blocs, but if i declare a global $G2 in bloc B2 its value is not visible in bloc B1. :o
Is there a way around this restriction ?
Or am i missing something ? :idiot2: :uglystupid2:
Because its value isn't set until B2 is actually evaluated.
Things happen sequentuially, not simultaneously. B1 is evaluated and the 'results' echo'd out before B2 is even looked at.
The only way I can think of 'around' this is to supply these values in some prior process or higher level (like in the TPortalBlocks.php itself).
What are you trying to accomplish here?
It's for a RPG mod i'm working on.
The first block contains links to RPGProfilerSheets (an RPG sheets manager which i integrated within SMF), as well as a summary of a few vital stats for each characters like Hitpoints. Gamemasters also have access to a select which change the content of the bottom block.
The bottom block display a detailled view of the currently selected character (if a Game Master) or your own character (if a player). If you are a gamemaster you also have editable fields for the Hitpoints and Experience points.
The submit button of the bottom block works fine updating the character's sheet, but the top block content is not refreshed until i select a character in the select field of that block. I thought the blocks would have been refreshed by the submit in the second block but it isn't for reason unknown.
So that you could have a better idea of what i'm working on...
Ok i managed to do it...
I mode the onsubmit code of the second block to the first one so as to respect the sequential order of blocks evaluation.
Thanks a lot ;)