"Search in..." option display categories of every

Please report bugs here!

Moderator: Thorsten

Post Reply
francois
Posts: 5
Joined: Mon Aug 14, 2006 1:31 pm

"Search in..." option display categories of every

Post by francois »

Hello,

In the search page you can use the option "Search in ..." and choose the folder in which you want make a search.

The select field display all the categories of all the languages.
If i am under the English part, i have the french categories too.

You need to have only the categories of the language you are using.

If it is a feature, is it possible to display only categories fo the current language ? And i can do that ?

:)
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Re: "Search in..." option display categories of ev

Post by matteo »

Hi,
francois wrote:If it is a feature, is it possible to display only categories fo the current language ? And i can do that ?
it's a supposed to be a feature (the search is perfomed upon any faq w/o any constraint on the language) but we're interested in examing scenarios in which this feature (the search over all faq contents) becomes something like a "bug".

If you want to limit the categories list to those ones for the current language, locate, backup and open the [PATH_TO_PMFINSTALL]/search.php file and move the lines below from:

Code: Select all

// HACK: (re)evaluate the Category object w/o passing the user language
//       so the result set of a Search will have the Category Path
//       for any of the multilanguage faq records and the Category list
//       on the left pane will not be affected
$tree = new Category();
$tree->transform(0);
to:

Code: Select all

// HACK: (re)evaluate the Category object w/o passing the user language
//       so the result set of a Search will have the Category Path
//       for any of the multilanguage faq records and the Category list
//       on the left pane will not be affected
//$tree = new Category();
//$tree->transform(0);
and then you need to modify the searchEngine() function in order to limit the search result set to the current language: locate, backup and open the [PATH_TO_PMFINSTALL]/inc/functions.php and move these lines below from:

Code: Select all

...
    global $db, $sids, $tree, $PMF_LANG, $PMF_CONF;
...
    if ('%' == $category) {
        $cond = array(SQLPREFIX."faqdata.active" => "'yes'");
    } else {
        $cond = array(SQLPREFIX."faqdata.active" => "'yes'",
                      SQLPREFIX."faqcategoryrelations.category_id" => $category);
    }
...
to:

Code: Select all

...
    global $db, $sids, $tree, $PMF_LANG, $PMF_CONF, $LANGCODE;
...
    if ('%' == $category) {
        $cond = array(SQLPREFIX."faqdata.active" => "'yes'", "faqdata.lang" => $LANGCODE);
    } else {
        $cond = array(SQLPREFIX."faqdata.active" => "'yes'",
                      "faqdata.lang" => $LANGCODE,
                      SQLPREFIX."faqcategoryrelations.category_id" => $category);
    }
...
Thanks in advance for any feedback coming from your multilanguage scenarios.

Regards,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
francois
Posts: 5
Joined: Mon Aug 14, 2006 1:31 pm

Post by francois »

Thanks a lot Matteo for your help.

No pb, if i have any other feedback about my multilanguage i will send it to you.

For the moment everything is working super fine.
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Post by matteo »

Hi,
francois wrote: No pb, if i have any other feedback about my multilanguage i will send it to you.

For the moment everything is working super fine.
Thanks!
We're evaluating if the behaviour you've requested should be the default behaviour without hacking (a little bit) the code as reported above.
A reason against your request is that you cannot have the possibility of letting the user propose a translation for a faq (a feature that will be coded into PMF 2.0.x) just 'cause he couldn't simply see other then a single language faq set.

Any hint from the community to let us take the right decision will be appreciated :).

Regards,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
Post Reply