Many webmasters often need to query and display results based on a certain range when building a website. This article uses Imperial CMS custom fields to implement price area range filtering to describe how to achieve this function. method.
The specific steps are as follows:
Customize the field gprice, and in the model, this field must be checked as a combined item.
The four default fields mid is the model ID, classid is the column ID, tempid is the template tag ID used in the list, ph is the combination item, and the ph parameter must be equal to 1, indicating that the combination item is used, otherwise it cannot filter.
Recommended to study "Empire cms tutorial"
The specific code is as follows:
The code is as follows:
<form method="get" action="[!--news.url--]e/action/ListInfo.php"> <input value="11" type="hidden" name="mid"> <input value="" type="hidden" name="classid"> <input value="1" type="hidden" name="ph"> <input value="2" type="hidden" name="tempid"> <div> <p>价格从:<input id="minprice" type="text" onKeyUp="gprice.value=minprice.value+'__'+maxprice.value">至 <input id="maxprice" type="text" onKeyUp="gprice.value=minprice.value+'__'+maxprice.value"></p> </div> <input id="gprice" type="hidden" name="gprice"> <div> <input type="submit" value="提交"> </div> </form>
Other similar range interval queries The function can also be implemented with reference to this example.
The above is the detailed content of One trick to solve the method of filtering the price range by custom fields in Empire CMS. For more information, please follow other related articles on the PHP Chinese website!