Conditional includes in ASP

后端 未结 3 605
轮回少年
轮回少年 2021-01-24 00:16

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:

         


        
3条回答
  •  青春惊慌失措
    2021-01-24 00:19

    Unfortunately, include files are a feature of IIS, not ASP. They are included before the page is sent to the ASP-processor that interprets your ASP code. For this reason you can't have conditional includes. The includes are already in place when the ASP code is executed.

    To have conditional code in ASP you could use script components (WSC files), which you can include/load conditionally, or use big if...then or case.. constructions inside an include.

    More info on the use of WSC's can be found here

提交回复
热议问题