Googleのキャッシュページなどでおなじみの検索語マーカー。
検索した語をハイライト表示するあれを、XOOPSに導入してみよう!
※このページの内容は旧バージョンです。導入されるなら検索語マーカー(ver.2)を導入してください。
これら2つのファイルを XOOPS_ROOT_PATH/include/ にアップロードしてください。
// ############## Include common functions file ##############
の上に以下を挿入
// ############# Set query word by nao-pon #############
include_once XOOPS_ROOT_PATH.'/include/getengine.inc.php';
list($getengine_name,$getengine_query)=xoops_se_getengine();
define("XOOPS_QUERY_WORD",$getengine_query);
define("XOOPS_SEARCH_ENGINE_NAME",$getengine_name);
unset ($getengine_name,$getengine_query);
// RMV-NOTIFY
include_once XOOPS_ROOT_PATH . '/include/notification_select.php';
if (isset($xoopsOption['template_main'])) {
if (isset($xoopsCachedTemplateId)) {
$xoopsTpl->assign('xoops_contents', $xoopsTpl->fetch('db:'.$xoopsOption['template_main'], $xoopsCachedTemplateId));
} else {
$xoopsTpl->assign('xoops_contents', $xoopsTpl->fetch('db:'.$xoopsOption['template_main']));
}
} else {
if (isset($xoopsCachedTemplate)) {
$xoopsTpl->assign('dummy_content', ob_get_contents());
$xoopsTpl->assign('xoops_contents', $xoopsTpl->fetch($xoopsCachedTemplate, $xoopsCachedTemplateId),);
} else {
$xoopsTpl->assign('xoops_contents', ob_get_contents());
}
ob_end_clean();
}
を以下のように変更
// RMV-NOTIFY
include_once XOOPS_ROOT_PATH . '/include/notification_select.php';
if (isset($xoopsOption['template_main'])) {
if (isset($xoopsCachedTemplateId)) {
$xoopsTpl->assign('xoops_contents', xoops_word_highlight($xoopsTpl->fetch('db:'.$xoopsOption['template_main'], $xoopsCachedTemplateId),XOOPS_QUERY_WORD));
} else {
$xoopsTpl->assign('xoops_contents', xoops_word_highlight($xoopsTpl->fetch('db:'.$xoopsOption['template_main']),XOOPS_QUERY_WORD));
}
} else {
if (isset($xoopsCachedTemplate)) {
$xoopsTpl->assign('dummy_content', ob_get_contents());
$xoopsTpl->assign('xoops_contents', xoops_word_highlight($xoopsTpl->fetch($xoopsCachedTemplate, $xoopsCachedTemplateId),XOOPS_QUERY_WORD));
} else {
$xoopsTpl->assign('xoops_contents', xoops_word_highlight(ob_get_contents(),XOOPS_QUERY_WORD));
}
ob_end_clean();
}
以下のスタイルを追加。
strong.word0 {
background-color:#FFFF66;
color:black;
}
strong.word1 {
background-color:#A0FFFF;
color:black;
}
strong.word2 {
background-color:#99FF99;
color:black;
}
strong.word3 {
background-color:#FF9999;
color:black;
}
strong.word4 {
background-color:#FF66FF;
color:black;
}
strong.word5 {
background-color:#880000;
color:white;
}
strong.word6 {
background-color:#00AA00;
color:white;
}
strong.word7 {
background-color:#886800;
color:white;
}
strong.word8 {
background-color:#004699;
color:white;
}
strong.word9 {
background-color:#990099;
color:white;
}
以上で、検索エンジンから飛んできた場合と、XOOPSの検索で検索した場合に、各モジュールの出力部分の該当キーワードがハイライト表示されます。
この機能は、PukiWiki 1.4 のコードと PHP-STAT Pro のコードを寄せ集めて実現しています。
各開発者の方に感謝・感謝
| Page name: | XOOPS/検索語マーカー/旧バージョン [ Sended pings(0) ] | |
| Author: | nao-pon | - 2004/02/23 23:05:16 JST(1743d) |
| Last edit: | nao-pon | - 2004/02/23 23:05:16 JST(1743d) |
| Editers: | 登録ユーザー | |
| Back Link: | 通りすがりさん(19d) PukiWiki(252d) 通りすがりさん(782d) XOOPS(905d) PHP(1153d) 検索語マーカー(1495d) 日本語(2109d) | |
ログイン
メインメニュー
Home
新着情報
フォーラム
UsersWiki
xpWiki::Dev
Wiki [自由帳]
Recent View
View List
写メールBBS
たぐめも
ダウンロード
箱庭諸島
リンク集
お問い合わせ
サイトマップ
参照元情報
|
最新のページ
ブックマーク
新着トラックバック
サイト内 Wiki
☆ 検索 ☆
オンライン状況
サイト情報
現在ページのQRコード
参照元情報