ASP 中的条件包含 [英] Conditional includes in ASP
问题描述
我们在 ASP 电子商务网站中有许多产品类别,根据类别,我们希望包含一个特定文件.例如,如果 URL 是:
We have a number of categories with products in an ASP eCommerce site and, based on the category, would like a particular file to be included. For example, if URL is:
viewPrd.asp?idproduct=6&idcategory=18
然后基于 idCategory=18
我想包括:
then based on idCategory=18
I would like to include:
<!--#include file="menu18.asp"-->
如果 idCategory=19
那么我想包括:
If idCategory=19
then I would like to include:
<!--#include file="menu19.asp"-->
等等.任何帮助将不胜感激.
and so on. Any assistance would be appreciated.
推荐答案
我使用的脚本取自 https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=9796&lngWId=4 (动态ASP 包含)
I use a script taken from https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=9796&lngWId=4 (dynamic ASP inclusion)
因此,在您的代码中包含该脚本后,您只需编写:
So after including that script in your code, you just have to write:
myMenu = Request.Querystring("idCategory")
Include("menu"&myMenu&".asp")
这篇关于ASP 中的条件包含的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!