Welcome Guest, Not a member yet? Register   Sign In
How do I create a simple site search?
#1

[eluser]design_shuffle[/eluser]
Hi,

I am building my first codeigniter app. The client wishes to have a search box in the header of the site. The idea being a user enters a query, hits enter, the whole db is queried and then the user is presented with a results page with clickable items.

I have looked through the CI forum, wiki and user guide but cannot find a suitable answer. Is this possible?, if so could someone please point me in the right direction.

If this isn't possible, could someone suggest an alternative approach?


Thanks
Dan
#2

[eluser]mddd[/eluser]
Of course it is possible. But the solution depens very much on what kinds of information you are storing in the site. You'll have to create a query (or multiple queries) that look for the specified word in all the relevant tables and fields. And then, you'll probably want to format the results in different formats. For instance, if information is found in a news post, you'll want to show some text from that post and provide a link to it; if information is found in the list of branches for your company, you'll show the branche address in the search results..

So: first think of which tables and fields are relevant; search in them; present the results in a logical manner.
#3

[eluser]design_shuffle[/eluser]
Thanks for the reply.

The client sells chemicals, in some tables there are thousands of records and about 10 tables in total.

I am quite a novice programmer, do you know where I could find any tutorials/examples showing how to create such a controller?

Thanks
#4

[eluser]FrancoNoronha[/eluser]
Dude... i found this site... it may help you!
Search CI App
#5

[eluser]LuckyFella73[/eluser]
I think the hardest part with this is to create a good database structure.
All the pages the user may found in a result list have to be stored in db
and you have to build a system where you can link to the pages from result list.

If you are just searching in a area of the site - for example you have a news list
and get the detail view when clicking at a row then a search function is quite
easy. But when you want to search through the whole site and it have to be
possible to find every page that exists then it gets a bit harder ..
#6

[eluser]design_shuffle[/eluser]
[quote author="FrancoNoronha" date="1276204589"]Dude... i found this site... it may help you!
Search CI App[/quote]

Thanks for this!




Theme © iAndrew 2016 - Forum software by © MyBB