joshn600 - 2015/3/3 11:05:25
首先我做的是英文版的~ 第一次搜索的时候能搜到产品 但是它好像跳到中文版下了 所以再次搜索就什么也搜不到了! 非要回到上个页面才能搜索到! 求指点!
附件:
QQ截图20150303110123.jpg 附件:
QQ截图20150303110140.jpg 附件:
QQ截图20150303110203.jpg
scstjcy - 2015/3/3 11:50:23
发网址出来看看呢。
joshn600 - 2015/3/4 17:27:54
[b]回复 [url=http://bbs.pageadmin.net/showtopic-31585.aspx#123752]3楼[color=Olive]scstjcy[/color]的帖子[/url][/b]
[url]http://mkt-faucet.com[/url]
xiyou - 2015/3/4 17:32:06
- <form name="S_article" method="get" target="zdy_search" action="/e/search/">
- <input type="text" name="title" id="title" value="" maxlength="50" size="15/" /> <input type="hidden" name="modelid" value="125" /><input type="hidden" name="siteid" value="6" /><input type="submit" onclick="return c_keyword()" class="button" value=" Search " />
- </form>
复制代码这个是你现在的搜索代码, <input type="hidden" name="modelid" value="125" />这段的模型id值要改成英文版本的,你可以到表单管理>>产品表里面去新建一个搜索模型,不会写可以参考中文的搜索模型,直接复制代码在英文版本后台增加一个,增加后会看到一个id,直接替换掉125就可以了。
http://www.pageadmin.net/article/20121220/497.html
joshn600 - 2015/3/7 9:06:23
[b]回复 [url=http://bbs.pageadmin.net/showtopic-31585.aspx#123794]5楼[color=Olive]xiyou[/color]的帖子[/url][/b]
按你说的做了 这是在英文后台 产品表单的产品中心建了一个搜索模型 ID是134 代码也是中文的代码复制过来 就改了下ID 可还是不行 请问大神还有什么需要改的?
<script language="C#" Runat="server">
private string SqlFormat(string str)
{
if(str=="" || str==null)
{
return "";
}
str=str.Replace("_","[_]");
str=str.Replace("%","[%]");
str=str.Replace("'","''");
str=str.Replace("\"","\"");
if(str.Length>20)
{
str=str.Substring(0,20); //截取前20个字符
}
return Server.HtmlEncode(str);
}
</script>
<script type="text/javascript">
function c_keyword()
{
if($("title").value=="")
{
alert("请输入关键词!");
$("title").focus();
return false;
}
}
</script>
<form action="/e/search/" target="zdy_search" method="get" name="S_article">
产品搜索:<input type="text" size="15/" maxlength="50" id="title" name="title" value="<%=Request.QueryString["title"]%>"/> <input type="hidden" value="134" name="modelid" /><input type="hidden" value="1" name="siteid" /><input type="submit" value=" 搜索 " class="button" onclick="return c_keyword()" />
</form>
<ul class="product_pic">
<%
string kw=SqlFormat(Request.QueryString["title"]);//一定要SqlFormat格式化,否则容易被sql注入
Sql_Condition="and (title like '%"+kw+"%' or content like '%"+kw+"%')";//构造搜索条件
DataTable dt=Get_Data();
DataRow dr;
if(dt.Rows.Count>0)
{
%>
<li style="clear:both;float:none;height:30px;display:block;text-align:left;padding:0 0 0 0">查询到<%=RecordCount%>条产品记录。</li>
<%
for(int i=0;i<dt.Rows.Count;i++)
{
dr=dt.Rows[i];
%>
<li style="width:150px;height:150px;">
<a href="<%=Detail_Url(dr)%>" target="_blank" ><img src="<%=dr["titlepic"]%>" border="0" style="width:150px;height:120px"></a>
<span class="title"><a href="<%=Detail_Url(dr)%>" target="_blank" title="<%=Server.HtmlEncode(dr["title"].ToString())%>"><%=SubStr(dr["title"].ToString(),50,true)%></a></span>
</li>
<%
}
}
else
{
Response.Write("无匹配的记录,请更换关键字重新搜索!");
}
%>
</ul>