4

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

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.

5
  • 1
    Thank 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
    Commented 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
    Commented 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
    Commented 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
    Commented Dec 29, 2015 at 21:40
  • 2
    Great 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
    Commented Dec 29, 2015 at 21:48
4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.