Little tip when you need to load your own yaml file
By eNk` on Sunday, May 9 2010, 16:25 - Symfony - Permalink
So this is just a little tip when you need to load your own yaml file.
To load a yaml file you can use sfYamlConfigHandler::parseYaml() ( or sfYaml::load() ). And just after you can also use sfYamlConfigHandler::replaceConstants() to replace constant(s) from Symfony such as %SF_LIB_DIR% (or any other value defined in a yaml config file) in the values you've just loaded from your custom yaml file.
A little exemple:
# config/my_config.yml dirs: lib: %SF_LIB_DIR%/my_lib custom: %SUPER_PATH%/is/here
sfConfig::set('super_path', '/the/super/path');
$configuration = sfYamlConfigHandler::parseYaml(sfConfig::get('sf_config_dir').'/my_config.yml');
$configuration = sfYamlConfigHandler::replaceConstants($configuration);
var_dump($configuration);
/*
array(1) {
["dirs"]=>
array(2) {
["lib"]=>
string(53) "/Users/cedric/Dev/workspace/my_sf_project/lib/my_lib"
["custom"]=>
string(23) "/the/super/path/is/here"
}
}
*/
Comments
<A href="http://www.toptoys2trade.com/zhu-zh... ">zhu zhu pets</A>
<a href="http://www.toptoys2trade.com/a-sill... "> silly bandz</a>
<A href="http://www.toptoys2trade.com/power-... "> power balance</A>
<A href="http://www.toptoys2trade.com/animal... ">animal rubber bands</A>
<A href="http://www.toptoys2trade.com/baby-c... ">Baby Carriers</A>
<A href="http://www.toptoys2trade.com/pillow... ">Pillow Pets</A>
<A href="http://www.toptoys2trade.com/plush-... ">Plush Pencil Case</A>
<A href="http://www.golf-equipment2u.com ">golf equipments</A>
[url=http://www.b2chandbag.com/guess-han... ]guess handbags[/url]
[url=http://www.b2chandbag.com/d&g-h... ]d&g handbags[/url]
[url=http://www.b2chandbag.com/ ]prada handbags[/url]
[url=http://www.topcasualshoes.com/ ]ecco shoes[/url]