Since reading this article, I've been thinking alot about the configuration
issues. Here's a small snippet I am working on. Basically, it makes usage of
a string based input parameter, such as:
$config->descend('database/connections/read/');
Following this, it saves the data into the registry and operates through
that. Really, I haven't seen much of a problem in my zend_config
performance, but maybe someone else will appreciate this as well:
class Zfp_Config extends Zend_Config
/**
* Descend a configuration path
*
* @param string $configNode
* @return Zend_Config|bool
*/
public function descend($configNode,$toArray=false)
{
$desc = $this->getNodeRegistry ( $configNode );
if ($desc instanceof Zend_Config) {
return ($toArray === true) ? $desc->toArray () : $desc;
}
$pathArr = explode ( '/', $configNode );
$desc = $this;
foreach ( $pathArr as $nodeName ) {
$desc = $desc->$nodeName;
if (! $desc) {
return false;
}
}
$this->saveNodeRegistry ( $configNode, $desc );
return ($toArray === true) ? $desc->toArray () : $desc;
}
public function getNodeRegistry($key, $default) {
$key = '_core/configdata/' . $key;
return Zfp::registry ( $key, $default);
}
public function saveNodeRegistry($key, $value) {
$key = '_core/configdata/' . $key;
Zfp::register ( $key, $value );
}
}
I use it through a global class, called Zfp. So, I make my calls this way,
for example:
Zend_Layout::startMvc(array(
'layout' => Zfp::getConfig('modules/'.$moduleName.'/design/layout/active')
));
I wonder if using the registry ( an ArrayObject ) actually benefits versus
the array_key_exists. Anyway, cheers!
Sander van de Graaf wrote:
>
> Hi all,
>
> Just wanted to point you to a blog post about some optimizations I
> found for a ZF project we're finishing up. It might be of interest to
> some of you:
>
> http://www.svdgraaf.nl/2008/11/07/optimizing-your-zf-web-application/
>
> If you have any comments, please let me know.
>
> cheers,
> Sander
>
>
--
View this message in context:
http://www.nabble.com/ZF-application-optimizations-%28and-speedup%29-tp20372657p20414932.html
Sent from the Zend Framework mailing list archive at Nabble.com.