Search result with preview and adsense

Get general PHP programming help here.

Search result with preview and adsense

Postby DUQUE » 11/07/2006 8:18 am

Search result with Preview, Open in new Window and Adsense



Code: Select all
<br/>

<table width="100%"  border="0">
  <tr>
     <td width="10%" valign="top" style="border-right:1px solid #cccccc;">
<script type="text/javascript"><!--
google_ad_client = "pub-4866131281566134";
google_ad_width = 160;
google_ad_height = 600;
google_ad_format = "160x600_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></td>
    <td width="80%">
      <?
extract($search_results);
?>
      <?if ($search_results['did_you_mean']){?>
      <div id="did_you_mean"> Quiz&aacute;s quiso decir: <a href="<?='search.php?query='.quote_replace(addmarks($search_results['did_you_mean'])).'&search=1'?>">
        <?=$search_results['did_you_mean_b']; ?>
      </a>? </div>
      <? }?>
      <?if ($search_results['ignore_words']){?>
      <div id="common_report">
        <?while ($thisword=each($ignore_words)) {
      $ignored .= " ".$thisword[1];
   }      
   $msg = str_replace ('%ignored_words', $ignored, $sph_messages["ignoredWords"]);
   echo $msg; ?>
      </div>
      <? }?>
      <?if ($search_results['total_results']==0){?>
      <div id ="result_report">
        <?
      $msg = str_replace ('%query', $ent_query, $sph_messages["noMatch"]);
      echo $msg;
      ?>
      </div>
      <? }?>
      <?if ($total_results != 0 && $from <= $to){?>
      <div id ="result_report">
        <?
   $result = $sph_messages['Results'];
   $result = str_replace ('%from', $from, $result);
   $result = str_replace ('%to', $to, $result);
   $result = str_replace ('%all', $total_results, $result);
   $matchword = $sph_messages["matches"];
   if ($total_results== 1) {
      $matchword= $sph_messages["match"];
   } else {
      $matchword= $sph_messages["matches"];
   }

   $result = str_replace ('%matchword', $matchword, $result);   
   $result = str_replace ('%secs', $time, $result);
   echo $result;
   ?>
      </div>
      <? }?>
      <?if (isset($qry_results)) {
?>
      <div id="results">
        <!-- results listing -->
        <?foreach ($qry_results as $_key => $_row){
      $last_domain = $domain_name;
      extract($_row);
      if ($show_query_scores == 0) {
         $weight = '';
      } else {
         $weight = "[$weight%]";
      }
      ?>
        <? if ($domain_name==$last_domain && $merge_site_results == 1 && $domain == "") {?>
        <div class="idented">
          <?}?>
          <b>
          <?=$num?>
          .</b>
          <?=$weight?>
          <a  href="<?=$url?>" class="title" title="<?=$url?>">
          <?=($title?$title:$sph_messages['Untitled'])?>
          </a> <b><a href="<?=$url?>" title="Abrir enlace en una ventana nueva" target="_blank"><img src="http://www.seadir.com/templates/standard/nw.gif" border="0""></a></b>

          <br/>
          <div class="description">
            <?=$fulltxt?>
          </div>
          <div class="url">
            <?=$url2?>
-
              <?=$page_size?>
                           <img src="http://www.seadir.com/images/p.gif" border="0""> <a class="previewlink" href="http://<?=$domain_name?>"">Vista Previa</a> </p>
          </div>
          <? if ($domain_name==$last_domain && $merge_site_results == 1 && $domain == "") {?>
    [ <a href="<?='search.php?query='.quote_replace(addmarks($query)).'&search=1&results='.$results_per_page.'&domain='.$domain_name?>">M&aacute;s resultados para
    <?=$domain_name?>
  </a> ] </div class="idented">
        <?}?>
        <br/>
        <? }
}?>
        <!-- links to other result pages-->
        <?if (isset($other_pages)) {
   if ($adv==1) {
      $adv_qry = "&adv=1";
   }
   if ($type != "") {
      $type_qry = "&type=$type";
   }
?>
        <div id="other_pages">
          <?=$sph_messages["Result page"]?>
          :
          <?if ($start >1){?>
          <a href="<?='search.php?query='.quote_replace(addmarks($query)).'&start='.$prev.'&search=1&results='.$results_per_page.$type_qry.$adv_qry.'&domain='.$domain?>">
          <?=$sph_messages['Previous']?>
          </a>
          <? }?>
          <? foreach ($other_pages as $page_num) {
            if ($page_num !=$start){?>
          <a href="<?='search.php?query='.quote_replace(addmarks($query)).'&start='.$page_num.'&search=1&results='.$results_per_page.$type_qry.$adv_qry.'&domain='.$domain?>">
          <?=$page_num?>
          </a>
          <?} else {?>
          <b>
          <?=$page_num?>
          </b>
          <? }?>
          <? }?>
          <?if ($next <= $pages){?>
          <a href="<?='search.php?query='.quote_replace(addmarks($query)).'&start='.$next.'&search=1&results='.$results_per_page.$type_qry.$adv_qry.'&domain='.$domain?>">
          <?=$sph_messages['Next']?>
          </a>
          <? }?>
        </div>
        <?}?>

        <div id="powered_by">
          <!--If you want to remove this, please donate to the project-->
          <?poweredby()?>
        </div>
    </div></td>
   <td width="10%" valign="top" style="border-left:1px solid #cccccc;">
<script type="text/javascript"><!--
google_ad_client = "pub-4866131281566134";
google_ad_width = 160;
google_ad_height = 600;
google_ad_format = "160x600_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></td>
  </tr>
</table>


<td width="100%" align="left"><div id="results"></div>



previewbubble.js put in homedir

Code: Select all
/*
    WebSnapr - Preview Bubble Javascript
    Written by Juan Xavier Larrea
    http://www.websnapr.com - xavier@websnapr.com   
   
*/


// Point this variable to the correct location of the bg.png file
var bubbleImagePath = '/images/bg.png';

// DO NOT EDIT BENEATH THIS
if(typeof Array.prototype.push!="function"){
Array.prototype.push=ArrayPush;
function ArrayPush(_1){
this[this.length]=_1;
}
}
function WSR_getElementsByClassName(_2,_3,_4){
var _5=(_3=="*"&&_2.all)?_2.all:_2.getElementsByTagName(_3);
var _6=new Array();
_4=_4.replace(/\-/g,"\\-");
var _7=new RegExp("(^|\\s)"+_4+"(\\s|$)");
var _8;
for(var i=0;i<_5.length;i++){
_8=_5[i];
if(_7.test(_8.className)){
_6.push(_8);
}
}
return (_6);
}
function bindBubbles(e){
lbActions=WSR_getElementsByClassName(document,"a","previewlink");
for(i=0;i<lbActions.length;i++){
if(window.addEventListener){
lbActions[i].addEventListener("mouseover",attachBubble,false);
lbActions[i].addEventListener("mouseout",detachBubble,false);
}else{
lbActions[i].attachEvent("onmouseover",attachBubble);
lbActions[i].attachEvent("onmouseout",detachBubble);
}
}
}
function attachBubble(_b){
var _c;
if(_b["srcElement"]){
_c=_b["srcElement"];
}else{
_c=_b["target"];
}
var _d=_c.href;
var _e=findPos(_c)[0]+5;
var _f=findPos(_c)[1]+17;
var _10=document.createElement("div");
_10.className="previewbubble";
_10.setAttribute("style","text-align: center; z-index: 99999; position: absolute; top: "+_f+"px ; left: "+_e+"px ; background: url("+ bubbleImagePath +") no-repeat; width: 240px; height: 190px; padding: 0; margin: 0;");
_10.style.width="240px";
_10.style.position="absolute";
_10.style.top=_f;
_10.style.zIndex=99999;
_10.style.left=_e;
_10.style.textAlign="left";
_10.style.height="190px";
_10.style.paddingTop="0";
_10.style.paddingLeft="0";
_10.style.paddingBottom="0";
_10.style.paddingRight="0";
_10.style.marginTop="0";
_10.style.marginLeft="0";
_10.style.marginBottom="0";
_10.style.marginRight="0";
_10.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + bubbleImagePath + "',sizingMethod='image')";
var img=document.createElement("img");
img.setAttribute("style","margin: auto; padding: 0; margin-left: 25px; margin-top: 27px;  border: 0");
img.style.paddingTop="0";
img.style.paddingLeft="0";
img.style.paddingBottom="0";
img.style.paddingRight="0";
img.style.margin="auto";
img.style.marginTop="27px";
img.style.marginLeft="25px";
img.style.marginBottom="0";
img.style.marginRight="0";
img.style.borderTop="0";
img.style.borderLeft="0";
img.style.borderBottom="0";
img.style.borderRight="0";
img.setAttribute("src","http://msnsearch.srv.girafa.com/srv/i?s=MSNSEARCH&r="+_d);
img.setAttribute("width",202);
img.setAttribute("height",152);
img.setAttribute("alt","Seadir");
_10.appendChild(img);
document.getElementsByTagName("body")[0].appendChild(_10);
}
function detachBubble(_12){
lbActions=WSR_getElementsByClassName(document,"div","previewbubble");
for(i=0;i<lbActions.length;i++){
lbActions[i].parentNode.removeChild(lbActions[i]);
}
}
if(window.addEventListener){
addEventListener("load",bindBubbles,false);
}else{
attachEvent("onload",bindBubbles);
}
function findPos(obj){
var _14=curtop=0;
if(obj.offsetParent){
_14=obj.offsetLeft;
curtop=obj.offsetTop;
while(obj=obj.offsetParent){
_14+=obj.offsetLeft;
curtop+=obj.offsetTop;
}
}
return [_14,curtop];
}



:wink:
DUQUE
 
Posts: 15
Joined: 10/26/2006 1:08 am


Postby trapprs » 11/30/2006 10:31 pm

any way to do this in english? and without the google adsense? as i will soon being using phpADSnew to advertise on the pages...

thanks
trapprs
 
Posts: 67
Joined: 11/30/2006 5:15 pm


Return to PHP Help

Who is online

Users browsing this forum: No registered users and 0 guests

cron