News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rob Allen's Blog:
Zend_Config_Ini and a string
June 21, 2011 @ 12:30:50

In a new post today Rob Allen shows a method you can drop into your Zend Framework application to allow Zend_Config_Ini to take in a string instead of being restricted to loading a file.

With PHP 5.3 however there is is a new function called parse_ini_string() which will allow us to load arbitrary ini string into Zend_Config objects. This can't go into Zend Framework 1 though due to our PHP 5.2.4 minimum version requirement. As I needed this for a project, I extended Zend_Config_Ini to support this feature, which means simply overloading a single method.

He includes the code for the method - the App_Config_Ini class that includes a _parseIniFile method that checks to see if the last four characters of the input value are ".ini". If so, it loads like normal. If not, it assumes it's a configuration string and parses it with the new parse_ini_string method.

0 comments voice your opinion now!
zendframework configuration ini string parseinistring


blog comments powered by Disqus

Similar Posts

Chris Hartjes' Blog: Testing Web Services in Zend Framework 1.x

Rob Allen's Blog: Updated tutorial for Zend Framework 2 beta 1

ProDevTips.com: Zend Amf and class mapping with Flash CS3 / AS3

Reddit.com: How do you manage many PHP projects? Lots of VMs?

ServerGrove Blog: Configuring Symfony to use Zend Framework 1.8.0 new Autoloader


Community Events





Don't see your event here?
Let us know!


release tool symfony framework install package composer opinion podcast language interview introduction update laravel series library voicesoftheelephpant security community version

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework