- 浏览: 80148 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
shuishui8310:
开公司了?
Magento学习课程继续 -
yanggaojiao:
对不起,很久没上这里了,在CMS->Home->D ...
Magento在首页自定制Block的方法 -
beautiful_good:
hi,你好我用的是magento 1.4.2.0版本的,请问如 ...
Magento在首页自定制Block的方法 -
as3291363:
太慢了....
Magento 1.4.1.0 的CMS太酷了 -
richardlovejob:
这个分享是在太及时了,谢谢。
Magento Events分析和使用实例与技巧
本节不打算翻译,留给自己需要的时候Copy用
Add Home Link with functional active state to Menu Bar (Alternative Method) |
Find the file called top.phtml in app/design/frontend/default/yourtheme/template/catalog/navigation/ and make the following change:
<div class="header-nav-container"> <div class="header-nav"> <h4 class="no-display"><?php echo $this->__('Category Navigation:') ?></h4> <ul id="nav"> <!-- ALTERNATIVE HOME BUTTON HACK --> <li class="home"><a href="<?php echo $this->getUrl('')?>"><?php echo $this->__('Home') ?></a></li> <!-- ALTERNATIVE HOME BUTTON HACK --> <?php foreach ($this->getStoreCategories() as $_category):?> <?php echo $this->drawItem($_category) ?> <?php endforeach ?> </ul> </div> <?php echo $this->getChildHtml('topLeftLinks') ?> </div>
Add the following to the menu.css file in skin/frontend/default/yourtheme/css/. This example is for a CMS home page which uses cms-home class in its body tag.
body.cms-home #nav li.home a { color:#d96708; }
NOTE: The following comments refer to the following methods.
:::: TRIED THIS AND IT ADDS THE LINK, BUT THE ACTIVE STATE DOES NOT FUNCTION CORRECTLY ::::
Special Note to the person(s) responsible for this page. Myself and many others have attempted to use this code snippet to get the result explained with an active state, but have been unable to get the active state to work. The link does work as far as pointing to exsisting cms page or external pages, but the “active” state does not work at all. Page refreshes and all links adjust back to original state.
FOR HOME LINK ONLY ACTIVE STATE I use the following as it’s the simplist way to get the active state working correctly on the home link.
<div class="header-nav-container"> <div class="header-nav"> <h4 class="no-display"><?php echo $this->__('Category Navigation:') ?></h4> <ul id="nav"> <!-- WORKING ACTIVE STATE HOME BUTTON HACK --> <li class="home<?php if (Mage::helper('core/url')->getCurrentUrl() === Mage::helper('core/url')->getHomeUrl()):?> active<?php endif;?>"><a href="<?php echo $this->getUrl('')?>"><?php echo $this->__('Home') ?></a></li> <!-- WORKING ACTIVE STATE HOME BUTTON HACK --> <?php foreach ($this->getStoreCategories() as $_category):?> <?php echo $this->drawItem($_category) ?> <?php endforeach ?> </ul> </div> <?php echo $this->getChildHtml('topLeftLinks') ?> </div>
For the Home link in the menu bar of the main template you can add some code to one of the template files.
Find the file called top.phtml in app/design/frontend/default/default/template/catalog/navigation/ and make the following change:
div class="header-nav-container"> <div class="header-nav"> <h4 class="no-display"><?php echo $this->__('Category Navigation:') ?></h4> <ul id="nav"> <!-- HOME BUTTON HACK --> <?php $_anyActive = false; foreach ($this->getStoreCategories() as $_category) { $_anyActive = $_anyActive || $this->isCategoryActive($_category); } ?> <li class="<?php echo !$_anyActive ? 'active' : '' ?>"><a href="<?php echo $this->getUrl('')?>"><?php echo $this->__('Home') ?></a></li> <!-- HOME BUTTON HACK --> <?php foreach ($this->getStoreCategories(10) as $_category):?> <?php echo $this->drawItem($_category) ?> <?php endforeach ?> </ul> </div> <?php echo $this->getChildHtml('topLeftLinks') ?> </div>
:x:x:x: Tried several on this page. The one directly above worked best. I modified it a little bit to contain a link title. Just paste
<li class="home<?php if (Mage::helper('core/url')->getCurrentUrl() === Mage::helper('core/url')->getHomeUrl()):?> active<?php endif;?>"><a href="<?php echo $this->getUrl('')?>" title="Home">Home</a></li>
just before
<?php echo $_menu; ?>
if you’re using the default theme or a top.phtml that is based on it. :x:x:x:
The correct way to do this is to open the theme/layout/customer.xml file and then modify the section that shows customer links on all pages, to include a link home and also a link to other customer service pages that you have deemed necessary, e.g. ‘returns’ (if you get a lot of those enquiries...).
By way of example, this modified XML file includes a ‘Home’ link and ‘Deliveries’, ‘Returns’ and ‘Contact Us’:
<!-- Default layout, loads most of the pages --> <default> <!-- Mage_Customer --> <reference name="top.links"> <action method="addLink" translate="label title" module="customer"><label>Home</label><url></url><title>Home</title><prepare>true</prepare><urlParams/><position>5</position></action> <action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>94</position></action> <action method="addLink" translate="label title" module="customer"><label>Deliveries</label><url>deliveries</url><title>Deliveries</title><prepare>true</prepare><urlParams/><position>95</position></action> <action method="addLink" translate="label title" module="customer"><label>Returns</label><url>returns</url><title>Returns</title><prepare>true</prepare><urlParams/><position>96</position></action> <action method="addLink" translate="label title" module="customer"><label>Contact Us</label><url>contacts</url><title>Contact Us</title><prepare>true</prepare><urlParams/><position>97</position></action> </reference> </default>
This will allow you to add a Home link in the Top Links (My Account | My Wishlist | Etc.) before the My Account.
Find the file called links.phtml in app/design/frontend/default/default/template/page/template/ and make the following change:
<?php $_links = $this->getLinks(); ?> <?php if(count($_links)>0): ?> <div> <ul<?php if($this->getName()): ?>):?> id="<?php echo $this->getName() ?>"<?php endif;?>> <!-- HOME BUTTON HACK --> <li class="first"><a href="<?php echo $this->getUrl('')?>"><?php echo $this->__('Home') ?></a></li> <!-- HOME BUTTON HACK --> <?php foreach($_links as $_link): ?> <li <?php if($_link->getIsLast()): ?> class="last"<?php endif; ?><?php echo $_link->getLiParams() ?>><?php echo $_link->getBeforeText() ?><a href="<?php echo $_link->getUrl() ?>" title="<?php echo $_link->getTitle() ?>" <?php echo $_link->getAParams() ?>><?php echo $_link->getLabel() ?></a><?php echo $_link->getAfterText() ?></li> <?php endforeach; ?> </ul> </div> <?php endif; ?>
NOTE: The if statement in the foreach loop has changed since “Home” will always be first, it wasn’t needed. Also note that the <li> for the “Home” link automatically gets the class “first”.
This allows for space between Home | My Account
发表评论
-
Magento Admin Form表单元素大全
2012-09-30 12:08 997开发Magento后台的时候经常用到表单(Varien_Dat ... -
Magento A-Z和sitemap插件
2012-09-30 11:53 3710Iifire历经四个月多开发 ... -
Magento SQL绑定查询条件
2012-04-17 15:17 2609Magento从数据库中取数据时大多用的Collection, ... -
Magento站内信插件
2012-02-28 10:04 1427Magento Message Box即站内信组件,主要用于管 ... -
Magento內链外链插件
2012-02-21 10:26 1427给您的Magento网站添加关键词的链接,更多的内链和外链,更 ... -
Magento高级产品订阅
2012-02-21 08:54 2240基本功能介绍 产品订 ... -
Magento产品降价通知和到货通知插件
2012-02-09 16:04 01.客户可以在Magento前台页面订阅某个产品的降价通知(缺 ... -
Magento学习课程继续
2011-03-20 16:05 1465由于前一大段时间都比较忙,忽略了大家啦,好久没有更新内容了。打 ... -
Magento在首页自定制Block的方法
2010-09-19 14:27 2805Magento中想在首页显示一些自定制的BLock有很多中方法 ... -
magento获取相应的查询语句
2010-09-19 14:12 1056虽然Magento对数据库层封装得比较深,但是我们可以很轻松的 ... -
Magento 使用小技巧体现大智慧(Last things first)
2010-06-15 23:38 1220在我们的购物车Magento上线之前,有些小细节很容易被忽略。 ... -
从数据库设计看Magento系列教程(1)
2010-06-15 19:11 0TODO..... -
Magento Events分析和使用实例与技巧
2010-06-14 20:15 3328当你需要扩展Magento的核心的功能时有两个选择 重写( ... -
Magento CMS 应用实例
2010-06-14 19:03 4768下面是一些CMS的应用实例: 本文已移到 http:// ... -
Magento 1.4.1.0 的CMS太酷了
2010-06-14 02:49 1671哇,Magento 1.4.1.0版本已经出来了,今天安装使用 ... -
Magento SEO 使用技巧
2010-06-13 20:50 1058这些内容大致分为: HTML Head URL rewr ... -
Magento web services API 扩展
2010-06-13 11:52 3085<?xml version="1.0&qu ... -
Magento image 操作
2010-06-13 10:48 1278由于lib/Varien/Image.php 的 Varie ... -
Magento中直接使用SQL查询语句
2010-06-13 10:29 1753本文已移到:http://www.iifire.com ... -
Create Payment Method Module
2010-06-13 08:23 1145Javaeye的一些作者也有相 ...
相关推荐
与上面操作相同,不同的是在进行到“窗口属性”定义操作时,在[General]中指定 chm 文件标题栏中的文字“test2---带功能按钮的 chm 文件”,在[Button]中指定欲在 chm 文件的按钮区中显示的按钮如图(6)。...
242.如何在程序视图窗口中添加插入符 243.如何实现QQ抽屉导航效果的界面 244.如何使用树形视图导航程序界面 第7章 程序管理和控制 245.如何捕获按下的Home等功能键 246.如何捕获按下的Air或Shift+Alt组合键 247....
通过导航栏中的链接转到“创建星球”页面页面网址应包含“ / editor” 它应该能够创造一个星球 点击“水彩”按钮 通过单击两次“添加树”按钮来添加两棵树 在“行星名称”输入中输入行星名称 在“行星描述”输入中...
:这会将闪烁的圣诞灯添加到Legal Server页面的蓝色导航栏中。 :这会在Legal Server页面上添加其他各种节日装饰,例如将面包屑导航中的“首页”替换为侧边栏中的“ Ho,ho,home!”,“包装纸”,和背景中的一棵...
在任务栏中,依次单击“开始”和“运行”,在“运行”文本框中键入 regedit.exe,再单击“确定”。 导航到以下注册表项:[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib]。查找下列项...
util实现Java图片水印添加功能,有添加图片水印和文字水印,可以设置水印位置,透明度、设置对线段锯齿状边缘处理、水印图片的路径,水印一般格式是gif,png,这种图片可以设置透明度、水印旋转等,可以参考代码...
Foundation 侧边栏 侧边栏导航 Foundation 使用 创建侧边栏: 实例 Link 1 ...激活链接与分割线 ...我们可以使用网格设计模式来设置侧边导航栏,实例如下: 实例 Home Learn HTML ...
增加:导航在顶部的2栏布局(后台主题设置中); 增加:2种分页模式的选择(后台主题设置中); 增加:指定一个或多个分类下文章不显示在首页(后台主题设置中); 增加:文章页面上一篇和下一篇模块; 增加:文章...
增加:导航在顶部的2栏布局(后台主题设置中); 增加:2种分页模式的选择(后台主题设置中); 增加:指定一个或多个分类下文章不显示在首页(后台主题设置中); 增加:文章页面上一篇和下一篇模块; 增加:文章...
节点开放移位 如何使用这个专案: 如果您还没有,请提供一个OpenShift容器平台环境。 导航到OpenShift Web控制台。 在OpenShift中创建一个新项目。... 在搜索栏中输入MongoDB,然后在“数据存储”下选择适当
该导航栏与readium.org导航栏并不完全相同,因为它仅提供指向目录的链接和简化的“关于”菜单(该菜单会发回到readium.org网站)。 Readium徽标还发回到readium.org主页,即面包屑中Home条目的同上。 根目录仅包含...
现在,我们的目标是在您的网站中添加新页面。 项目需求 您的应用程序应具有“主页”,“项目”,“博客”和“关于页面”。 标头 创建具有3个链接的导航栏 在右侧,应该有一个带有您的名字或图像的主页按钮。 在...
在那里还有一些其他教程的链接。而本文的该部分将让你对PHP熟悉一点。我不可能做到没有任何遗漏,我的目的只在于能让你迅速开始你的PHP编程。 2.1 首要条件 你首先必须要有一个正在工作着的支持PHP的web服务器。我...
� GPS 卫星导航功能,手机照相, MP3 ,蓝芽等均被列为 Android 所提供支持的基本选项。 � Android 的平台基本上是免费的,虽然有部份原生链接库会要求费用,但大部份是免权利金; Android 的 程序可以采用 JAVA ...
bootcfg /add 向引导列表中添加 Windows 安装。 bootcfg /rebuild 重复全部 Windows 安装过程并允许用户选择要添加的内容。 注意:使用 bootcfg /rebuild 之前,应先通过 bootcfg /copy 命令备份 boot.ini...
6.25 在SDK开发环境中访问JNI接口 第7章 娱乐多媒体 7.1 访问Drawable资源的宽和高 7.2 绘制几何图形 7.3 手机屏幕保护程序 7.4 用手指移动画面里的照片 7.5 加载存储卡的Gallery相簿 7.6 取得手机内置媒体中的图片...
6.25 在SDK开发环境中访问JNI接口 第7章 娱乐多媒体 7.1 访问Drawable资源的宽和高 7.2 绘制几何图形 7.3 手机屏幕保护程序 7.4 用手指移动画面里的照片 7.5 加载存储卡的Gallery相簿 7.6 取得手机内置媒体中的图片...