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.

Gerard de Visser
9551 gold badge10 silver badges27 bronze badges
asked Jul 11, 2014 at 16:48

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.

answered Jul 11, 2014 at 19:49
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! 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! 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'}}"> 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? 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." 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.

Amit Bera
77.8k21 gold badges127 silver badges240 bronze badges
answered May 3, 2016 at 14:08

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.