1,CMS调用网站的Url

<a href="{{store direct_url="about-us"}}">About Us</a>

{{store direct_url=””}}” 就是指当前Magento后台里的Base url

也可以用 {{store url=’  ‘}}这个参数调用

2,CMS调用图片路径

<img src="{{skin url='images/logo'}}" />

{{skin url=’  ‘}} 调用的就是默认主题包里的图片路径

转载自Magento架构师的笔记 | 在Magento的CMS中调用图片和url

在代码中调用图片:<span><img src="<?php echo $this->getskinurl('images/F310G.jpg');?>"></span>

3,在magento中我们有的时候需要调用图片。我们可以通过几种方式来调用它们,他可以分成几种情况:
1.是在phtml页面中,也就是模板文件中,

在phtml中调用
    可以使用<?php echo $this->getskinurl('images/图片名') ?>

或者是在xml中,
<reference name="right">
            <block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
            <block type="core/template" name="right.permanent.callout" template="callouts/right_col.phtml">
                <action method="setImgSrc"><src>images/图片名</src></action>
                <action method="setImgAlt" translate="alt" module="catalog"><alt>Keep your eyes open for our special Back to School items and save A LOT!</alt></action>
            </block>
</reference>

这里有设置相应的模板文件,和模板文件出现在的位置,还有就是图片的路径。我们可以通过在模板文件中使用
<?php echo $this->getSkinUrl($this->getImgSrc()) ?>来获得图片的路径。当然这样设置是很麻烦,一般如果直接调用一张图片的话我们直接使用前一种方法就好了,这样直接明了,但有的时候我们需要放置在左右边栏的时候,这样我们一般都是先新建一个模板文件,然后再catalog.xml文件中声明这个块(将上面的内容稍作修改),然后就可以调用到改图片了。

2 在后台设置的cms block中调用图片。我们可以使用如下代码来调用
<img src="{{skin url='images/media/myImage.jpg'}}" />

magento的常用调用的更多相关文章

  1. phpcms v9 常用调用标签(全)

    本文介绍phpcms v9中模板标签使用说明. {template ) {==}   {/,,)}     loop是data的时候用{thumb($v[thumb],,)} 分页标签------{$ ...

  2. magento获取页面url的办法还有magento的常用函数

    <?php echo $this->getStoreUrl('checkout/cart');?> 获取结账页面的url:<?php echo $this->getUrl ...

  3. Magento中,调用静态块的几种方法

    在后台创建一个order_form静态块Block Title :Order FormIdentifier :order_formStatus :EnabledContent :自定义内容 1.如果要 ...

  4. Magento中如何调用SQL语句

    I. 创建表结构和测试数据 create table rooms(id int not null auto_increment, name varchar(100), primary key(id)) ...

  5. android 常用调用系统功能

    1.从google搜索内容 Intent intent = new Intent(); intent.setAction(Intent.ACTION_WEB_SEARCH); intent.putEx ...

  6. lua学习笔记(2)-常用调用

    assert(loadstring("math.max(7,8,9)"))dofile("scripts/xxx.lua")math.floor()math.r ...

  7. compass typography 排版 常用排版方法[Sass和compass学习笔记]

    Bullets 用来定义ul li 相关的样式 no-bullet  关闭 li的默认样式 那个小圆点 no-bullets 作用域ul 调用no-bullet 函数 不过用了reset 后 默认没有 ...

  8. Magento开发常用方法

    这里是我做Magento开发常用到的方法,现在总结出来,后续会把更多有用的方法总结出来. 1.直接操作数据库 查找数据:$read = Mage::getSingleton("core/re ...

  9. 收集Magento FAQ常见问题处理办法

    问题:Magento如何下载? 解答:Magento的英文官方下载地址为:http://www.magentocommerce.com/download 注意:需要注册后才可以下载,而且请下载完整版本 ...

随机推荐

  1. C++反汇编书

    1. <C++反汇编与逆向分析技术揭秘> 2.

  2. [STL][C++]LIST

    参考:http://blog.csdn.net/whz_zb/article/details/6831817 list是双向循环链表,,每一个元素都知道前面一个元素和后面一个元素.在STL中,list ...

  3. 2018年全国多校算法寒假训练营练习比赛(第一场)E 恋与程序员

    https://www.nowcoder.com/acm/contest/67/E 思路: dfs 代码: #include<bits/stdc++.h> using namespace ...

  4. Codeforces 913C - Party Lemonade

    913C - Party Lemonade 思路:对于第i个话费cost[i],取min(cost[i],2*cost[i-1]),从前往后更新,这样就可以保证第n个的话费的性价比最高,那么从最高位开 ...

  5. robot切换窗口

    在用robot做自动化测试的时候,经常遇到新开窗口,需要切换窗口的情况. 两种方式来解决: (1)用robot的关键字来解决 实现窗口切换的功能 @{handlelist} List Windows ...

  6. English trip -- VC(情景课)9 B Outside chores 室外家务

    Vocabulary focus 核心词汇 cutting the grass 修剪草坪 getting the mail  收到邮件 taking out the trash  把垃圾带出去 wal ...

  7. Mac安装软件时 提示已损坏的解决方法

    进入终端: sudo spctl --master-disable

  8. python-day16--内置函数

    内置函数操作 #!usr/bin/env python # -*- coding:utf-8 -*- # 1.locals()和globals() # def func(): # x=1 # y=2 ...

  9. M爷的线段树

    M爷的线段树 - BUCTOJ 3305 一个长度为n的数列A.修改m次,每次给区间[L,R]中的每一个数加X.查询k次,每次查询第i个元素的值并输出.1<=n<=1e5 ,1<=m ...

  10. Pandas DataFrame 数据选取和过滤

    This would allow chaining operations like: pd.read_csv('imdb.txt') .sort(columns='year') .filter(lam ...