PDA

View Full Version : تغییرات در یک منو موضوعی



control1390
سه شنبه 05 فروردین 1393, 00:09 صبح
سلام
سایت زیر که با نیوک ساخته شده یک منو موضوعی داره که بصورت اتوماتیک موضوعات محصولات سایت رو میاره نشون میده(بلوک موضوعات در پایین بلوک سبد خرید -سمت راست سایت):
www.filedc.com (http://www.filedc.com)
الان موضوعات بصورت عمودی از بالا به پایین قرار دارن اگه بخواهیم موضوعات بصورت افقی قرار بگیرن (مثل منویی که در بالای سایت بصورت دستی نوشته شده)باید چه تغییراتی در کد های بلوک انجام بدم:
کد های بلوک بصورت زیر هستش:

<?php

if ( !defined('BLOCK_FILE') ) {
Header("Location: ../index.php");
die();
}

$products_topics_config = array(
"orderby" => "topicid",//مرتب سازي بر اساس topicid, topicname, topictext
"menus_width" => 600,//پهناي هر کدام از منوها و زير منوها
"menus_height" => 30,//ارتفاع هر کدام از منوها و زير منوها
"background" => "#fff",//زمينه عادي
"background_hover" => "#ccc",//زمينه در صورت رفتن موس روي منو
"color" => "#666666",//رنگ عادي کلمات در منوها
"color_hover" => "#000",//رنگ کلمات با رفتن موس روي آنها
"menus_border" => true,// فعال يا غير فعال بودن کادر دور منوها
"menus_border_color" => "#aaa",//رنگ کادر دور منوها در صورت فعال بودن کادر
"transition" => "fade",//fade, show, slide نوع افکت باز و بسته شدن منوها
);

/* منوهاي دستي شما که ميتونيد دستکاريشون کنيد */

$products_topics = array(
"1" => array(
"menu_naume" => "نقشه سایت",
"menu_link" => "Site_Map/",
"menu_parent" => "0",
),
"2" => array(
"menu_naume" => "منوی شماره 2",
"menu_link" => "#",
"menu_parent" => "0",
),
"2" => array(
"menu_naume" => "زیر منوی شماره 2",
"menu_link" => "#",
"menu_parent" => "2",
),
);


/* منوهاي دستي شما که ميتونيد دستکاريشون کنيد */


class get_products_topics{

var $allproducts_topics = array();

function show_products_topics($submenus, $id=0, $has_sub){
$content = "\t<ul>\n";
foreach($submenus as $menus_key => $menus_val)
{
if($menus_val['menu_parent'] != $id) continue;
$hassub = 0;
unset($submenus2);
$submenus2 = array();
foreach($this->allproducts_topics as $sub_key => $submenu)
{
if($submenu['menu_parent'] == $menus_key)
{
$submenus2[$sub_key] = $this->allproducts_topics[$sub_key];
$hassub++;
}
}
$content .= "\t\t<li>
<a href=\"".$menus_val['menu_link']."\">".$menus_val['menu_naume']."</a>\n";
if($hassub > 0)
{
$content .= $this->show_products_topics($submenus2, $menus_key, $hassub);
}
$content .= "\t\t</li>\n";
}
$content .= "\t</ul>\n";
return $content;
}

}
global $prefix, $db, $align;
$ThemeSel = get_theme();

/* منوهاي اتوماتيک مربوط به موضوعات که نبايد دستکاري کنيد */
$result = $db->sql_query("SELECT * FROM ".$prefix."_products_topics ORDER BY ".$products_topics_config['orderby']." ASC");
while($row = $db->sql_fetchrow($result)){
$topicid = $row['topicid'];
$topicname = $row['topicname'];
$newtopicid = $row['topicid']+2000;
$newparent_id = $row['parent_id']+2000;
if($newparent_id == 2000) $newparent_id = 0;

$products_topics[$newtopicid]['menu_naume'] = $topicname;
$products_topics[$newtopicid]['menu_link'] = "modules.php?name=Products&product_topic=".$topicid."";
$products_topics[$newtopicid]['menu_parent'] = $newparent_id;
}
/* منوهاي اتوماتيک مربوط به موضوعات که نبايد دستکاري کنيد */

$content = "
<style>
#jquery-products_topics a {display:block;text-decoration:none;color:#aaa;padding:0 7px;line-height:22px;height:".$products_topics_config['menus_height']."px;}
#jquery-products_topics ul{margin:0;padding:0;min-width:180px;list-style:none;}
#jquery-products_topics ul ul {".(($products_topics_config['menus_border'] == true) ? "border:1px solid ".$products_topics_config['menus_border_color'].";":"")."display:none;position:absolute;margin-top:-27px;margin-right:179px;float:right;min-width: 200px;z-index: 99999;}
#jquery-products_topics ul li {background:none;background-color:".$products_topics_config['background'].";}
#jquery-products_topics ul li:hover {background:none;background-color:".$products_topics_config['background_hover'].";}
#jquery-products_topics ul li a,#jquery-products_topics ul li a span {line-height:25px;color:".$products_topics_config['color'].";text-align:right;}
#jquery-products_topics ul li a:hover,#jquery-products_topics ul li a:hover span{line-height:25px;color:".$products_topics_config['color_hover'].";}
</style>
<script>
(function($) {
$.fn.hoverIntent = function(f,g) {
var cfg = {
sensitivity: 1,
interval: 100,
timeout: 0
};
cfg = $.extend(cfg, g ? { over: f, out: g } : f );
var cX, cY, pX, pY;
var track = function(ev) {
cX = ev.pageX;
cY = ev.pageY;
};
var compare = function(ev,ob) {
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
$(ob).unbind(\"mousemove\",track);
ob.hoverIntent_s = 1;
return cfg.over.apply(ob,[ev]);
} else {
pX = cX; pY = cY;
ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
}
};
var delay = function(ev,ob) {
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
ob.hoverIntent_s = 0;
return cfg.out.apply(ob,[ev]);
};
var handleHover = function(e) {
var ev = jQuery.extend({},e);
var ob = this;
if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
if (e.type == \"mouseenter\") {
pX = ev.pageX; pY = ev.pageY;
$(ob).bind(\"mousemove\",track);
if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
} else {
$(ob).unbind(\"mousemove\",track);
if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
}
};
return this.bind('mouseenter',handleHover).bind('mouselea ve',handleHover);
};
})(jQuery);
</script>
<div id=\"jquery-products_topics\">";
$get_products_topics = new get_products_topics();
$get_products_topics->allproducts_topics = $products_topics;
$content .= $get_products_topics->show_products_topics($products_topics, 0, 0);
$content .= "</div>
<script>

$(\"#jquery-products_topics li\").hoverIntent(mouse_over_topic,mouse_out_topic);
function mouse_over_topic(){
switch(\"".$products_topics_config['transition']."\"){
case\"fade\":
$(this).children(\"ul\").fadeIn(\"slow\");
break;

case\"show\":
$(this).children(\"ul\").show(\"slow\");
break;

case\"slide\":
$(this).children(\"ul\").slideDown(\"slow\");
break;
}
}
function mouse_out_topic(){
switch(\"".$products_topics_config['transition']."\"){
case\"fade\":
$(this).children(\"ul\").fadeOut(\"slow\");
break;

case\"show\":
$(this).children(\"ul\").hide(\"slow\");
break;

case\"slide\":
$(this).children(\"ul\").slideUp(\"slow\");
break;
}
}
</script>
";
?>

control1390
سه شنبه 05 فروردین 1393, 14:25 عصر
کسی بلد نیست چطوری میشه این کد ها رو تغییر داد
الا منو ها به اینصورته:
117281
میخام به اینصورت بشه:
117282

SadeghPro19
سه شنبه 05 فروردین 1393, 17:27 عصر
شما باید CSS و کدهای Jquery تون رو تغییر بدید...

control1390
چهارشنبه 06 فروردین 1393, 17:57 عصر
شما باید CSS و کدهای Jquery تون رو تغییر بدید...
خیلی ممنون بابت پاسختون
میشه بفرمایید کد ها رو باید چه تغییر ی بدم