MultiSearch

50 posts by 11 authors in: Forums > CMS Builder
Last Post: August 14, 2012   (RSS)

By Dave - May 23, 2008

Juan,

Thanks for the clarification. I checked again and see that problem. You only need this line once at the top:

$searchTables = array();

leave the first one and remove all the rest and it will search all your tables.

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

Re: [Dave] MultiSearch

By jposwald - May 23, 2008

Dave sorry but I don't understand,

Do I have to delete as is?:

<?php
require_once "/home/content/w/w/t/wwtrainingsk2/html/cmsAdmin/lib/viewer_functions.php";
$searchOptions = array();
$searchOptions['keywords'] = @$FORM['q'];
$searchOptions['perPage'] = "20";
$searchOptions['debugSql'] = "0"; $searchTables = array();
$searchTables['cursos_el_'] = array(
'viewerUrl' => 'EL_Listado_ver.php',
'titleField' => 'nombre',
'summaryField' => 'descripcion',
'searchFields' => array('nombre','descripcion'),
); $searchTables = array();
$searchTables['cursos_pr_'] = array(
'viewerUrl' => 'PR_Listado_ver.php',
'titleField' => 'nombre',
'summaryField' => 'descripcion',
'searchFields' => array('nombre','descripcion'),
);

$searchTables = array();
$searchTables['cursos_en_'] = array(
'viewerUrl' => 'EN_Listado_ver.php',
'titleField' => 'nombre',
'summaryField' => 'descripcion',
'searchFields' => array('nombre','descripcion'),
);

$searchTables = array();
$searchTables['soluciones_'] = array(
'viewerUrl' => 'Soluciones_ver.php',
'titleField' => 'id',
'summaryField' => 'descripcion',
'searchFields' => array('id','descripcion'),
);

$searchTables = array();
$searchTables['certificaciones_'] = array(
'viewerUrl' => 'Certificaciones_ver.php',
'titleField' => 'nombre',
'summaryField' => 'descripcion',
'searchFields' => array('nombre','descripcion'),
);
list($searchRows, $searchDetails) = searchMultipleTables($searchTables, $searchOptions);
?>
And only put this?<?php
require_once "/home/content/w/w/t/wwtrainingsk2/html/cmsAdmin/lib/viewer_functions.php";
$searchOptions = array();
$searchOptions['keywords'] = @$FORM['q'];
$searchOptions['perPage'] = "20";
$searchOptions['debugSql'] = "0";
[font "Verdana"]$searchTables = array(); list($searchRows, $searchDetails) = searchMultipleTables($searchTables, $searchOptions);
?>

Re: [Dave] MultiSearch

By jposwald - May 23, 2008

Yesss, great thank you Dave!!!

By jposwald - May 26, 2008

Dave, can I have dynamic links in Search.php? I mean make an if condition in each "viewer url" variable.

Thank you!

By Dave - May 26, 2008

No, because there's no extra fields to test (if I understand correctly). But another person is asking for that too so I'm going to see about adding it.

If you could specify an extra field (extraField1) to load from each table would that be enough for you to do your if conditions and create dynamic links?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] MultiSearch

By richo - May 27, 2008

I have the search working fine but if the data is listed say 10 per page, then when you go to the second page for example, the search says "Results page '2' not found, [url "http://theatremusicshop.com/dlg/cart/mp3s.php?q=hood&page=1"]start over >>[/#0066cc][/url]." Is there a way to stop this please?



Thanks



John

Re: [richo] MultiSearch

By Dave - May 27, 2008

Hi John,

It looks like that might be because you have two list viewers on the same page. One for search results and one for MP3s. So when you click "next" the the MP3's it puts &page=2 in the url and both viewers try to show page 2, even if it doesn't exist.

One solution might be to put one of the list viewers (the MP3s) in an iframe. Would that work for you? Or you could split up the page some other way.

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

Re: [Dave] MultiSearch

By richo - May 27, 2008

Thanks for the prompt reply. I will try that.

Is there a way that the results can be displayed in the "whateverDetail.php" page as a list rather than individual links in the results page?

Thanks again for your help.

John

Re: [richo] MultiSearch

By Dave - May 27, 2008

Yes, you should just be able to copy the list viewer over to the detail page. I'd start with that and see how it goes.

You might need to add some extra code to the detail page if it's going to be paging through results though because by default it just loads the record number on the end of the url.

See how far you can get with it and let me know when you need help.

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