Developer forum

Forum » Templates » Include too deep...error

Include too deep...error

Tue Beck
Reply

Hi all!

Due to a C5 integration the metadata on all products is overwritten every time the import is run. As a workaround to this problem I'm trying to use the "If Defined" and "Include" tags and eCom groupid to include a HTML file that holds the
correct Metadata:
<!--@If Defined(Server:Request.groupid)-->
    <!--@Include(../../System/Metadata/MetadataSelector.html)-->
<!--@EndIf(Server:Request.groupid)-->
<!--@If Not Defined(Server:Request.groupid)-->
    <!--@MetaTags-->
<!--@EndIf(Server:Request.groupid)-->

The file MetadataSelector.html contains a large amout of If statement which the includes the right Metadata: 

<!--@If(Server:Request.groupid=Hoevl)--> <!--@Include(../../System/Metadata/Data/Hoevl.html)--> <!--@EndIf-->
<!--@If(Server:Request.groupid=Hoevlj)--> <!--@Include(../../System/Metadata/Data/Hoevlj.html)--> <!--@EndIf-->
<!--@If(Server:Request.groupid=Haand)--> <!--@Include(../../System/Metadata/Data/Haand.html)--> <!--@EndIf-->
<!--@If(Server:Request.groupid=haandpumpe)--> <!--@Include(../../System/Metadata/Data/Haandpumpe.html)--> <!--@EndIf-->
<!--@If(Server:Request.groupid=Kabel)--> <!--@Include(../../System/Metadata/Data/Kabel.html)--> <!--@EndIf-->
<!--@If(Server:Request.groupid=topnoegle)--> <!--@Include(../../System/Metadata/Data/topnoegle.html)--> <!--@EndIf-->
...and it goes on for 300 some linies

I keep getting this error "Include too deep... Make sure the template does not include it self indirectly" - but not all the time.

This one works great! : <!--@If(Server:Request.groupid=Haand)--> <!--@Include(../../System/Metadata/Data/Haand.html)--> <!--@EndIf-->

This one trickers the error: <!--@If(Server:Request.groupid=topnoegle)--> <!--@Include(../../System/Metadata/Data/topnoegle.html)--> <!--@EndIf-->

I can't figurer out why I’m getting this error. I Know that the file I’m trying to include exists and the the file doesn’t include anything else the HTML.

 

I hope that someone can help me!  




 


Replies

 
Vladimir
Reply
This post has been marked as an answer
Hi Tue!
The error is appears becouse of there is to much(>100) Include statements in MetadataSelector.html
I belive that this limit is should be removed and register task for that.

I think that the one of solutions now is to break MetadataSelector.html file in 3 parts...

Best regards,


Votes for this answer: 0
 
Nicolai Høeg Pedersen
Reply
Hi Tue

The including system has a limit of 100 includes to prevent infinite loops etc. And also to prevent bad performance and implementations...

300 includes and if's like you do it seems like a very bad performing implementation. There must be a better way, or alternatively you need a small piece of code that includes the correct html file - a pageTemplateExtender or a notification subscriber (Notifications.Standard.Page.OnOutput)

 
Tue Beck
Reply

Hi

Yes - it isn't the best solution in the world - but it only includes one of the files, but –yes - it slows the exetime a bit – but not in a critical way. But it way better then doing it with javascript
:-)

 

I'll try to think of a better performing code structure … or getting someone to code a better C5 integration which is coursing the problem

 

Thank you both for helping!

/T

 

You must be logged in to post in the forum