0

標準の検索モジュールで Joomla 2.5.11 を使用しています。派手なものはありません。development と production の 2 つの兄弟サイトがあります。残念ながら、1 人の (技術に詳しくない)管理者がバックオフィスで何かをしたため、検索が機能しなくなりました。正確にはわかりませんが、彼は自動アップグレード ボタンを使用して、モジュール/プラグインをいじっていた可能性があります。検索テンプレートが視覚的に変わったので気づきましたが、方法がわかりません。

幸いなことに、私はまだ開発サイトで有効な検索を行っています。比較のために。plugins/search、mod_search、components/search 内のすべてのファイルは同一です。PHPエラーはありません。

動作は次のとおりです: * ページに「johndoe」という検索を入力します * Joomla は結果を表示せずにフロントページの index.php?searchword=johndoe にリダイレクトします

コードをログに記録すると、最後に追跡できるのは SearchController ( components/com_search/controller.php ) です。

function search()
{
    [...]

    $searchword = trim(str_replace($badchars, '', JRequest::getString('searchword', null, 'post')));
    // if searchword enclosed in double quotes, strip quotes and do exact match
    if (substr($searchword, 0, 1) == '"' && substr($searchword, -1) == '"') {
        $post['searchword'] = substr($searchword, 1, -1);
        JRequest::setVar('searchphrase', 'exact');
    }
    else {
        $post['searchword'] = $searchword;
    }
    $post['ordering']   = JRequest::getWord('ordering', null, 'post');
    $post['searchphrase']   = JRequest::getWord('searchphrase', 'all', 'post');
    $post['limit']  = JRequest::getUInt('limit', null, 'post');
    if ($post['limit'] === null) unset($post['limit']);

    [...]

    $uri = JURI::getInstance();
    $uri->setQuery($post);
    $uri->setVar('option', 'com_search');

    // index.php?searchword=johndoe&searchphrase=all&Itemid=117&option=com_search

    $this->setRedirect(JRoute::_('index.php'.$uri->toString(array('query', 'fragment')), false));
}

したがって、通常、この URL (index.php?searchword=johndoe&searchphrase=all&Itemid=117&option=com_search) は検索コンポーネントのどこかにつながるはずです。しかし、それは決して見つけられず、代わりにフロントページに直接行きます。SearchModelSearchクラス ( components/com_search/models/search.php )をインスタンス化せずに。

よろしく

4

3 に答える 3

2

templates/Your_Template/html/mod_search/default.php に移動します

変化するaction="index.php"

action="<?php echo JRoute::_('index.php?option=com_search');?>"

例:

<form action="<?php echo JRoute::_('index.php?option=com_search');?>" method="post" class="default-search">
....
</form>
于 2013-12-11T09:52:52.540 に答える
1

この問題は、JoomSef (URL 書き換え用モジュール) の不適切な構成が原因でした。

結果ページをホームページにリンクしました。また、ホームページには結果を表示する場所がありませんでした。実際、検索は機能していましたが、何も表示されませんでした。

JoomSEF > SEF URL の管理に移動し、「option=com_search」URL を探します。

Search => index.php?option=com_search&view=search&Itemid=101

Itemid=101がホームページです。このパラメーターを、このモジュール専用の空のコンテンツ ページであるItemid=114に変更しました。

Search => index.php?option=com_search&view=search&Itemid=114
于 2013-12-11T11:40:27.387 に答える