getChildHtml('cms_blockslideshow')
调用 cms->statice block 里的 blockslideshow 模块
模块是附加在商品分类里的 catalog->mange catagories
<div class="page"> 是 主页模板 1column.phtml
page.xml 的块:
<block type="core/text_list" name="top.menu" as="topMenu" translate="label">
<label>Navigation Bar</label>
</block>
模板:
app\design\frontend\base\default\template\catalog\navigation\top.phtml
-------------------------------------------------------------------------------------------
<?php $_menu = $this->renderCategoriesMenuHtml(0,'level-top') ?>
---------------------------------------------------------------------------------------------
$_menu是渲染后的菜单,写好样式的结果。
-------------------------------------------------------------
<li class="level0 nav-1 level-top first parent" id="">
<a class="level-top" href="http://www.example.com/index.php/furniture.html">
<span>Furniture-test</span>
</a>
<ul class="level0">
<li class="level1 nav-1-1 first" id="">
<a href="http://www.example.com/index.php/furniture/living-room.html">
<span>Living Room</span>
</a>
</li><li class="level1 nav-1-2 last" id="">
<a href="http://www.example.com/index.php/furniture/bedroom.html">
<span>Bedroom</span>
</a>
</li>
</ul>
</li>
--------------------------------------------------------------------------------
调用后台的 catalog->>manage categories 的分类名。
显示:
Furniture
Living Room
Bedroom
Electronics
Cell Phones
Cameras
Accessories
Digital Cameras
Computers
Build Your Own
Laptops
Hard Drives
Monitors
RAM / Memory
Cases
Processors
Peripherals
Apparel
Shirts
Shoes
Mens
Womens
Hoodies
page.xml的块:
<block type="page/template_links" name="top.links" as="topLinks"/>
模板:
app\design\frontend\base\default\template\page\template\links.phtml
显示:
My Account|My Wishlist|My Cart|Checkout|Log In
My Wishlist 是由 app\design\frontend\base\default\template\page\template\linksblock.phtml 控制
page.xml
-------------------------------------------------
<block type="page/html_wrapper" name="top.bar" as="topBar" translate="label">
<label>Breadcrumbs</label>
<action method="setElementClass"><value>top-bar</value></action>
<block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
</block>
-----------------------------------------------------------------------------
topbar 部分包括:breadcrumbs 和 rearch
模板:
app\design\frontend\base\default\template\page\html\breadcrumbs.phtml
显示:
-----------------------------------------
<ul>
<li class="home">
<a title="Go to Home Page" href="http://www.example.com/index.php/">Home</a>
<span>/ </span>
</li>
<li class="category10">
<a title="" href="http://www.example.com/index.php/furniture.html">Furniture-test</a>
<span>/ </span>
</li>
<li class="category22">
<strong>Living Room</strong>
</li>
</ul>
---------------------------------------------------
名字由 后台 catalog->>manage categories 决定
Search 模板
app\design\frontend\base\default\template\catalogsearch\form.mini.pthml
自定义页面 cms->>page
{{block type="core/template" template="sample/home.phtml"}}
默认cms->>home page
page information:
page title : home page
url key: home
content:
<div class="page-title">
<h2>Home Page</h2>
</div>
design:
layout: 2 columns with right bar
layout update XML
--------------------------------------------------------------
<!--<reference name="content">
<block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml" after="cms_page"><action method="addPriceBlockType"><type>bundle</type><block>bundle/catalog_product_price</block><template>bundle/catalog/product/price.phtml</template></action></block>
<block type="reports/product_viewed" name="home.reports.product.viewed" alias="product_viewed" template="reports/home_product_viewed.phtml" after="product_new"><action method="addPriceBlockType"><type>bundle</type><block>bundle/catalog_product_price</block><template>bundle/catalog/product/price.phtml</template></action></block>
<block type="reports/product_compared" name="home.reports.product.compared" template="reports/home_product_compared.phtml" after="product_viewed"><action method="addPriceBlockType"><type>bundle</type><block>bundle/catalog_product_price</block><template>bundle/catalog/product/price.phtml</template></action></block>
</reference><reference name="right">
<action method="unsetChild"><alias>right.reports.product.viewed</alias></action>
<action method="unsetChild"><alias>right.reports.product.compared</alias></action>
</reference>-->
=====================================================================================
-------------------------------------------------------------------------------------------------------------------------
{{block type="catalog/product_list" template="catalog/product/home.phtml" category_id="3"}}
--------------------------------------------------------------------------------------------------------------------------------
<reference name="header">
<block type="cms/block" name="home_page_header_block">
<action method="setBlockId"><block_id>home_page_header_block</block_id></action>
</block>
</reference>
<reference name="head">
<action method="addItem"><type>skin_css</type><name>css/slider.css</name><params/></action>
<action method="addItem"><type>skin_js</type><name>js/jquery-1.3.2.min.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/cycle-fade-effect.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/slider.js</name></action>
</reference>
边栏:左边栏,右边栏
布局:page.xml
--------------------------------
<block type="core/text_list" name="left" as="left" translate="label">
<label>Left Column</label>
</block>
..................................................
<block type="core/text_list" name="content" as="content" translate="label">
<label>Main Content Area</label>
</block>
....................................................................................................
<block type="core/text_list" name="right" as="right" translate="label">
<label>Right Column</label>
</block>
=====================================================
在catalog.xml 里重新定义left,right
----------------------------------------------------------
<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>
====================================================
left_col.phtml 的内容:
----------------------------------------------
<div class="block block-banner">
<div class="block-content">
<?php if(strtolower(substr($this->getLinkUrl(),0,4))==='http'): ?>
<a href="<?php echo $this->getLinkUrl() ?>" title="<?php echo $this->__($this->getImgAlt()) ?>">
<?php elseif($this->getLinkUrl()): ?>
<a href="<?php echo $this->getUrl($this->getLinkUrl()) ?>" title="<?php echo $this->__($this->getImgAlt()) ?>">
<?php endif; ?>
<img src="<?php echo $this->getSkinUrl($this->getImgSrc()) ?>"<?php if(!$this->getLinkUrl()): ?> title="<?php echo $this->__($this->getImgAlt()) ?>"<?php endif; ?> alt="<?php echo $this->__($this->getImgAlt()) ?>" />
<?php if($this->getLinkUrl()): ?>
</a>
<?php endif ?>
</div>
</div>
=============================================================
getLinkUrl() 获得<action method="setLinkUrl"><url>的值,如果值是完整的URL,输出
不完整, getUrl() 获得网站的地址,和<action method="setLinkUrl"><url>的值连在一起。
getImgAlt() 获得<action method="setImgAlt" translate="alt" module="catalog"><alt>的值
getSkinUrl 获得模板skin的完整路径
getImgSrc() 获得<action method="setImgSrc"><src> 的值
---------------------------------------------------------------------------------------------
<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/media/col_right_callout.jpg</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>
========================================================
主页样式:1column.phtml,2columns-right.phtml,2columns-left.phtml,3columns.phtml,empty.phtml,popup.phtml,print.phtml 里定义
------------------------------------------
<div class="main-container col3-layout">
<div class="main">
<?php echo $this->getChildHtml('breadcrumbs') ?>
<div class="col-wrapper">
<div class="col-main">
<?php echo $this->getChildHtml('global_messages') ?>
<?php echo $this->getChildHtml('content') ?>
</div>
<div class="col-left sidebar"><?php echo $this->getChildHtml('left') ?></div>
</div>
<div class="col-right sidebar"><?php echo $this->getChildHtml('right') ?></div>
</div>
</div>
-------------------------------------------------
总结:
先加载page.xml, 定义了root,head,after_body_start,golbal_notices,header,top.links,store_language,top.menu,top.container,breadcrumbs,left,global_messages,messages,content,right,footer,bottom.container,store_switcher,footer_links,before_body_end,core_profiler
再加载catalog.xml, catalog.xml重新定义:
top.menu(catalog.topnav),left(left.permanent.callout),right(catalog.compare.sidebar,right.permanent.callout),footer_links,catalog_product_price_template
对应模板:
top.menu -->> catalog/navigation/top.phtml
left -->> callouts/left_col.phtml
right -->> catalog/product/compare/sidebar.phtml
-->> callouts/right_col.phtml
footer_links
catalog_product_price_template
定义:
category 的布局
magento 模板模块
最新推荐文章于 2015-05-05 17:34:22 发布