SOLVED: Making changes to one template in a page, affects also another template in the same page

Bricks Version: 1.4.RC2
URL: https://demo4.dev.uoi.gr

Here is a screenshot: https://imgur.com/n0yGATU

I have two (similar) templates in this page.
I created the first template on the left, i exported the template, i reinserted in to create similar one (the one on the right noted area).
I then made a small change on the second template (adding the green top-botton border) and for some strange reason, the first template on the left is also affected.
I have no global css class appointed to any of the containers user for the first and the second template.
This is the most strange thing !!
Any solution to this and reason why is it happening ?

Hi @ysintos

That is how it is meant to behave as they are global templates. However for templates not to act this way, first include the template element and then select it that way. It will then not alter other areas where the template has been included.

1 Like

Hi @Michael ,

This is the way i used to import them in the page, with the “template” widget.
But, they are supposed to be two different templates and not the same.
this is why i exported the first one and reimported it, renamed it and then changed style.

Ah @ysintos haha my bad, I got it mixed up. You need to add it directly to the page, not via the template shortcode.

Please see the discussion about it here:

1 Like

This is the meaning of Templates, to change simultaneously in many places.
BUT, here we are not talking about the same template…
I have one template, i export it to a JSON file, i import it again as a second template and then when i make changes to the second template, the first one changes too…

Ah, I understand you now.

Perhaps it is something with either the naming convention or sharing duplicate IDs. So when you change one because the ID is the same as the one you have imported, it changes the styles on both?

But I think it is hard to know for sure without inspecting both templates and seeing if they do match or not.

I just noticed the URL and checked the shortcode and they are using the same class - please see image:

I don’t think because use exported it and imported it will change the class automatically.

I am sure someone will know what the error is and best way to overcome it

2 Likes

Hi Yannis,
the problem is not the templates, but the loop used in them.
Because you duplicated the template (incl. loop), the loop has the same ID in both cases, which becomes a class in the case of the loop. You can also see this if you look at the source code on your page.

There are two ways around this:

  1. Style not on the ID, but on an own class which is different per loop
  2. Use a new container in the second template (which automatically gets a new ID) and apply the loop and the styles to it

Best regards,
timmse

2 Likes

I feel so good knowing that i have such a suportive community on my back !!!

2 Likes