I'd like to get a list of all objects that have been created so far on a page. I'm looking for a function similar to get_defined_vars, but I can't find one.
I'm working in a template file (joomla) and I'd like to know what variables have already been set on the page. I thought that get_defined_vars would help me, but it only lists variables that exist outside of objects. So, I need to first get a list of all the objects in the page, then use get_object_vars().
Thanks,
Julie
List All Objects Created on a Page
Moderator: General Moderators
-
Mark Baker
- Forum Regular
- Posts: 710
- Joined: Thu Oct 30, 2008 6:24 pm
Re: List All Objects Created on a Page
get_declared_classes() to get a list of all class definitions used
Or something like:
(Not tested)
Or something like:
Code: Select all
$classes = array();
foreach(get_defined_vars() as $varName) {
if (gettype($varName) == 'object') {
$classes[] = get_class($$varName);
}
}
Re: List All Objects Created on a Page
at template level is only JDocumentHTML Object.buckeye07 wrote:I'm working in a template file (joomla) and I'd like to know what variables have already been set on the page.
Julie
i don't think you can get other objects, they are out of scope, they would have been rendered and stored in its output buffer, waiting to be dispensed out soon after the template.
you can try print_r($this); or var_dump($this); in your template index.php.
there may be some things useful there you can play with perhaps.
another one is var_dump($mainframe);