You are not logged in.

Announcement

Forum database was corrupt and an old backup was restored as temporary replacement. Registrations closed until the database is recovered. Please ask questions using the Contact form

#1 03-12-2013 10:43:36

micascotland
Contributors
Registered: 21-06-2013
Posts: 30

Site search box

I would like to create a simple search box to allow visitors to search my site.
Has anyone done this and how would I code it please?

Regards
Mike

Offline

#2 03-12-2013 11:18:20

chrismaliszewski
Contributors
From: Torun, Poland
Registered: 06-05-2013
Posts: 246
Website

Re: Site search box

Maybe other people will tell you how they did it. I can tell you how I'd do it.

1st of all you will need decide do you want to create own search engine and functions or use already created or even you Google engine.
2nd thing is form used for searching. You can either you ajax for real time search or simpler PHP - information about both are in forum and tutorials.
3rd thing, decide where you want to store data for your website, either like it is in PHP files or database.
Either way 4th thing is, how deep you want to search. If you'd like to search only through keywords and/or description you could use file config/pages.php and create function which will search words in tables $pageKeywords and $pageDescriptions and display results. But if you'd like to go deaper and search in pages text, you'll need to create function that will parse PHP code to HTML code and remove HTML tags and than search for words.

Hope this will give you inspiration to solve your problem smile.

Cheers

Offline

Board footer

Powered by FluxBB