Jump to content

Help intigrating search into website


chrismcl09

Recommended Posts

Hi there folks. I am new to this whole php thing. My issue if you like may be really simple. I am trying to intigrate the Sphider search engine into the website I have just created. The search engines website is http://www.sphider.eu/ I have the search working, just have no idea how to intigrate it into the site. The coding of the webpage is a static page. The entire pages Code is below:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en">
<head>
<meta name="google-site-verification" content="xruPXCXmt-Ok_8GNcojuegXKNPeId-NYMg6EELALS54" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <title>Team Website</title>

    <script type="text/javascript" src="script.js"></script>

    <link rel="stylesheet" href="style.css" type="text/css" media="screen" />
    <!--[if IE 6]><link rel="stylesheet" href="style.ie6.css" type="text/css" media="screen" /><![endif]-->
    <!--[if IE 7]><link rel="stylesheet" href="style.ie7.css" type="text/css" media="screen" /><![endif]-->
</head>
<body>
<div class="PageBackgroundSimpleGradient">
    </div>
    <div class="Main">
        <div class="Sheet">
            <div class="Sheet-tl"></div>
            <div class="Sheet-tr"></div>
            <div class="Sheet-bl"></div>
            <div class="Sheet-br"></div>
            <div class="Sheet-tc"></div>
            <div class="Sheet-bc"></div>
            <div class="Sheet-cl"></div>
            <div class="Sheet-cr"></div>
            <div class="Sheet-cc"></div>
            <div class="Sheet-body">
                <div class="Header">
                    <div class="Header-jpeg"></div>
                    <div class="logo">
                        <h1 id="name-text" class="logo-name"><a href="#">Team Website</a></h1>
                        <div id="slogan-text" class="logo-text"></div>
                    </div>
                </div>
                <div class="nav">
                	<div class="l"></div>
                	<div class="r"></div>
                	<ul class="artmenu">
                		<li><a href="index.php" class="{ActiveItem}"><span class="l"></span><span class="r"></span><span class="t">Home</span></a></li>
                		<li><a href="links.php"><span class="l"></span><span class="r"></span><span class="t">Links/Logins</span></a></li>
                		<li><a href="numbers.php"><span class="l"></span><span class="r"></span><span class="t">Numbers</span></a></li>
                		<li><a href="configs.php"><span class="l"></span><span class="r"></span><span class="t">Configs</span></a></li>
                		<li><a href="emulators.php"><span class="l"></span><span class="r"></span><span class="t">Emulators</span></a></li>
                		<li><a href="stats.php"><span class="l"></span><span class="r"></span><span class="t">Stats</span></a></li>
                		<li><a href="docs.php"><span class="l"></span><span class="r"></span><span class="t">Doc's/CBT's</span></a></li>
                		<li><a href="forms.php"><span class="l"></span><span class="r"></span><span class="t">Forms</span></a></li>
                		<li><a href="bot.php"><span class="l"></span><span class="r"></span><span class="t">BOT</span></a></li>
                		<li><a href="fun.php"><span class="l"></span><span class="r"></span><span class="t">Fun</span></a></li>
                	</ul>
                </div>
                <div class="contentLayout">
                    <div class="sidebar1">
                        <div class="Block">
                            <div class="Block-tl"></div>
                            <div class="Block-tr"></div>
                            <div class="Block-bl"></div>
                            <div class="Block-br"></div>
                            <div class="Block-tc"></div>
                            <div class="Block-bc"></div>
                            <div class="Block-cl"></div>
                            <div class="Block-cr"></div>
                            <div class="Block-cc"></div>
                            <div class="Block-body">
                                <div class="BlockHeader">
                                    <div class="l"></div>
                                    <div class="r"></div>
                                    <div class="header-tag-icon">
                                        <div class="t">Search</div>
                                    </div>
                                </div><div class="BlockContent">
                                    <div class="BlockContent-body">
                                        <div><form method="get" id="search" action="javascript:void(0)">
                                        <input type="text" value="" name="email" id="s" style="width: 95%;" />
                                        <button class="Button" type="submit" name="search">
                                              <span class="btn">
                                                  <span class="l"></span>
                                                  <span class="r"></span>
                                                  <span class="t">Search</span>
                                              </span>
                                        </button>
                                        </form></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="Block">
                            <div class="Block-tl"></div>
                            <div class="Block-tr"></div>
                            <div class="Block-bl"></div>
                            <div class="Block-br"></div>
                            <div class="Block-tc"></div>
                            <div class="Block-bc"></div>
                            <div class="Block-cl"></div>
                            <div class="Block-cr"></div>
                            <div class="Block-cc"></div>
                            <div class="Block-body">
                                <div class="BlockHeader">
                                    <div class="l"></div>
                                    <div class="r"></div>
                                    <div class="header-tag-icon">
                                        <div class="t">Contact Info</div>
                                    </div>
                                </div><div class="BlockContent">
                                    <div class="BlockContent-body">
                                        <div>
                                              <img src="images/contact.jpg" alt="an image" style="margin: 0 auto;display:block;width:95%" />
                                        <br />
                                        <b>Live Chat</b><br />
                                        <a href="#">Contact Us:</a><br />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="content">
                        <div class="Post">
                            <div class="Post-body">
                        <div class="Post-inner">
                            <h2 class="PostHeaderIcon-wrapper">
                                <span class="PostHeader">Welcome</span>
                            </h2>
                            <div class="PostContent">
                                
                                <p>On this site there is a load of usefull info to help the all helpdesk staff. Primiraly for use for the Team.<br />
                                    
                            </div>
                            <div class="cleared"></div>
                        </div>
                        
                            </div>
                        </div>
                        <div class="Post">
                            <div class="Post-body">
                        <div class="Post-inner">
                            <h2 class="PostHeaderIcon-wrapper">
                            </h2>
                            <div class="PostContent">
                            </div>
                            <div class="cleared"></div>
                        </div>
                        
                            </div>
                        </div>
                    </div>
                    <div class="sidebar2">
                        <div class="Block">
                            <div class="Block-tl"></div>
                            <div class="Block-tr"></div>
                            <div class="Block-bl"></div>
                            <div class="Block-br"></div>
                            <div class="Block-tc"></div>
                            <div class="Block-bc"></div>
                            <div class="Block-cl"></div>
                            <div class="Block-cr"></div>
                            <div class="Block-cc"></div>
                            <div class="Block-body">
                                <div class="BlockHeader">
                                    <div class="l"></div>
                                    <div class="r"></div>
                                    <div class="header-tag-icon">
                                        <div class="t">Latest News</div>
                                    </div>
                                </div><div class="BlockContent">
                                    <div class="BlockContent-body">
                                        <div>
                                                          <p><b>Oct 10, 2009</b><br/>
                                                          All the latest stuff that effects us 
                                                          will show here.<br/>
                                                          </div>                  
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="cleared"></div><div class="Footer">
                    <div class="Footer-inner">
                        <a href="#" class="rss-tag-icon" title="RSS"></a>
                        <div class="Footer-text">
                        <p>Copyright © 2009 Chris McLauchlan. All Rights Reserved.</p>
                        </div>
                    </div>
                    <div class="Footer-background"></div>
                </div>
            </div>
        </div>
        <div class="cleared"></div>
    </div>
</html>

 

Could someone please help me intigrate the search into the site itself? I am even willing to throw someone £10 if they can tell me how. This is a little team site for at work. It is only currently being tested on my machine with WAMP at the moment so the search script is not viewable online I am afraid.

Link to comment
Share on other sites

 

 

This is the HTML  to put in the page(Its static HTML from the demo.php page on its site).

 

<div id="search_box">
<form action="search.php" method="get">
<input type="text" name="query" id="query" size="40" value="" action="include/js_suggest/suggest.php" columns="2" autocomplete="off" delay="1500" />	
<input type="submit" value="Search" />
<input type="hidden" name="search" value="1" />
</form>
<center><a href="search.php?adv=1">Advanced search</a></center>
</div>

 

 

Put this in the head tag of the page you have the above form.

<style type="text/css">
#search_box{
margin-left:auto;
margin-right:auto;
margin-bottom: 10px;
border: 1px solid #58866b;
font-size: 10pt;
padding:10px;
width:350px;
}
</style>

 

And change you META

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

To this!!!

<meta http-equiv="Content-Type" content="text/html; charset=ISO_8859-1" />

You probably do not use UTF-8 , anyhow, most internal interpreter or compiler languages are UTF-16 so too obscure for most people to use rationaly .

Link to comment
Share on other sites

Thanks nicephotog,

 

I now have this working almost perfectly, any ideas how I can get the results to show in the main part of the website rather than it's own seperate page? The code for the results page is as below:

 

<?php 
extract($search_results);
?>

<?php if ($search_results['did_you_mean']){?>
<div id="did_you_mean">
<?php echo $sph_messages['DidYouMean'];?>: <a href="<?php print 'search.php?query='.quote_replace(addmarks($search_results['did_you_mean'])).'&search=1'?>"><?php print $search_results['did_you_mean_b']; ?></a>?
    </div>
<?php  }?>	

<?php if ($search_results['ignore_words']){?>
<div id="common_report">
<?php while ($thisword=each($ignore_words)) {
	$ignored .= " ".$thisword[1];
}		
$msg = str_replace ('%ignored_words', $ignored, $sph_messages["ignoredWords"]); 
echo $msg; ?>
    </div>
<?php  }?>	


<?php if ($search_results['total_results']==0){?>
<div id ="result_report">
	<?php 
	$msg = str_replace ('%query', $ent_query, $sph_messages["noMatch"]);
	echo $msg;
	?>
</div>
<?php  }?>	


<?php if ($total_results != 0 && $from <= $to){?>
<div id ="result_report">
<?php  
$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>
<?php  }?>	


<?php if (isset($qry_results)) {
?>

<div id="results">

<!-- results listing -->

<?php foreach ($qry_results as $_key => $_row){
	$last_domain = $domain_name;
	extract($_row);
	if ($show_query_scores == 0) {
		$weight = '';
	} else {
		$weight = "[$weight%]"; 
	}
	?>
	<?php  if ($domain_name==$last_domain && $merge_site_results == 1 && $domain == "") {?>
	<div class="idented">
	<?php }?>
	<b><?php print $num?>.</b> <?php print $weight?>
	<a href="<?php print $url?>" class="title">	<?php print ($title?$title:$sph_messages['Untitled'])?></a><br/>
	<div class="description"><?php print $fulltxt?></div>
	<div class="url"><?php print $url2?> - <?php print $page_size?></div>
	<?php  if ($domain_name==$last_domain && $merge_site_results == 1 && $domain == "") {?>
		[ <a href="<?php print 'search.php?query='.quote_replace(addmarks($query)).'&search=1&results='.$results_per_page.'&domain='.$domain_name?>">More results from <?php print $domain_name?></a> ]
		</div class="idented">
	<?php }?>
	<br/>
<?php  }?>
</div>
<?php }?>

<!-- links to other result pages-->
<?php if (isset($other_pages)) {
if ($adv==1) {
	$adv_qry = "&adv=1";
}
if ($type != "") {
	$type_qry = "&type=$type";
}
?>
<div id="other_pages">
<?php print $sph_messages["Result page"]?>:
<?php if ($start >1){?>
			<a href="<?php print 'search.php?query='.quote_replace(addmarks($query)).'&start='.$prev.'&search=1&results='.$results_per_page.$type_qry.$adv_qry.'&domain='.$domain?>"><?php print $sph_messages['Previous']?></a>
<?php  }?>	

<?php  foreach ($other_pages as $page_num) {
			if ($page_num !=$start){?>
				<a href="<?php print 'search.php?query='.quote_replace(addmarks($query)).'&start='.$page_num.'&search=1&results='.$results_per_page.$type_qry.$adv_qry.'&domain='.$domain?>"><?php print $page_num?></a>
			<?php } else {?>	
				<b><?php print $page_num?></b>
			<?php  }?>	
<?php  }?>

<?php if ($next <= $pages){?>	
		<a href="<?php print 'search.php?query='.quote_replace(addmarks($query)).'&start='.$next.'&search=1&results='.$results_per_page.$type_qry.$adv_qry.'&domain='.$domain?>"><?php print $sph_messages['Next']?></a>
<?php  }?>	

</div>

<?php }?>


<div class="divline">
</div>
</div>

 

Any ideas?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.