2011-06-20 42 views
1

我试图弄清楚如何使用cms中的布局更新将图像等添加到Magento中左侧边栏页面的2列的左边栏部分 - > page- >管理区域的设计部分。通过更新布局在Magento中添加图像

是否可以从更新布局xml区域执行此操作?如果没有,你能否解释如何创建一个模块(或其他需要的)。

谢谢。

回答

2

如果您在base/default/layout/catalog.xml看,你会看到使用模板,可以在您更新布局XML区域中指定的图像占位符的例子:

<reference name="left"> 
     <block type="core/template" name="left.permanent.callout" template="callouts/left_col.phtml"> 
      <action method="setImgSrc"><src>images/media/col_left_callout.jpg</src></action> 
      <action method="setImgAlt" translate="alt" module="catalog"><alt>Our customer service is available 24/7. Call us at (555) 555-0123.</alt></action> 
      <action method="setLinkUrl"><url>checkout/cart</url></action> 
     </block> 
    </reference> 

所以,在你更新布局XML,你会写类似:

<reference name="left.permanent.callout"> <!-- match this to the block name from above --> 
      <action method="setImgSrc"><src>images/media/my_file_name.jpg</src></action> 
      <action method="setImgAlt" translate="alt" module="catalog"><alt>Some text here</alt></action> 
      <action method="setLinkUrl"><url>your/path</url></action> 
    </reference> 

您可以通过采取模板文件left_col.phtml的副本,并根据需要进行更改适应这一点。