I've tried to find an answer for this, but can't manage to.
I'm trying to access {{config path="design/header/logo_src"}} in a static block in Magento 1.9CE, but all design/header/* values seem to be inaccessible. Is there any way to use them in a static block?
Thanks for all your help.
2 Answers 2
Welcome to Magento.SE!
I am not having the same issue as you are. It seems to be working for me - so I'm wondering how you're referencing your static block; perhaps you're missing something?
Here's my static block:
enter image description here
And a demo test.php file to output it:
<?php
require('app/Mage.php');
Mage::app();
$block = Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('test');
echo $block->toHtml();
And the output I get:
> php test.php
images/logo.gif
Some things to check:
Make sure you're calling toHtml on the static block. If so, make sure that the static block is set to use the correct store view (in multistore mode). Make sure that you're using the right block id.
-
1Thank you very much for your reply. After reading to your response, I realized for whatever reason, there was an extra closing quote mark ('") on all the variables. I might have copied them wrongly or something, but simply reassuring it should work really helped me!Maxi– Maxi2014年07月11日 20:18:23 +00:00Commented Jul 11, 2014 at 20:18
-
Hi philwinkle. Even thought I did manage to get the logo_src variable, I still can't achieve what I was looking for, since it's a skin path. What would the best way to print that image be? I tried nesting config paths, but doesn't seem to work: {{skin url='{{config path="design/header/logo_src"}}'}}. Thanks!Maxi– Maxi2014年07月11日 20:30:47 +00:00Commented Jul 11, 2014 at 20:30
-
This thread is old, but I was trying to do the same thing today. Not sure that this is the best way but this worked for me <img src="{{skin url=''}}{{config path='design/header/logo_src'}}">mpchadwick– mpchadwick2015年12月29日 21:38:41 +00:00Commented Dec 29, 2015 at 21:38
-
1@mpchadwick I wonder how this is impacted by the whitelist of the latest round of SUPEE 6788 changes?philwinkle– philwinkle2015年12月29日 21:40:08 +00:00Commented Dec 29, 2015 at 21:40
-
2Great point. It most certainly is affected by those changes magento.com/security/patches/supee-6788-technical-details "Magento now includes a white list of allowed blocks or directives. If a module or extension uses variables like {{config path="web/unsecure/base_url"}} and {{block type=rss/order_new}} in CMS pages or emails, and the directives are not on this list, you will need to add them with your database installation script."mpchadwick– mpchadwick2015年12月29日 21:48:32 +00:00Commented Dec 29, 2015 at 21:48
Go to Admin->System->Permission->Variables and there add your config path first to access it in static block. Because after SUPEE 6788, there are restrictions to use all config paths.