В примере нужно разделить категории и товары в autocomplete. Категории в теге <b>, товары без.
$.widget("custom.groupautocomplete",$.ui.autocomplete,{
_create:function(){
this._super();
this.widget().menu("option","items",">:not(.ui-autocomplete-group)");
},
_renderMenu:function(ul,items){
var self=this;
var is_bold=0;
$.each(items,function(index,item){
if(item.label.indexOf("<b>")!=-1){
if(is_bold!=1){
ul.append("<li class='ui-autocomplete-group'>Категории по запросу:</li>");
}
is_bold=1;
}
else{
if(is_bold!=0){
ul.append("<li class='ui-autocomplete-group'>Товары по запросу:</li>");
}
is_bold=0;
}
self._renderItemData(ul,item);
});
},
_renderItem:function(ul,item){
var bold='';
if(item.label.indexOf("<b>")!=-1){
bold=' class="category"';
}
return $("<li"+bold+"></li>").data("item.autocomplete",item).append(item.label.replace(/(<([^>]+)>)/ig,"")).appendTo(ul);
}
});
$("#search").groupautocomplete({
source:"/ajax_search.php",
minLength:3,
select:function(event,ui){
event.preventDefault();
$(this).val(ui.item.value.replace(/(<([^>]+)>)/ig,""));
$(this).parent('form').submit();
}
});
Less:
.ui-autocomplete{
max-width:400px !important;
.ui-state-focus{
background:fade(@color_link,80%) !important;
color:@color_white !important;
border-color:transparent !important;
}
}
.ui-menu .ui-menu-item.category{
font-weight:bold;
color:@color_link;
text-decoration:underline;
}
.ui-autocomplete-group{
padding:3px 1em 3px .4em;
font-weight:700;
font-size:17px;
color:@color_black;
margin-top:10px;
}
.ui-autocomplete-group:first-child{
margin-top:0;
}
по теме:
http://jsfiddle.net/bcbond/p924tge8/
Для использования html
в ui autocomplete
добавить:
.data("ui-autocomplete")._renderItem=function(ul,item){
return $("<li></li>").data("item.autocomplete",item).append(item.label).appendTo(ul);
};
Полный текст:
$("#search").autocomplete({
source:"/ajax_search.php",
minLength:3,
select:function(event,ui){
$(this).val(ui.item.value.replace(/(<([^>]+)>)/ig,""));
$(this).parent('form').submit();
}
}).data("ui-autocomplete")._renderItem=function(ul,item){
return $("<li></li>").data("item.autocomplete",item).append(item.label).appendTo(ul);
};
или так, чтобы избавиться от тегов совсем:
$("#search").autocomplete({
source:"/ajax_search.php",
minLength:3,
select:function(event,ui){
event.preventDefault();
$(this).val(ui.item.value.replace(/(<([^>]+)>)/ig,""));
$(this).parent('form').submit();
}
}).data("ui-autocomplete")._renderItem=function(ul,item){
var bold='';
if(item.label.indexOf("<b>")!=-1){
bold=' style="font-weight:bold;"';
}
return $("<li"+bold+"></li>").data("item.autocomplete",item).append(item.label.replace(/(<([^>]+)>)/ig,"")).appendTo(ul);
};
Вместо:
$("#search").autocomplete({
source:"/ajax_search.php",
minLength:3,
select:function(event,ui){
$(this).val(ui.item.value);
$(this).parent('form').submit();
}
});
Найти в таблице catalog
записи с повторяющимся uid
.
Показать все:
SELECT * FROM `catalog` WHERE `uid` IN (SELECT `uid` FROM `catalog` GROUP BY `uid` HAVING COUNT(`uid`)>1) ORDER BY `uid` ASC, `id` DESC;
Показать только уникальные:
SELECT * FROM `catalog` WHERE `uid` IN (SELECT `uid` FROM `catalog` GROUP BY `uid` HAVING COUNT(`uid`)>1) GROUP BY `uid` ORDER BY `uid` ASC, `id` DESC;
Поиск по двум столбцам
Рамка с уголком посредине в центре (less):
.block{
background:@color_white;
border:1px solid @color_gray;
.border_radius(5px);
padding:10px;
&:before,&:after{
content:'';
position:absolute;
left:50%;
margin-left:-10px;
top:-20px;
border:10px solid transparent;
border-bottom:10px solid @color_gray;
}
&:after{
border-bottom:10px solid @color_white;
top:-19px;
}
}
http://htmlbook.ru/blog/treugolniki-cherez-css
Заменяем /temp/
на /
в parent_chpu
в таблице seo
в строках, которые начинаются с /temp/
UPDATE `seo` SET `parent_chpu` = REPLACE(`parent_chpu`, '/temp/', '/') WHERE `parent_chpu` LIKE '/temp/%' OR `parent_chpu`='/temp/';
Заменяем 125/
на «ничего» в path
в таблице mod_shop
в строках, которые начинаются с 125/
UPDATE `mod_shop` SET `path` = REPLACE(`path`, '125/', '') WHERE `path` LIKE '125/%';