Skip to main content
jotace25
Participant
August 24, 2021
Answered

Repeating regions

  • August 24, 2021
  • 4 replies
  • 417 views

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 has been closed for replies.
    Correct answer B i r n o u

    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



    4 replies

    B i r n o u
    Legend
    August 24, 2021

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

     

     

    Nancy OShea
    Community Expert
    Community Expert
    August 24, 2021

    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.

     

    Nancy O'Shea— Product User & Community Expert
    Legend
    August 24, 2021

    @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.

    B i r n o u
    B i r n o uCorrect answer
    Legend
    August 24, 2021

    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



    jotace25
    jotace25Author
    Participant
    September 1, 2021

    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.