Developer forum
E-mail notifications
Changed Template.TagExists(name) functionality
Replies
thl@dk.columbusit.com wrote:
The functionality of the Template.TagExists(Tagname) method has been changed on the last version of the API (18.16.4.5), on previous version the following would return true: myTemplate.TagExists(“LoopStart(MyLoop)”), but not on version 18.16.4.5A Blog post from the 10. April 2008, uses this method:I know that it is possible to use the Template.LoopExists(Loopname), but I have many extenders, notifications and custom modules on many solutions using the “old” method.Let me remind you, that this is a API and not a closes system. Therefore you cannot change the functionality of the methods from time to time.
Hi Thomas
I can see your problem. Let me give you a quick overview of how TagExists and LoopExists work now and then:
The old TagExists made (simply said) a text search for the tag in the HTML !--@tagname--, which is why it also where able to find loops. The old LoopExists didn't work properly, which is why TagExists was used instead.
The new TagExists looks for tags only and only in the current loop (if any), meaning that it doesn't look in inner loops for that tag. This is the correct version of TagExists.
The new LoopExists searches for first-level loops with the given name (it doesn't search for loops inside inner loops), which is the correct way.
I can see how this affects 3rd party development, and I will make a request for changing the behavior of TagExists to also look for first-level loops if the given tagname is 'LoopStart(something)'.
Please note that this is still a small difference from the old version of TagExists:
- Now we only look for valid loops. If the end tag of the loop doesn't exist, it's not a valid loop.
- Now we only look in first-level loops.
If there are no errors in the templates, this should give the desired result, anyway.
I hope this is satisfying.
- Lasse Ebert
Yes, that is satisfying.
Thanks!
Hi,
Since which version has this "TagExists" functionality changed ?
All our clients are currently on 18.16.1.12, and we're planning an upgrade in 2 weeks to 18.16.4.3.
(However in that version the TagExists also doesn't work as expected, so I need to go back to the version where this "TagExists" function still works as expected).
Any ETA on a fix ?
Kind Regards,
Emil
You must be logged in to post in the forum