Wedding Chicks
function search($words,$c,$next=0,$max=20){ $qn='ext_search'; $val=''; $s=gG('query'); $s=@$s['s']; if(count($words)>0){ $qwords=array_map('mE',$words); $q="(CASE WHEN inhaltname='blog' THEN 30 WHEN inhaltname='vendors' OR inhaltname='trendings' THEN 20 ELSE 10 END)"; $res=mQ("SELECT inhaltname,inhaltid FROM `searchindex` WHERE".($c?" inhaltname='".mE($c)."' AND":'')." (INSTR(`word`,'".implode("') OR INSTR(`word`,'",$qwords)."')) GROUP BY inhaltname,inhaltid ORDER BY ".(count($words)>1?"TRUNCATE(SUM(CASE WHEN `word` = '".implode("' OR `word` = '",$qwords)."' THEN $q ELSE 1 END),-1)":$q)." DESC, datum DESC LIMIT ".($max*$next).",$max",$qn); while($rows=mO($res)){ $text=$titel=''; if($rows->inhaltname=='blog'){ if(!$row=mA("SELECT a.*,b.rubrik,c.name autor FROM `blog` a JOIN `inhalt` b ON a.inhalt=b.id JOIN `cmsuser` c ON c.`id`=a.`autor` WHERE a.id=".$rows->inhaltid,$qn)){continue;} $blog_type=preg_split('//',$row['type'],2, PREG_SPLIT_NO_EMPTY); if($blog_type[0]==2 and isset($blog_type[1])){ $row=array_merge($row,mA("SELECT titel, images FROM trendings WHERE id=".$blog_type[1],$qn)?:[]); $row['image']=stristr($row['images'],',',1); } $link=["nav"=>'blog',"titel"=>$row['titel'].'-l-'.$row['id'].'-l-'.$row['rubrik']]; $flink=rewriteurllink($link); $imglink=$titlelink=$rmlink=hreflink($link); $img=@$row['image']?:stristr($row['images'],',',1); $credits=json_decode(html_entity_decode($row['credits']),1); $credits=empty($credits)?'':array_map(function($a){$a=current($a);return $a[0].': '.$a[1];},$credits); $credits=empty($credits)?'':implode(', ',$credits); $text=get_text($words,$row['description'].' '.$row['text'].' '.$credits); }else if($rows->inhaltname=='trendings'){ $row=mA("SELECT a.*,b.rubrik,c.name autor FROM `trendings` a JOIN `inhalt` b ON a.inhalt=b.id JOIN `cmsuser` c ON c.`id`=a.`autor` WHERE a.id=".$rows->inhaltid,$qn); $link=["nav"=>'modul',"titel"=>'trending-'.$row['id'].'-'.$row['titel'].'-l-'.$row['rubrik'].'-l-22']; $flink=rewriteurllink($link); $imglink=$titlelink=$rmlink=hreflink($link); $img=stristr($row['images'],',',1); $text=get_text($words,$row['text']); }else if($rows->inhaltname=='printouts'){ $row=mA("SELECT a.*,b.rubrik,c.name autor FROM `printouts` a JOIN `inhalt` b ON a.inhalt=b.id JOIN `cmsuser` c ON c.`id`=a.`autor` WHERE a.id=".$rows->inhaltid,$qn); $link=["nav"=>'modul',"titel"=>'print-'.$row['id'].'-'.$row['titel'].'-l-'.$row['rubrik'].'-l-17']; $flink=rewriteurllink($link); $imglink=$titlelink=$rmlink=hreflink($link); $img=$row['image']; $text=''; }else if($rows->inhaltname=='inspirations'){ $row=mA("SELECT a.*,b.business,b.website FROM `inspirations` a JOIN `vendors` b ON b.`id`=a.`vendors` WHERE a.id=".$rows->inhaltid,$qn); $website=$row['website']?:hreflink(["nav"=>'modul',"titel"=>'inspiration-l-'.$row['id'].'-l-7']); $img=$row['image']; $link=["nav"=>'modul',"titel"=>'inspiration-l-'.$row['id'].'-l-7']; $flink=rewriteurllink($link); $imglink=$titlelink=hreflink($link); $rmlink=$row['url']; $text=preg_replace('/('.implode('|',$words).')/iu',"$1",$row['description'].'
'.$row['url']); $row['autor']=($row['website']?''.$row['business'].'':$row['business']); $nof=1; $titel='Inspiration'; }else if($rows->inhaltname=='vendors'){ $row=mA("SELECT * FROM `vendors` a WHERE id=".$rows->inhaltid,$qn); $rmlink=hreflink(["nav"=>'vendor',"titel"=>'portfolio-l-'.$row['business'].'-l-'.$row['id']]); $titel=$row['business']; $row['autor']=trim($row['firstname'].' '.$row['lastname']); $titlelink=$imglink=$row['website']; $img=$row['profileimage']; $readmore='Open Profile'; $socials=explode(';','email:mailto:'.$row['email'].';'.(empty($row['website'])?'':'www:'.$row['website'].';').$row['socials']); $ss=''; foreach($socials as $k=>$v){ $v=explode(':',$v,2); if(!empty($v[1])){$ss.='';} } $text="
$ss
".($row['phone']?'Phone - '.$row['phone']:'').'

Services Offered:
'.implode(', ',array_map('trim',explode(';',ucwords(strtolower($row['offers']))))).'

'; }else if($rows->inhaltname=='textinhalt'){ $row=mA("SELECT a.*,b.`rubrik`,c.`name` FROM `textinhalt` a JOIN `inhalt` b ON a.inhalt=b.id JOIN `rubrik` c ON c.`id`=b.`rubrik` WHERE a.id=".$rows->inhaltid,$qn); $titlelink=$rmlink=hreflink(["nav"=>$row['rubrik'],"titel"=>$row['name']]); $titel=$row['name']; $text=get_text($words,$row['text']); } if(!empty($img)){ $img=current(getImgLinks($img)); $img=$img['link']; }else if(!empty($row['video'])){ $img='video'.$row['video']; } $readmore=@$readmore?:'Read More'; $nof=isset($nof)?' rel="nofollow"':''; $val.='
'.(isset($img)?'':'').'

'.(@$titel?:$row['titel']).'

'.(!empty($row['autor'])?'
By:
':'').$text.(!empty($flink)?'':'').'

'.$readmore.'

'; unset($img,$flink,$row); } } $opt=$sor=''; $sel=[$c=>' class="sel"']; foreach([''=>'All of Wedding Chicks','blog'=>'Just the Blog','trendings'=>'Trending','inspirations'=>'Wedding Inspiration','printouts'=>'Free Printables','vendors'=>'Wedding Vendors','textinhalt'=>'FAQ / Policy / Other'] as $k=>$v){ $opt.='
  • $v
  • "; } return '
    '.$val.'
    Load more Results'; }

    Wedding Chicks on Zazzle