导 读:织梦搜索实现标题完全精准搜索,就是搜索文档标题必须一模一样才有搜索结果 实现教程 1、在 /plus/ 新建一个 so.php 文件 ?php require_once (dirname( __FILE__ ) . /../include/common.inc.php ); require_once DEDEINC . /arc.partview.class.php ; if ($title == ){ ShowMsg( 关键字不能为空! , -1 ); exit ();}$row = $dsql-GetOne( SELECT id FROM `dede_archives` WHERE title = $title ); if (is_array($row)){ $chRow = $dsql-GetOne( SELECT c.addtable FROM dede_archives AS a LEFT JOIN dede_channeltype AS c ON a.channel=c.id where a.id={$row[id]} ); $addtable = trim($chRow[ addtable ]); $result = $dsql-GetOne( SELECT arc.*,addf.* FROM `dede_archives` arc LEFT JOIN `{$addtable}` addf ON arc.id=addf.aid WHERE arc.arcrank-1 AND arc.id = {$row[id]} ); $pv = new PartVi
织梦搜索实现标题完全精准搜索,就是搜索文档标题必须一模一样才有搜索结果
实现教程
1、在 /plus/ 新建一个 so.php 文件
<?phprequire_once(dirname(__FILE__) . "/../include/common.inc.php");
require_once DEDEINC . "/arc.partview.class.php";
if ($title == '')
{
ShowMsg('关键字不能为空!', '-1');
exit();
}
$row = $dsql->GetOne("SELECT id FROM `dede_archives` WHERE title = '$title' ");
if (is_array($row))
{
$chRow = $dsql->GetOne("SELECT c.addtable FROM dede_archives AS a LEFT JOIN dede_channeltype AS c ON a.channel=c.id where a.id='{$row['id']}'");
$addtable = trim($chRow['addtable']);
$result = $dsql->GetOne("SELECT arc.*,addf.* FROM `dede_archives` arc LEFT JOIN `{$addtable}` addf ON arc.id=addf.aid WHERE arc.arcrank>-1 AND arc.id = '{$row['id']}'");
$pv = new PartView();
foreach ($result as $k => $v)
{
$pv->Fields[$k] = $v;
}
$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $cfg_df_style . "/so.htm");
$pv->Display();
}
else
{
ShowMsg('没有相关记录!', '-1');
}
exit();