문제

In my magento 1.8 project, I have some URL's which are calling some other sites like blogs, youtube videos etc. I want these URL's to keep in admin so that the client/store owner can change them later if needed to.

Where should I keep these URL's such that the client can change them easily? and how to call them in my magento footer template?

도움이 되었습니까?

해결책 2

I created a CMS Static Block and added content as just URL and called the same static block in my phtml template using the following code:

<a href="<?php echo strip_tags($this->getLayout()->createBlock('cms/block')->setBlockId('blog_link')->toHtml()); ?>">Blog</a>

Now the user just need to change the content in that Static block to change the URL.

I hope this is the best way to tackle this issue..

다른 팁

I suggest you use custom variables for this.

They can be found under System > Custom Variable. You can enter plain text values and HTML values there. The HTML value is optional, plain text must be entered.

The variables can be inserted on CMS Pages via the WYSIWYG Editor ("Insert Variable") or via this code directrly: {{customVar code=blog_link}}.

If you need to include the variables' output in a .phtml file, use this code:

Mage::getModel('core/variable')->loadByCode(blog_link')->getValue('plain');
Mage::getModel('core/variable')->loadByCode(blog_link')->getValue('html');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top