I have a website structured with various modules such as Gallery, Text Intro, and Product Detail. These modules are dynamically selected from a database to populate each page.
For instance:
Page 1:
Gallery
Product Detail
Page 2:
Text Intro
Project Detail
This setup relies on a repeat region that includes conditional regions based on the modules stored in the database. However, this approach results in each repeat region containing nine conditional regions, often leading to the creation of numerous empty divs.(Conditional Regions)
I hope this clarifies the situation. So whats the best approach?? I am using php.
I got that but the problem is that for the CMS I am trying to achieve for one div need to I need 9 conditional regions. So it creates 8 divs unnecessary.
If you're referring to additional divs showing in the UI, then wrap the conditional div in another div with dmx-show. This way the empty conditional divs do not appear in the UI (the divs will still appear in the html).
So, in your case, if you add a div with code like this dmx-show="id_module==1", then it will hide that empty conditional div in the UI.
I totally get that. But is now what I am looking for. I am looking that when the condition is not met. Don’t add the div not in the UI or the source code.
Adding a div in the source code doesn't impact the code functionality. I may be wrong, but I don't believe it's possible to remove the source code for conditional divs in AC2.
For the div to show / hide in the UI, try wrapping the conditional div with dmx-show example I posted before. There may be other ways to achieve this, but this is my approach when I'm including any conditional divs in the code.
This will be awesome. Is not that I don’t want to move to nodejs. The big problem is that some of our clients already own a server and is hard to convince them to move to a new service. So we need to keep with php.