Question

Is there any way to nest config path variables in static blocks? I'm trying to access the logo image and figured that the best way to do so would be something like {{skin url='{{config path="design/header/logo_src"}}'}}, but doestn't seem to work. Should I hard code the skin path or is there any other way to do this? Thanks!

Was it helpful?

Solution

Unfortunately the directive parser does not know how to parse directives inside directives.

so {{skin url='{{config path="design/header/logo_src"}}'}} will not be parsed.
But you can create your own directive parser and be able to use something like this:

{{skinconfig path="design/header/logo_src"}}

For that you will need to rewrite the Mage_Widget_Model_Template_Filter model.
Here is a nice explanation on how to do that..

And you need to add in your new class a method like this (untested code):

public function skinconfigDirective($construction) {
    $configValue = '';
    $params = $this->_getIncludeParameters($construction[2]);
    $storeId = $this->getStoreId();
    if (isset($params['path'])) {
        $configValue = Mage::getStoreConfig($params['path'], $storeId);
        return Mage::getDesign()->getSkinUrl($configValue);
    }
    //in case there is no path specified return nothing.
    return '';
}

OTHER TIPS

This thread is old, but I was looking to do a similar thing today.

Not sure that this is the best solution, but you can also do this

<img src="{{skin url=''}}{{config path='design/header/logo_src'}}">.

Note that you may need to whitelist these variables/blocks as a result of the changes introduced in SUPEE-6788 / Magento CE 1.9.2.2 / Magento EE 1.14.2.2

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top