Developer forum

Forum » Templates » TemplateTags in Razor

TemplateTags in Razor

René Poulsen
Reply

Hi,

I noticed that you now write out ""TemplateTags() in code ({0}). Remove before going live...".

You do it no matter if its commented out or not - and I'm not able to print out the tags as I've been able to earlier. I'm on a 8.7.1.4.

Is there some new way I have to write out templatetags or is this a bug?


Replies

 
René Poulsen
Reply

Never mind - just a typo! :-) Used template tags in a loop - the loop didn't exist, so the above message was written instead.

 
Nicolai Høeg Pedersen
Reply

You cannot comment it out, or you can, but it will still have a performance impact - hence the notice!

 
René Poulsen
Reply

Yeah - I just thought that I couldn't get the template tags out anymore - but it was just because of the typo :-)

 
Dmitrij Jazel
Reply

What is this? Just got this error message, Is that something new i DW?

So this means that I am getting this whenever there are no items in the loop?

Any reason why it would suddenly start popping out?

I noticed our solution was "staging/test" server, but now that checkbox is unchecked.

Can it do something with it?

 
René Poulsen
Reply

I guess it's because of some performance issues. No matter if you outcomment your TemplateTags or not, it will make a lot of lookups. That's why you get the "error". It's actually just a help for us, so we remember to remove all TemplateTags in the templates when going live.

 
Dmitrij Jazel
Reply

We experienced some major performance issues (on earlyer project), just cause "//TemplateTags" was in the product template. So we got informed make sure not to leave any behind. Avoid Template and Tag work combination in any context and any combination. Just don't leave any.

And that is totally OK.

 

But the issue is that this message messed up my work, today on Development server...

Totally out of nowhere. Started popping out this message, in where I was working. Well duhh I know I know there is TemplateTags in the code - that is because I am working here at the moment.

But why would it just break the whole template. Not sure if it is intended or not. But what happened to me was:

Whenever I would use DwTemplateTags in the Facet loop. It would remove ALL markup from the template. Ant it looked like DW ignored that template, and refuse to render it. Remove Products loop, facetGroups loop, everything... Code is there, but it just woun't execute. Weared.

 

 

 
René Poulsen
Reply

I had the error when i used a loop that didn't exist. When I used the correct loop I didn't get the error.

I don't know what happens if you have the TemplateTags in an empy loop. But yeah - it can be a bit anoying sometimes - especially if it shows up when it's not intended.

 
Nicolai Høeg Pedersen
Reply

Hi Dmitrij

We simply add a warning to the end of the response whenever you use the @TemplateTags() method. ("TemplateTags() in code ({0}). Remove before going live...")

It does nothing, so I hardly think that is the issue. It just adds that string to the end of the template output.

BR Nicolai

 
Dmitrij Jazel
Reply

Hi Nicolai,

Well that is allright, can't see anything bad with the idea itself. So no doubt about it.

The issue is that we are still on development server, in development environment. In html template it returned the value, when I attempted to use razor - Dw just woun't generate the template. as a result - whenever I am in razor template - and attempt use @TemplateTags() DW just hides all the content from me.

I sent some video materians to the case: 114005 would really appreciated if you could take a quick look and tell me what you think. Is it normal, or am I doing something wrong?

/Dmitrij

 
Nicolai Høeg Pedersen
Reply

Hi Dmitrij

It is not DW that hides your markup - it is your own code. Just tested on the site you sent us in the case, and it works fine. See dump.

Make sure your CSS/JS does not hide the content - or press CTRL+F5 to clear your cache....

BR Nicolai

Capture.PNG
 
Dmitrij Jazel
Reply

Hi Nicolai,

 

Thanks for checking this one, strange.

Well maybe it has something to do with Caching... I will try doing that.

But I hope you seen the video that I sent in the case, I will tgive it a shot again. and will come back with my findings.

 

As I understood you just write @TemplateTags() and it just worked for you right?

 

/Dmitrij

 

You must be logged in to post in the forum