Developer forum

Forum » Templates » Include tag being run in a @If @Endif even though the condition evaluates false.

Include tag being run in a @If @Endif even though the condition evaluates false.

Jackie Nagel
Reply
 Hello.

We're currently in a situation where we need to have multiple Master.html files so we've made an administration tool to chose which we should use. This is how we include them:

<!--@If(Namespace:MasterTemplate=1)-->
	<!--@Include(Master_1.html)-->
<!--@EndIf-->
<!--@If(Namespace:MasterTemplate=2)-->
	<!--@Include(Master_2.html)-->
<!--@EndIf-->
This works all fine if we only have one of these loop, but if we're trying to run with both loops at once we're getting this nasty error:


For me it seems like the include is run before the conditional loop evaluates true. Should we find an alternative solution or is there any sort of hope that this will be solved in the near future? :-)


Thanks! :-)

Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
 Hi Jackie,

Yes, includes are included very early. All the separate files are collected and then processed as if it was a single file.

I think you can do this with a NotificationSubscriber.

Cheers,

Imar

 

You must be logged in to post in the forum