Emlog Supply Tutorial: Get the search function

Emlog mobile version does not seem to give the relevant search feature to get, anyway, is the state of boredom, today rounded force gave you a detailed explanation about the implementation of this feature, hoping to help a friend in need



first of all, we need to template in Mobile index.php m-folder find the code

$ Action = isset ( $ _GET [ 'Action' ]) ? addslashes ( $ _GET [ 'Action' ]) : '' ; tagging thereunder $ slkey = isset ( $ _GET [ 'keyword' ]) ? addslashes ( $ _GET [ 'keyword' ]) : '' ;

In the code

page_url $ = the pagination ( $ lognum , $ index_lognum , $ Page , $ PAGEURL is served ); behind tagging IF (! empty ( $ slkey )) { // search $ Log_Model = new new Log_Model (); $ Page = isset ( $ _GET [ 'Page' ]) ? ABS ( intval ( $ _GET [ 'Page' ])) : 1 ; $ SITE_TITLE = 'search keywords:' .$slkey.'价格表'; $pageurl = ''; if(is_numeric($slkey)){ $sqlSegment = "and (huohao ='{$slkey}') order by date desc";}else{ $sqlSegment = "and title like '%{$slkey}%' order by date desc";} $lognum = $Log_Model->getLogNum('n', $sqlSegment); $pageurl = "./?keyword=$slkey&page="; $logs = $Log_Model->getLogsForHome($sqlSegment, $page, $index_lognum); $page_url = pagination($lognum, $index_lognum, $page, $pageurl); } 

Call the method:

<form action="./" method="get" enctype="multipart/form-data" onSubmit="return slkeyword();"> <input name="keyword" placeholder="输入货号或者产品名称" /> <button type="submit"/>搜索</button> </form>


Original Address: https: //www.shuyong.net/iemlog/1087.html
original address: https: //www.shuyong.net/iemlog/1087.html

Guess you like

Origin www.cnblogs.com/fdffgfg/p/12000263.html