This scenario resembles the process of creating alternating colored table rows, but instead of dealing with table rows and their colors, we are working with divs and margins.
The code below creates layers based on the genres retrieved from a query. For instance, if the query returns three genres, then three layers will be created. Within each genre layer, sub-layers are generated for each title within that genre. So, if there are five titles in a genre, there will be three layers related to genres and each of these will contain five layers corresponding to titles.
<cfoutput query="MyQuery" group="genreName">
<div class="Genres">
#MyQuery.GenreName#
<cfoutput>
<div class="Titles">
#MyQuery.TitleName#
<div>
</cfoutput>
</div>
</cfoutput>
Furthermore, all layers within each class act as duplicates. However, this layout might not work well for cases where left/right margins should not be applied to the first/last columns in a column-based design.
Is there a way to dynamically assign margins to layers based on their position (record number) and apply conditional formatting? Specifically, setting left and right margins for middle columns while excluding them from the first and last columns?
Thank you,