Hello dear SPIP Community.
I’m working on a project where certain information is defined in PHP’s the $GLOBALS variable at runtime.
It’s possible to create custom criteria for boucles, in « mes_fonctions.php » file.
However, even through the page I am opening in the browser is defining the $GLOBALS[‹ list_challenges ›] variable before the criteria is called in the boucle, the variable is empty inside the criteria.
Is it possible to work with GLOBALS inside criteria functions?
Example:
<BOUCLE_mission(MISSIONS){missions_completed}>
#ID_MISSION
</BOUCLE_mission>
The criteria is defined as such:
function critere_mission_completed($idb, &$boucles, $crit) {
$boucle = &$boucles[$idb];
$list_challenges = $GLOBALS[‹ list_challenges ›];
$boucle->where[] = array("‹ id_mission IN ($list_challenges) ›");
}
Expected: $list_challenges contains the global variable defied earlier.
Actual: $list_challenges is empty, as global variable is not defined for some reason.
Cheers,
Urs