Graphic Design Forum and Web Design Forum  

Go Back   Graphic Design Forum and Web Design Forum »Web Design Forum »Search Engines

Notices

Search Engines Search Engines Forum & SEO Forum


Reply
 
LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 30-09-2007, 11:23 AM
PR Design's Avatar
CSS Wizardry
 
Join Date: May 2007
Location: Yorkshire, England
Gender: Male
Posts: 3,299
Default Search engine script

Just written a PHP search engine script for use by developers so that they can put a keyword based search engine on their sites.

I've posted it as a tutorial on the GDF blog.

Hope you like it :)
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati Share This Article & VoteReddit! Wong this Post!Stumble this Post!RSS Share on FacebookForum Netvibes Page
Reply With Quote
  #2 (permalink)  
Old 30-09-2007, 02:56 PM
LeadMagnet's Avatar
Mr. Tambourine Man
 
Join Date: Jun 2007
Location: Ireland
Gender: Male
Posts: 1,381
Default

Seems a bit tedious really. Entering in so many keywords.
Here's a suggestion. Instead of entering in all those keywords, get it to parse your html files instead and auto-generate the keywords from that at runtime.

So, you have all of a particular file loaded into an array. Convert it all to 1 string, remove new line characters and carriage returns (maybe you can put it directly into a string, i'm not sure, i've never tried).

Make use of the explode() function to split up your string at every '<'.
By using the foreach function and a variable (set it to 1 every time the current array value is '<' and 0 when it's not), for every array element that's NOT '<' and the variable marker is set to 0, you add the current array element to a new array. (you'll need to add more marker variables too to also remove text that would be inside 'script and style tags and other things you don't want to be used for your search engine.

Now, convert that new array to a string, explode at '>', use foreach to add all elements EXCEPT '>' to a new array.

You would have it ignore most tags (starting with a < and ending with >, for image tags, get it enter the alt attribute and/or the title attribute into an array.
Get it to ignore everything inside a script, style or php tag, possibly also anchor tags. Go through your website's code to find anything else i might not have thought about that could cause problems.
Perhaps remove common terms like "The" "of" "and" etc... or anything you don't want to be considered.


For the most part, you now have a list of all search keywords from a particular html file stored in an array. Use whatever method you like to go though that array and match up the words to your search terms. etc etc... you get the idea.



If any of that's too confusing, let me know and i'll try to explain.
Yes, i know this is a bit more complicated than just entering in keywords manually, but it's dynamic. The code can be re-used anywhere so it'll save you time in the long run.


*edit*, whoops, broke the forum with that spiel. Fixed now.
__________________
Subtlety is my middle name... and first and last in case you didn't get the point.

Last edited by LeadMagnet; 30-09-2007 at 03:20 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati Share This Article & VoteReddit! Wong this Post!Stumble this Post!RSS Share on FacebookForum Netvibes Page
Reply With Quote
  #3 (permalink)  
Old 30-09-2007, 03:25 PM
LeadMagnet's Avatar
Mr. Tambourine Man
 
Join Date: Jun 2007
Location: Ireland
Gender: Male
Posts: 1,381
Default

Another useful function for you is str_replace.
You can use it to remove whitespace (you'll need to do that), carriage returns and new line characters ('\n' and '\r')
__________________
Subtlety is my middle name... and first and last in case you didn't get the point.
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati Share This Article & VoteReddit! Wong this Post!Stumble this Post!RSS Share on FacebookForum Netvibes Page
Reply With Quote
  #4 (permalink)  
Old 30-09-2007, 05:55 PM
PR Design's Avatar
CSS Wizardry
 
Join Date: May 2007
Location: Yorkshire, England
Gender: Male
Posts: 3,299
Default

Ahem, wow. I've only just started to scratch the surface of PHP and was just trying to put some use to the switch function. I'll take a look at that though. Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati Share This Article & VoteReddit! Wong this Post!Stumble this Post!RSS Share on FacebookForum Netvibes Page
Reply With Quote
  #5 (permalink)  
Old 01-10-2007, 11:39 PM
LeadMagnet's Avatar
Mr. Tambourine Man
 
Join Date: Jun 2007
Location: Ireland
Gender: Male
Posts: 1,381
Default

Well it's just something to try if you feel like it.
The most difficult part for alot of people is coming up with the how (which i've just done for you), not the actualy coding itself.
Just refine that layout a bit and try it out when you have the time.
You could get it completed in a night.

If you wanted to save server memory and processor power, you could run this script yourself every time your page is updated and have it output the keywords to a new file.
Then when a search is called, that file is loaded into an array etc etc etc

In fact, i might make this myself if i have time :P
__________________
Subtlety is my middle name... and first and last in case you didn't get the point.

Last edited by LeadMagnet; 01-10-2007 at 11:42 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati Share This Article & VoteReddit! Wong this Post!Stumble this Post!RSS Share on FacebookForum Netvibes Page
Reply With Quote
  #6 (permalink)  
Old 02-10-2007, 07:44 AM
PR Design's Avatar
CSS Wizardry
 
Join Date: May 2007
Location: Yorkshire, England
Gender: Male
Posts: 3,299
Default

Ok cool. I'll do a bit of reading and see what's what. Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati Share This Article & VoteReddit! Wong this Post!Stumble this Post!RSS Share on FacebookForum Netvibes Page
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Search Engine Optimisation - my site vivabensmith Search Engines 9 06-04-2008 05:39 PM
search engine friendliness flick Flash Forum 3 30-01-2008 05:23 AM
Icon Search Engine Mack General Web Design Forum 3 10-12-2007 10:20 AM
Filestube - Media Search Engine Toon Search Engines 1 28-08-2007 01:08 PM
PHP Search Script Nuttycoder Graphic Design Tutorials 4 09-04-2007 03:53 PM


All times are GMT. The time now is 05:22 AM.



Estetica Design Forum's Privacy Policy
Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC5