You are here:  » search word


search word

Submitted by searley on Sat, 2006-08-26 10:22 in

In search.php i would like to show just the work searched

if i use $q and a category is used the i get category:search:

where i want just search,

i figured somewhere along the lines of

database_safe($parts[0])

this is ok when just the search is used, but changed to the word 'category' when a category is used

in which case database_safe($parts[1]) should be show (category name)

can you advise how to do this?

Submitted by support on Sat, 2006-08-26 10:53

Hi,

The easiest thing to do would be to create a variable called $search that checks for $parts[1], and if set uses that value otherwise uses $parts[0]. On line 33 of search.php look for the following code:

    $parts = explode(":",$q);

...and add the following line immediately after it; just before the switch() statement:

   $search = ($parts[1]?$parts[1]:$parts[0]);

Then you can refer to $search in the rest of the script to just get the word on its own.

Cheers,
David.