Jump to content

searching your own website?


kellz

Recommended Posts

I saw lots of websites have the search thing that only searches their own website for keywords and I tried to make one, but, not to my surprise it didn't go as planned for long^^

 

How do the "real" search thingies work? like on this site  ??? i want 1!  :-[

Link to comment
Share on other sites

you would have to redesign your cms or apply additional steps.

if your cms stores all the content in a databasing of some sort you can use a query with the "like" type to get what you want.

If you cms does not store your data like so you will need to self index  your pages exactly like google does and then use those indexes as your search pool.

 

It can be done, but if you don't have a strong cms behind it forget it cause selfindexing your site is difficult.

Link to comment
Share on other sites

i guess that goes this way..

 

sample you use this key words 

 

$yourquery = 'select * from table where 1=1  ';
$var = trim('am i  teng');
$array = explode($var);
$srch = '';
foreach($array as $val){
$srch .= "  OR yourfieldhere  like '%".$val."%'";
}

if ($srch != $srch){
      mysql_query ($yourquery.$srch);//do other stuff here
}
else{
//some stuff here
}

simple but should give an idea !

Link to comment
Share on other sites

Yes I think the most simple but causes alot more data storage is keywords as said above. example...

 

1.Create database table called keywords_search_site create fields as follows

 

ID

keyword

description

link

 

2. create the form for searching

 

3. Create the processing code for the search which should break up the search words into an array and search the database for each word of the array.

 

4. Show the results on screen as...

 

Description and then a link to the page which holds what they looked for.

 

 

Hope that helps the theory side of it. If you want any code mucking up just ask.

 

 

Regards

 

Distant Storm

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.