下面是一些CMS的应用实例:
本文已移到 http://www.iifire.com
e.1-magento 页面中加入CMS static block
在magento的模版中有些内容想通过后台来控制,那么你可以将这些html css js 放在CMS的static blocks中,然后用下面的代码来在前台输出
写到phtml文件里的的PHP代码如下:
<?php
echo $this->getLayout()->createBlock('cms/block')->setBlockId('your_block_Identifier')->toHtml()
?>
其中setBlockId('your_block_Identifier')的参数your_block_Identifier
,为你在后台创建static block时填的Identifier值,如下图:
提示:这个例子是我直接从其他地方复制过来的,且是正确的;上图跟Magento的版本有关系。
当然,你可以在static block 中的内容中加入一些(CMS->Manage Pages下的)一些pages.
e2.Static Block中嵌入Manage Pages下的pages
<ul>
<li><a href="{{store url=""}}about-magento-demo-store">About Us</a></li>
<li><a href="{{store url=""}}terms-of-use">Terms of Use</a></li>
<li><a href="{{store url=""}}privacy-policy">Privacy Policy</a></li>
<li class="last"><a href="{{store url=""}}customer-service">Customer Service</a></li>
<li><a href="{{store url=""}}new-cms-page">New-CMS-Page</a></li>
</ul>
大家注意到没,红色字体的内容对应着对应的page的[SEF URL]Identifier
e3.Manage Pages下的Pages中嵌入Static Block(page和static block可以相互嵌套)
在任何一个page中加入下面的代码:
{{block type="cms/block" block_id="foo-block"}}
e4.Static Block或Pages中嵌入Template(*.phtml)
在任意static block或pages中加入下面代码:
{{block type="core/template" template="path-to-template.phtml"}}
e5.Tempate中嵌套Template
<?php
$this->getLayout()->createBlock('Mage_Adminhtml_Block_Template', 'block-name')->setData('template', 'path-to-your-file.phtml')->toHtml();
?>
e6.自定义CMS page的Layout
当然page的Layout(上图的*的部分)是可以自定义的,自己特色的Magento shop,下面介绍具体步骤。
添加: app/code/local/MyCompany/AdditionalCmsPageLayouts/etc/config.xml
<?xml version="1.0"?>
<config>
<global>
<cms>
<layouts>
<custom_static_page_one>
<label>Custom static page 1</label>
<template>page/custom-static-page-1.phtml</template>
</custom_static_page_one>
</layouts>
</cms>
</global>
</config>
再添加active该extension的: app/etc/modules/Inchoo_AdditionalCmsPageLayouts.xml
<?xml version="1.0"?>
<config>
<modules>
<Inchoo_AdditionalCmsPageLayouts>
<codePool>local</codePool>
<active>true</active>
</Inchoo_AdditionalCmsPageLayouts>
</modules>
</config>
Add your page/custom-static-page-1.phtml template file (or copy some default one for start) and you’re done . There is also tutorial about this on Magento Wiki. However i don’t like approach of duplicating and overriding Mage files from /local, if it can be avoided, so i decided to write this small and useful example of adding or overriding default Magento settings through separated config files. And yes, Magento values can be overridden this way. Default layouts config can be found in app/code/core/Mage/Cms/etc/config.xml along with used xml code structure, so check it out.
提示:该例子我没做验证,别人发现有错误(版本问题)
总结:Magento的CMS功能在新的版本中不断增强,Magento1.4.1.0的CMS差不多做到了极致(简易性).当然我们需要CMS为我们做更多的事情,所以Magento更其他的CMS系统进行整合变得相当必要,Magento+Drupal可以想象,这个组合将无所不能。
分享到:
相关推荐
Block items can include any content that Magento CMS can involve Powerful block view scheduler Per-category and per-store view aheadWorks Market Segmentation Suite extension integration Enabling/...
magento用户使用手册
Magento,Magento移动应用开发,(英文版和中文版),作者:Darko Goles,ISBN 978-1-84969-366-0
Webpay-支付-Magento-模块Magento CMS 的 WebPay 支付模块标签: magento 支付模块, webpay 支付, webpay magento 至少需要:Magento 社区测试到:Magento 社区 1.9.1.0 稳定标签:1.0.0 许可证:GNU 通用公共许可证...
magento 二次开发模块实例(代码) 复制到工程即可使用
hellowired magento 模板,magento 1.7 使用. 外贸站模板。
Magento实例讲解
Lesti_Version Magento CMS 的版本控制
home-appliances magento 模板,magento 1.7 使用. 外贸站模板。
这是一个关于matento在代码中调用cms块得说明
在分类页面中使用静态区块(Using static blocks with categories).........................26 属性(Attributes)..............................................................................................
NULL 博文链接:https://justcoding.iteye.com/blog/1725217
CMS横幅Magento扩展如果您需要在横幅页面上添加横幅,例如关于我们或Magento商店中的主页,则方便且易于使用。特征在CMS编辑表单上,将图片上传器添加到Magento后端在后端上传的图像可以在前端int的相应页面中查看...
magento数据结构分析 magento数据字典
VueFrontCMS Connect App for Magento 显示你的 :... CMS Connect App-通过GraphQL API在Magento CMS和VueFront Web App之间添加连接。它有什么作用? 这是一个Magento模块,可通过GraphQL API将Magento CMS与VueFront
magento 使用手册,介绍magento使用的手册,是magento从业人员的最好教程
magento中block应用 magento中block应用 magento中block应用
Magento是一款新的、专业的、开放源代码的电子商务解决方案,它提供前所未有的灵活性和可控制性。有了Magento,在你开展电子商务业务的时候就不会觉得很困难了。Magento 的特色1 容易整合Magento 让整合第三方厂商...
magik shoes magento 模板, magento 1.7 模板