Skip to main content
jotace25
Participant
Aug 24, 2021 2:13 PM UTC
Answered

Repeating regions

I know how to create repeated regions in Dreamweaver (2021), but the attributes like id results in repeated values, which is not right in html.

Is there any method to control this repetitions?

I mean: if  I repeat a region with id="zone1" the repeated zone sould have the id  = "zone2" for instance.  

Not so id, also anyother value like a color or a name...

Thanks.

    This topic is closed to new replies. Start a new post to keep the conversation going.
    B i r n o u
    B i r n o uCorrect answer
    Legend
    Aug 24, 2021 3:10 PM UTC

    for your first question, in the ID attribut (present in the Master TEMPLATE (the DWT file) enter the following code

     

     

    id="zone@@(_index)@@"

     

     

    and if you want to start "zone1" instead of "zone0" enter

     

     

    id="zone@@(_index + 1)@@"

     

     

    but either if it works, and to tell you the truth, I don't quite understand why having a conventional ID naming for repeat zone... personnaly I prefer using from far stuff as data-* attribute as

     

     

    data-keyref="@@(_index)@@"

     

     

     instead of using ID... so in that case I preserve the ID ref to the parent container of the repeated items, and so get childs by their data-keyref attribute, as... if using jQuery

    $("[data-keyref=2]", "#refid").css("color","green")

    or in vanilla

    document.querySelector('#refid').querySelector('[data-keyref="2"]').style.color = "purple";

    any way, you get how it works for incrementing attribute in Repeat Templates

     

    Sorry, I missunderstood the second part of your question ?

    quote

    Not so id, also anyother value like a color or a name...

    By @jotace25



    5 replies

    B i r n o u
    Legend
    Aug 24, 2021 5:51 PM UTC

    ah ah... gang anti DWT is out... 😉

     

     

    Translate
    Nancy OShea
    Community Expert
    Community Expert
    Aug 24, 2021 5:30 PM UTC

    Regions only apply to DW Templates.  And DW Template code is proprietary to Dreamweaver and no other apps. It's neither HTML nor JavaScript.  It's DW Template code that only Dreamweaver understands.

     

    Translate
    Nancy O'Shea— Product User & Community Expert
    Legend
    Aug 24, 2021 5:29 PM UTC

    @jotace25 wrote:

    I know how to create repeated regions in Dreamweaver (2021), but the attributes like id results in repeated values, which is not right in html.

     


    Sounds like you need to move on and investigate some modern front-end javascript workflows which will make repeating content pretty simple, just saying. The way you're doing it is living in the past, not least, you dont need Dreamweaver to do it when using more modern approaches, it's holding you hostage.

    Translate
    B i r n o u
    B i r n o uCorrect answer
    Legend
    Aug 24, 2021 3:10 PM UTC

    for your first question, in the ID attribut (present in the Master TEMPLATE (the DWT file) enter the following code

     

     

    id="zone@@(_index)@@"

     

     

    and if you want to start "zone1" instead of "zone0" enter

     

     

    id="zone@@(_index + 1)@@"

     

     

    but either if it works, and to tell you the truth, I don't quite understand why having a conventional ID naming for repeat zone... personnaly I prefer using from far stuff as data-* attribute as

     

     

    data-keyref="@@(_index)@@"

     

     

     instead of using ID... so in that case I preserve the ID ref to the parent container of the repeated items, and so get childs by their data-keyref attribute, as... if using jQuery

    $("[data-keyref=2]", "#refid").css("color","green")

    or in vanilla

    document.querySelector('#refid').querySelector('[data-keyref="2"]').style.color = "purple";

    any way, you get how it works for incrementing attribute in Repeat Templates

     

    Sorry, I missunderstood the second part of your question ?

    quote

    Not so id, also anyother value like a color or a name...

    By @jotace25



    Translate
    jotace25
    jotace25Author
    Participant
    Sep 1, 2021 7:52 PM UTC

    Thank you, it's a good answer. 
    There is'nt a second question, sorry I made a mistake, I wrote "not so Id, also..." but what I meant was "not just id, also...".  So your answer is complete.

    Thanks.

    Translate