Predefined var $component in Component - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16) +--- Thread: Predefined var $component in Component (/showthread.php?tid=10420) |
Predefined var $component in Component - vanfruniken - 2018-03-12 Experimenting a little bit with get_defined_vars() inside a component, I discovered the existence of the following predefined vars: $id, $arguments, $args, $component, $saved_args. The component seems to contain some of the source code from the component itself, usually html But as soon as there appears a closing angle bracket ('>') in php code, the component seems to contain source code FOLLOWING that angle bracker. with the component definition V<?php $a = 'A'; // xyz echo 'The predefined variable $component = '.json_encode($component); $D ='d'; ?>W we get VThe predefined variable $component = "VW"W but with a '>' in front of the xyz V<?php $a = 'A'; // >xyz echo 'The predefined variable $component = '.json_encode($component); $D ='d'; ?>W results in VThe predefined variable $component = "Vxyz\necho 'The predefined variable $component = '.json_encode($component);\n$D ='d';\n?>W"W whereas a '>' inside the string in echo V<?php $a = 'A'; // xyz echo 'The predefined> variable $component = '.json_encode($component); $D ='d'; yields ?>WVThe predefined> variable $component = "V variable $component = '.json_encode($component);\n$D ='d';\n?>W"W Weird. What, if any, is the purpose of this predefined variable $component? Probably unimportant or way beyond my level of comprehension. RE: Predefined var $component in Component - shawn_a - 2018-03-12 There is no purpose, it is the variables in the scope of the function that evals the component. See get_component(); RE: Predefined var $component in Component - vanfruniken - 2018-03-12 Thanks. |