Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » if defined not working in html templates

if defined not working in html templates

Anders Ebdrup
Anders Ebdrup
Reply

Hi Dynamicweb,

 

After upgrade from Dynamicweb 8 to 9 a check like this: <!--@If Defined(Item.Area.LeafletPage)--> in the product template is not working, but it still outputs a value just by using this: <!--@Item.Area.LeafletPage-->

 

Best regards, Anders


Replies

 
Nicolai Pedersen
Reply

In what template...?

 
Anders Ebdrup
Anders Ebdrup
Reply
It is in the product template
 
Nicolai Pedersen
Reply

That is why you cannot.

Item.Area.LeafletPage is a layout tag and is therefore not available in the context of a productlist template. You get the tag rendered because of a 'bug' - but because of other changes to the template system from 8 to 9 the conditional is handled in the product template and therefore not present when the Item.Area.LeafletPage tag is evaluated.

So you have to find an other way - i.e. using Razor.

Sorry about the inconvenience, Nicolai

 
Anders Ebdrup
Anders Ebdrup
Reply

Hi Nicolai,

 

Can I then make a global tag by using an observer to provide me this tag and in the templates in the same way?

 

Best regards, Anders

 
Nicolai Pedersen
Reply
This post has been marked as an answer

I believe you can - no promises though. Try with a regular global tag first...

Votes for this answer: 1
 
Anders Ebdrup
Anders Ebdrup
Reply

Workaround with Globaltags was working! :-)

 

You must be logged in to post in the forum