I'm creating a template for ZOO which is a component for Joomla. I've never had the time to learn OOP and so I'm having trouble accessing (via code) the value within a nested object.
If I run the following code:
PHP Code:
<?php print("<pre>".print_r($elements,true)."</pre>"); ?>
I get a pre-formatted nested for of the $elements array which contains both objects and arrays.
Here is the structure (output):
Code:
Array
(
[description] => ElementTextarea Object
(
[feed] => 0
[jplugins] => 0
[rows] => 20
[cols] => 60
[value] =>
[_table_columns] => Array
(
[_value] => TEXT
)
[name] => description
[type] => textarea
[label] => Description
[description] =>
[default] =>
[display] => 1
[ordering] => 0
[_metaxml] =>
[_type] => Type Object
(
[id] => 6
[name] => Country
[alias] => country
[elements] =>
[params] =>
[table_columns] =>
[_elements] => Array
(
[description] => ElementTextarea Object
(
[feed] => 0
[jplugins] => 0
[rows] => 20
[cols] => 60
[value] =>
[_table_columns] => Array
(
[_value] => TEXT
)
[name] => description
[type] => textarea
[label] => Description
[description] =>
[default] =>
[display] => 1
[ordering] => 0
[_metaxml] =>
[_type] =>
[_item] =>
[_var_types] => Array
(
[_value] => raw
)
[_callbacks] => Array
(
)
[_errors] => Array
(
)
)
[image] => ElementImage Object
(
[directory] =>
[file] =>
[params] =>
[_params] =>
[value] =>
[_table_columns] => Array
(
[_file] => TEXT
[_params] => TEXT
)
[name] => image
[type] => image
[label] => Image
[description] =>
[default] =>
[display] => 1
[ordering] => 1
[_metaxml] =>
[_type] =>
[_item] =>
[_var_types] => Array
(
)
[_callbacks] => Array
(
)
[_errors] => Array
(
)
)
[teaserimage] => ElementImage Object
(
[directory] =>
[file] =>
[params] =>
[_params] =>
[value] =>
[_table_columns] => Array
(
[_file] => TEXT
[_params] => TEXT
)
[name] => teaserimage
[type] => image
[label] => Teaser Image
[description] =>
[default] =>
[display] => 1
[ordering] => 2
[_metaxml] =>
[_type] =>
[_item] =>
[_var_types] => Array
(
)
[_callbacks] => Array
(
)
[_errors] => Array
(
)
)
[boxheading] => ElementText Object
(
[value] =>
[_table_columns] => Array
(
[_value] => VARCHAR(255)
)
[name] => boxheading
[type] => text
[label] => Info Box Heading
[description] =>
[default] => Destination Information
[display] => 1
[ordering] => 3
[_metaxml] =>
[_type] =>
[_item] =>
[_var_types] => Array
(
)
[_callbacks] => Array
(
)
[_errors] => Array
(
)
)
[countryflag] => ElementImage Object
(
[directory] =>
[file] =>
[params] =>
[_params] =>
[value] =>
[_table_columns] => Array
(
[_file] => TEXT
[_params] => TEXT
)
[name] => countryflag
[type] => image
[label] => Country Flag
[description] =>
[default] =>
[display] => 1
[ordering] => 4
[_metaxml] =>
[_type] =>
[_item] =>
[_var_types] => Array
(
)
I'm trying to insert the code within the [boxheading] ElementType Object.
I've tried:
$elements->boxheading
$elements->boxheading->value
$element->boxheading
However, I either get an error or nothing. I know the value is set in the backend and the value should come out as "Destination Information".
How can I access this variable?
|