Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Predefined var $component in Component
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';
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';
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';
?>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.
There is no purpose, it is the variables in the scope of the function that evals the component.
See get_component();
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix

Users browsing this thread: 1 Guest(s)