Multi-Search Results - Adding Detail

7 posts by 2 authors in: Forums > CMS Builder
Last Post: October 27, 2008   (RSS)

Hi, Dave -

Perhaps you can help me with another little teaser...?!

I'm trying to add some more detail to my multi-search results page. Currently the search is designed to pull data from 4 different tables. For simplicity we'll call them:

Boats
Cars
Bikes
Trucks

The results page lists the returned data as you might expect:

Title
Summary, blah-blah, blah-blah, blah-blah.
more...

Now, in an attempt to provide the user with more info I would like to present the results like this:

Title [menuName]
Summary, blah-blah, blah-blah, blah-blah.
more...

By inserting the menuName after the Title I can show the visitor the parent section from which each result was pulled. Admittedly this may not be necessary in the cars, boats, bikes example - but it could be an important indicator when the sections are not so neatly defined.

How do I work the menuName into the code?

:0/

Perchpole

Re: [Perchpole] Multi-Search Results - Adding Detail

By Dave - October 27, 2008

Hi Perchpole,

There's no easy way to do that with multisearch. It's limited to just the title and summary fields.

Options would be to:

1) Add some functionality to multiSearch() to support more fields - this would require some custom programming.

2) Considering storing all your data in a single table for a pulldown for (Boats, Cars, Bike, etc).

3) If the menuname is fixed you could add code to display it like so:

<?php if ($record['title'] == 'Boats'): ?>
Boats Menu Name
<?php endif; ?>

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Multi-Search Results - Adding Detail

Hi, Dave -

Hmmm, that's a shame. I've already used the "single table" method on one of my other sites. I agree it is far easier to display additional information using that method. However, this particular instance concerns my very first CMSB site which has a huge product catalogue spread over many different tables. I'm certainly not going to re-enter all of the data into a new, single table! It's for precisely these reasons why I would like the search result to show more information to the user.

Here's a thought...

All of the html files relating to each of the different sections (tables) are located in seperate folders. That means that when the search returns a link to an item it includes the name of the parent folder. Can we not use this to set-up an if, elseif sequence, such as...

if [_link] contains [folder_name] then do this...

elseif [_link] contains [other_folder_name] then do this...

etc...


or some such thing?

:0\

Perch

Re: [Perchpole] Multi-Search Results - Adding Detail

By Dave - October 27, 2008

Hi Perch,

Sure, we could give that a try. Can you give me a list of some example folder names and the output you'd like? Then my sample code will be more relevant.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Multi-Search Results - Adding Detail

Hi, Dave -

Thanks for giving-it-a-go!

The 4 folders are:

accessory
classic
gunpak
restricted

(It's military model web site: http://www.mmsmodels.co.uk)

I'm happy to play with the output myself. I just can't get my head around the code that would scan the link for the folder name.

:0)

Perch

Re: [Perchpole] Multi-Search Results - Adding Detail

By Dave - October 27, 2008

Try this:

<?php if (strpos($record['_link'], 'accessory')): ?>
Matched accessory
<?php endif ?>

<?php if (strpos($record['_link'], 'classic')): ?>
Matched classic
<?php endif ?>

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com