TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 219
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 158
  • Total: 158

Phpbox and globals

Started by butch2k, July 04, 2007, 03:05:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

butch2k

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:

jacortina

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?

butch2k

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.

butch2k

So that you could have a better idea of what i'm working on...

butch2k

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  ;)

This website is proudly hosted on Crocweb Cloud Website Hosting.