images rotator

Discussion in 'Scripts' started by xbegin, Aug 5, 2006.

  1. #1
    Hello
    i use http://alistapart.com/articles/betterrotator for thumb rotator
    and i have a search file with below code , i want text links result with pics , where i must write <?php showImage(); ?> on below cods , and if you have better thumb rotator code that works with below code please guide me
    <?php
    // script: search.php
    // requires PHP 4.3.x with XML extension
    // version: 2.0
    
    include_once('config.php');
    include_once('socket.php');
    
    @session_start();
    
    if (isset($_REQUEST['id']) && $_REQUEST['id']){
      $aff_id=(int)$_REQUEST['id'];
    }elseif (isset($_SESSION['affiliate_id'])){
      $aff_id=(int)$_SESSION['affiliate_id'];
    }else{
      $aff_id=$aid;
    }
    
    if (isset($_REQUEST['said']) && $_REQUEST['said']){
      $sub_aff_id=$_REQUEST['said'];
    }elseif (isset($_SESSION['sub_affiliate_id'])){
      $sub_aff_id=$_SESSION['sub_affiliate_id'];
    }else{
      $sub_aff_id='';
    }
    
    $_SESSION['affiliate_id']=$aff_id;
    $_SESSION['sub_affiliate_id']=$sub_aff_id;
    
    $ip=$_SERVER['REMOTE_ADDR'];
    
    $keyword='';
    if (isset($_REQUEST['q'])){
      $keyword=$_REQUEST['q'];
    }
    
    if (isset($_REQUEST['qq'])){
      $keyword=$_REQUEST['qq'];
    }
    
    $language=isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? rawurlencode($_SERVER['HTTP_ACCEPT_LANGUAGE']) : '';
    
    $feed_url=sprintf($feed_url,$aff_id,rawurlencode($sub_aff_id),$ip,rawurlencode($keyword),rawurlencode('http://'.$_SERVER['HTTP_HOST']).'/',$language,$auth);
    $feed_index=-1;
    $feed_data=array();
    $keywords_related=array();
    $keywords_premium=array();
    $redirect_url='';
    $status='OK';
    
    function XMLParser_se($parser,$name,$attrs){
      global $feed_data,$feed_index,$cd,$kwa,$status;
      $cd=''; 
      if ($name=='RECORD'){
        $feed_index++;
        $feed_data[]=array();
    	}elseif($name=='RESULT'){
    		$status=$attrs['STATUS'];
      }elseif($name=='BID'){
        $cd='bid';
        $feed_data[$feed_index]['showbid']=$attrs['SHOWBID'] ? 1 : 0;
      }elseif($name=='TITLE'){
        $cd='title';
      }elseif($name=='DESCRIPTION'){
        $cd='desc';
      }elseif($name=='URL'){
        $cd='url';
      }elseif($name=='CLICKURL'){
        $cd='clickurl';
      }elseif($name=='RELATED'){
        $kwa=0;
      }elseif($name=='PREMIUM'){
        $kwa=1;
      }elseif($name=='NAME'){
        $cd='keyword';
      }elseif($name=='REDIRECT'){
        $cd='redirect';
      }
    
    }
    
    function XMLParser_ee($parser,$name){
      global $cd;
      $cd='';
    }
    
    function XMLParser_cd($parser,$data){
      global $feed_index,$feed_data,$cd,$kwa,$redirect_url;
      if ($cd){
        if ($cd=='keyword'){
          if ($kwa){
            $GLOBALS['keywords_premium'][]=$data;
          }else{
            $GLOBALS['keywords_related'][]=$data;
          }
    		}elseif($cd=='redirect'){
    			$redirect_url.=trim($data);
        }else{
          $i=&$feed_index;
          if (isset($feed_data[$i][$cd])){
            $feed_data[$i][$cd].=$data;
          }else{
            $feed_data[$i][$cd]=$data;
          }
        }
      }
    }
    
    $xml=fetch_feed($feed_url);
    
    $parser=xml_parser_create();
    xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,TRUE);
    xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,TRUE);
    xml_set_element_handler($parser,'XMLParser_se','XMLParser_ee');
    xml_set_character_data_handler($parser,'XMLParser_cd');
    
    xml_parse($parser,$xml);
    xml_parser_free($parser);
    
    if ($status!='OK' && $redirect_url){
    	header('Location: '.$redirect_url);
    	exit;
    }
    
    $nCount = count($feed_data);
    include_once('smarty/MySmarty.class.php');
    $smarty=new MySmarty();
    $smarty->assign_by_ref('aff_id',$aff_id);
    $smarty->assign_by_ref('sub_aff_id',$sub_aff_id);
    $smarty->assign_by_ref('keyword',$keyword);
    $smarty->assign_by_ref('results',$feed_data);
    $smarty->assign_by_ref('top_words',$keywords_premium);
    $smarty->assign_by_ref('related',$keywords_related);
    $smarty->assign_by_ref('nCount',$nCount);
    
    $smarty->display('search.html');
    
    ?>
    Code (markup):

     
    xbegin, Aug 5, 2006 IP
  2. [*-AnOnYmOuS-*]

    [*-AnOnYmOuS-*] Active Member

    Messages:
    253
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #2
    I believe the real showing is in the search.html, may you please show me the code there?.
     
    [*-AnOnYmOuS-*], Aug 5, 2006 IP
  3. xbegin

    xbegin Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    below is search.html code
    <html>
    <head>
    <TITLE>Yourdomain.com - Search Results - <!--{$keyword|escape}--></TITLE>
    <meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
    <style TYPE="text/css">
    <!--
    BODY {font-family: Verdana,Arial; font-size: 10pt }
    a   {font-family:arial,helvetica,sans-serif; font-size:12px; color:#0066CC;}
    a:visited {color:#663399;}
    a:hover   {color:#CC0000;}
    .l    {height:2px; color:#98AEDB;}
    a.topa:link {text-decoration: none; color:#FFFFFF; font-size: 8pt ;}
    a.topa:visited {text-decoration: none; color:#FFFFFF; font-size: 8pt ;}
    a.topa:hover {text-decoration: color:red; font-size: 8pt ;}
    .i    {font-family:verdana; font-size:11px;}
    .hit    {font-weight:bold;}
    .u    {font-size:12px; color:#666666;text-decoration: none;}
    a.t,a.pst   {font-size:14px;}
    td {font-family: Verdana,Arial; font-size: 10pt}
    INPUT.post {
    BORDER-RIGHT: #000000 1px outset; BORDER-TOP: #000000 1px outset; FONT-SIZE: 14px; BORDER-LEFT: #000000 1px outset; COLOR: #00000; BORDER-BOTTOM: #000000 1px outset; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; 
     font-size:10px; font-weight: normal
    }
    -->
    </STYLE>
    </head>
    <body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" vlink="#0000CC" bgcolor="#FFFFFF">
    <form name='Search' method='GET' action='search.php'>
    <input type="hidden" name="id" value="<!--{$aff_id}-->">
    <input type="hidden" name="said" value="<!--{$sub_aff_id|escape}-->">
    <table border="0" cellspacing="0" cellpadding="10">
      <tr> 
        <td width="10" valign="top" bgcolor="#EEFFEE">
          <table width="185" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td>
        <!--{if ($related)}-->
          <table border=0 width="176">
            <tr>
            <td colspan=2 align=center>
              <b><font size="3" face="Arial,Helvetica,sans-serif" color="#003333"> Related Searches</font></b><br>
            </td>
            </tr>
            
            <tr><td colspan=2>&nbsp;</td></tr>
        <!--{section name=r loop=$related}-->
            <tr><td width="22"></td><td align=left><a href='search.php?qq=<!--{$related[r]|escape:"rawurl"}-->&id=<!--{$aff_id}-->&said=<!--{$sub_aff_id|escape}-->'><!--{$related[r]|escape}--></a></td></tr>
        <!--{/section}-->
            <tr><td colspan=2>&nbsp;</td></tr>
          </table>
    <BR>
      <!--{/if}-->
          <table border=0 width="176">
            <tr>
            <td colspan=2 align=center>
              <b><font size="3" face="Arial,Helvetica,sans-serif" color="#003333"> Recent Searches</font></b><br>
            </td>
            </tr>
            <tr><td colspan=2>&nbsp;</td></tr>
        <!--{section name=r loop=$top_words}-->
            <tr><td width="22"></td><td align=left><a href='search.php?qq=<!--{$top_words[r]|escape:"rawurl"}-->&id=<!--{$aff_id}-->&said=<!--{$sub_aff_id|escape}-->'><!--{$top_words[r]|escape}--></a></td></tr>
        <!--{/section}-->
            <tr><td colspan=2>&nbsp;</td></tr>
          </table>
            </td>
            </tr>
          </table>
        </td>
        <td valign="top">
        <font face="verdana,sans-serif" size="2">&nbsp;&nbsp;&nbsp;<b><font color="#003333">Search:&nbsp;<input type="text" name="qq" size="15" value="<!--{$keyword|escape}-->" maxlength="100">&nbsp;<input type="submit" value="Search">
          </font></b></font><br>
    <div align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="3"><span style="visibility:hidden;position:absolute;left:0;top:0"><A HREF="/click.php?&qq=<!--{$keyword|escape:"url"}-->&c=2904197719031978">|</A></span></font></div><br><br><br>
    <font face="verdana,sans-serif" size="+1">&nbsp;&nbsp;Top Web Results:</font><BR><BR>
    <hr aligh="left" class="l" noshade="noshade">
    <span class="i">Results 1-<!--{$nCount}--> containing "<span class="hit"><!--{$keyword}--></span>"</span><BR>
    <img SRC='/img/p.gif' WIDTH='1' HEIGHT='10' border='0'>
    <table border="0" cellpadding="0" cellspacing="0">
    <!--{section name=i loop=$results}-->
    <tr>
        <td rowspan="4" valign="top"><!--{$smarty.section.i.index_next}-->.&nbsp;&nbsp;</td>
        <td><a href="<!--{$results[i].clickurl}-->" target="_blank" onMouseOut="window.status='';return true;" onMouseOver="window.status='<!--{$results[i].url|truncate:100:"...":true}-->';return true;" class="t"><!--{$results[i].title}--></a></b></font></td>
    </tr>
    <tr>
        <td><span class="d"><!--{$results[i].desc}--></span><br></td>
    </tr>
    <tr>
        <td><font face="arial, helvetica" size=2><a href="<!--{$results[i].clickurl}-->" target="_blank" onMouseOut="window.status='';return true;" onMouseOver="window.status='<!--{$results[i].url|truncate:100:"...":true}-->';return true;" class="u"><!--{$results[i].url|truncate:70:"...":true}--></a><br></td>
    </tr>
    <tr>
        <td><img SRC='/img/p.gif' WIDTH='1' HEIGHT='10' border='0'></td>
    </tr>
    <!--{sectionelse}-->
    <tr>
        <td>No Results</td>
    </tr>
    <!--{/section}-->
    </table>
    <span class="i">Results 1-<!--{$nCount}--> containing "<span class="hit"><!--{$keyword}--></span>"</span>
    <hr aligh="left" class="l" noshade="noshade">
    Not satisfied with your results? <a href="http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=<!--{$keyword}-->">Try Google</a>
    <center>
    <br><br><center><br> &copy; 2003 Yourdomain.com, Inc. All Rights Reserved
    </center>
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    Code (markup):
     
    xbegin, Aug 5, 2006 IP
  4. [*-AnOnYmOuS-*]

    [*-AnOnYmOuS-*] Active Member

    Messages:
    253
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Err.. the code is kind of obvious..

    This line is in a loop, where it is printed for each result, and all those variables between <!-- and --> are vaiables that were set in search.PHP . So what you will have to do is loop through showimage() untill you get all the image urls, then put them into an array, which is set by
    $smarty->assign_by_ref() then just put it with that loop.

    Sorry w/man, I'm really busy right now and couldn't modify the source to your needs..
     
    [*-AnOnYmOuS-*], Aug 5, 2006 IP
  5. xbegin

    xbegin Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    oh man i am very poor about php and i can't understand it , please only give me a code that i can copy and paste to file
     
    xbegin, Aug 5, 2006 IP
  6. xbegin

    xbegin Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Can you give me code please :confused:
     
    xbegin, Aug 5, 2006 IP
  7. xbegin

    xbegin Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Noone Cant help ? :confused: :eek:
     
    xbegin, Aug 5, 2006 IP