我想把默认模板的商品分类变成这样?怎么修改?

2016-07-07 16:37 来源:www.chinab4c.com 作者:ecshop专家

我想把默认模板的商品分类变成这样?怎么修改?让他2级分类,每个分类都占一行,不管分类名称长短。




<ul>
<!--{foreach from=$categories item=cat}-->
<li> <span class="parent-cat"><A href="{$cat.url}">{$cat.name|escape:html}</A></span><br />
<!--{foreach from=$cat.children item=child}-->
<span style="white-space:nowrap;"><A href="{$child.url}">{$child.name|escape:html}</A></span>
<!--{/foreach}-->
</li>
<!--{/foreach}-->
</ul>

这是默认的代码

回答:
然后把样式表和图片也搞过来不就OK了

这样的也可以呀???

   去试一下..

帮忙解决一下

这样就可以了:
一:分类代码
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div class="title-01">
<div class="title-01-title">商品分类</div>
</div>
<div id="category-tree">
<!--{foreach from=$categories item=cat}-->
<h3><a href="{$cat.url}">{$cat.name|escape:html}</a></h3>
<div class="yiji"></div>
<ul class="erji">
<!--{foreach from=$cat.children item=child}-->
<li><a href="{$child.url}">{$child.name|escape:html}</a></li>
<!--{/foreach}-->
</ul>
<!-- {/foreach}-->
</div>

再接上:
fx.Text = Class.create();
fx.Text.prototype = Object.extend(new fx.Base(), {
initialize: function(el, options) {
this.el = $(el);
this.setOptions(options);
if (!this.options.unit) this.options.unit = "em";
},

increase: function() {
this.el.style.fontSize = this.now + this.options.unit;
}
});

fx.Combo = Class.create();
fx.Combo.prototype = {
setOptions: function(options) {
this.options = {
opacity: true,
height: true,
width: false
}
Object.extend(this.options, options || {});
},

initialize: function(el, options) {
this.el = $(el);
this.setOptions(options);
if (this.options.opacity) {
this.o = new fx.Opacity(el, options);
options.onComplete = null;
}
if (this.options.height) {
this.h = new fx.Height(el, options);
options.onComplete = null;
}
if (this.options.width) this.w = new fx.Width(el, options);
},

toggle: function() { this.checkExec('toggle'); },

hide: function(){ this.checkExec('hide'); },

clearTimer: function(){ this.checkExec('clearTimer'); },

checkExec: function(func){
if (this.o) this.o[func]();
if (this.h) this.h[func]();
if (this.w) this.w[func]();
},

resizeTo: function(hto, wto) {
if (this.h && this.w) {
this.h.custom(this.el.offsetHeight, this.el.offsetHeight + hto);
this.w.custom(this.el.offsetWidth, this.el.offsetWidth + wto);
}
},

customSize: function(hto, wto) {
if (this.h && this.w) {
this.h.custom(this.el.offsetHeight, hto);
this.w.custom(this.el.offsetWidth, wto);
}
}
}

fx.Accordion = Class.create();
fx.Accordion.prototype = {
setOptions: function(options) {
this.options = {
delay: 100,
opacity: false
}
Object.extend(this.options, options || {});
},

initialize: function(yijis, elements, options) {
this.elements = elements;
this.setOptions(options);
var options = options || '';
this.fxa = [];
if (options && options.onComplete) options.onFinish = options.onComplete;
elements.each(function(el, i){
options.onComplete = function(){
if (el.offsetHeight > 0) el.style.height = '1%';
if (options.onFinish) options.onFinish(el);
}
this.fxa = new fx.Combo(el, options);
this.fxa.hide();
}.bind(this));

yijis.each(function(tog, i){
if (typeof tog.onclick == 'function') var exClick = tog.onclick;
tog.onclick = function(){
if (exClick) exClick();
this.showThisHideOpen(elements);
}.bind(this);
}.bind(this));
},

showThisHideOpen: function(toShow){
this.elements.each(function(el, j){
if (el.offsetHeight > 0 && el != toShow) this.clearAndToggle(el, j);
if (el == toShow && toShow.offsetHeight == 0) setTimeout(function(){this.clearAndToggle(toShow, j);}.bind(this), this.options.delay);
}.bind(this));
},

clearAndToggle: function(el, i){
this.fxa.clearTimer();
this.fxa.toggle();
}
}

var Remember = new Object();
Remember = function(){};
Remember.prototype = {
initialize: function(el, options){
this.el = $(el);
this.days = 365;
this.options = options;
this.effect();
var cookie = this.readCookie();
if (cookie) {
this.fx.now = cookie;
this.fx.increase();
}
},

setCookie: function(value) {
var date = new Date();
date.setTime(date.getTime()+(this.days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
document.cookie = this.el+this.el.id+this.prefix+"="+value+expires+"; path=/";
},

readCookie: function() {
var nameEQ = this.el+this.el.id+this.prefix + "=";
var ca = document.cookie.split(';');
for(var i=0;c=ca;i++) {
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return false;
},

custom: function(from, to){
if (this.fx.now != to) {
this.setCookie(to);
this.fx.custom(from, to);
}
}
}

fx.RememberHeight = Class.create();
fx.RememberHeight.prototype = Object.extend(new Remember(), {
effect: function(){
this.fx = new fx.Height(this.el, this.options);
this.prefix = 'height';
},

toggle: function(){
if (this.el.offsetHeight == 0) this.setCookie(this.el.scrollHeight);
else this.setCookie(0);
this.fx.toggle();
},

resize: function(to){
this.setCookie(this.el.offsetHeight+to);
this.fx.custom(this.el.offsetHeight,this.el.offsetHeight+to);
},

hide: function(){
if (!this.readCookie()) {
this.fx.hide();
}
}
});

十分感谢楼上的帅哥!