|
|||
|
Hi,
I can't get the Zend_Registry to work as an object instead of an array. I use the following code in the bootstrap file: PHP Code:
PHP Code:
Quote:
Thanks in advance for any response. Kind regards |
|
|||
|
It sucks, but you can only use 1-dimensional array:
Code:
echo $registry->system['name']; echo '<br />'; echo $registry->system['time']['zone']; You can also do this: Code:
# Load everything from config.ini.
$config = new Zend_Config_Ini('config.ini', null);
# Create a new Zend_Registry not from, but with the config.
$registry = new Zend_Registry(array('config' => $config), ArrayObject::ARRAY_AS_PROPS);
# Unset the static instance.
Zend_Registry::_unsetInstance();
# Set the static instance.
Zend_Registry::setInstance($registry);
# Test.
$registry = Zend_Registry::getInstance();
echo $registry->config->system->name;
echo '<br />';
echo $registry->config->system->time->zone;
Last edited by borec : 08-14-2007 at 09:55 AM. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|