CMS Development

andre9000
Contributor

Module Snippet

Hi,

 

I created a custom code module. It's a local module.

 

I noticed that everytime I change something in the module, like adding a new field, the snippet to embed it in a template changes. Example:

 

Given snippet:

{% module "module_153391155118717" module_id="3486195" label="my_module" %}

-> adding a field to module.

Now snippet shows:

{% module "module_153391158798042" module_id="3486195" label="my_module" %}

But the templates of course still use the old snippet. Is this problematic? What is 

module "module_153391158798042"

good for?

0 Upvotes
3 Replies 3
lgerodiaz
Contributor

Module Snippet

Hello there,

 

I think that won't really affect anything except for when you're trying to revert back to a previous version of that custom module you're working. As long as you have that same kind of 'module_id' you should be fine.

 

L

0 Upvotes
andre9000
Contributor

Module Snippet

Hey, thanks for the answer! I am not sure that piece of code is for versioning. I tried the following:

 

  • Use the snippet in a template
  • change the local module (adding 1 field)
  • snippet updates
  • the page that uses the template with the module still has the old snippet
  • checking that page  --> the new field shows up
  • putting the new snippet in the template --> all content for that module is lost, default values are shown
  • putting old snippet again --> content shows again

 

What this tells me is to never update the snippet on the page, because all module content will be lost. However, I would like to understand what exactly that piece of code 

module "module_153391158798042"

is actually good for. 

0 Upvotes
MarkoTsoi
Member | Partner
Member | Partner

Module Snippet

I realise this is an older question, but my understanding of the module_### is that it's an index into a database row, so, if you have two of the same module with the same id on a page/email/etc, then you'll get the same content in both.

 

I know that when I add two of the same module onto a html page, I need to make sure the ids are different. 

 

This is just my current mental model, but I hope it helps you as well. 

0 Upvotes