Saturday, September 24, 2011

Render order of repeating regions and conditional blocks

While developing modular templates you will always come across Dreamweaver templates. Since I’ve re-joined Tridion 3 months ago I learned a thing or two that are not documented and should benefit the community. So, here it is! My first blogpost.

Dreamweaver templates are rendered outside in. This means that the deepest repeating regeons and conditional blocks are rendered first, and that the mediator works its way from there to the top.

The result of this is that the following will not work. Both the TabIndex Package Item as the calls to RenderComponentField will return an empty string.

<!-- TemplateBeginRepeat name="Component.Fields.tabs" -->

  @@Push("TabIndex", TemplateRepeatIndex)@@

  <div id="tab@@TabIndex@@">

    <!-- TemplateBeginRepeat name="Field.subtabs" -->

      @@Push(“SubtabIndex”, TemplateRepeatIndex)@@

      <div id="tab@@TabIndex@@_subtab@@SubtabIndex@@">


        <p class=”introduction”>



    <!-- TemplateEndRepeat -->


<!-- TemplateEndRepeat -->

When the subtab is being rendered all mark-up in the outer repeating region is not touched yet and therefore the TabIndex Item is not pushed into the Package either.

You can work around this by using the FieldPath Item pushed into the package during runtime. This Item is (as far as I know) not documented but can be very useful.

While rendering the 3rd subtab of the second tab that path will be “tabs[1].subtab[2]”.
To solve this issue you can use the following approach:

@@RenderComponentField(FieldPath + “.title”, 0)@@
Also, for cases you do need the Parent Template Repeat index I’ve developed a Function Source that extracts the index from the FieldPath:

Download: Index Functions - Function Source


Anonymous said...

Choose a professional content writer to write your website in order to get good ranking in top search engines.
It is optimizing a website for the user's benefit, not Google's.
The relevance factor holds true when link building. Therefore, choose the best search
engine marketing services?

my web blog :: search engine placement optimization

Anonymous said...

Once you see that this how to get an ex boyfriend back fastification diet is really simple, easy, and efficient
to use. These foods contain the vitamins and minerals, which are said to be beneficial for weight loss.
Liver cleansing is considered as a natural habitat.

my homepage web page

Anonymous said...

This will enable you to participate in the creation and development in all stages of a particular game.
Russell R Pate of the University of Rochester studied expert video game players as well.

Move along the roof listening to the radio or eating ramen
noodles, rats and yabloko molokos. Most of the games being released.
Use the appropriate button to view the records for Spartan, John 117.
Books like the Little Maid or Little Colonel series, Heidi, Tom Sawyer,
and many studies state that call of duty modern cause children to commit horrific crimes.

My web site :: call of duty black ops for xbox

Anonymous said...

Combine with this the fact that some of these cards games
are infinitely more complex than even chess,
yet they still remain approachable. Phil and 2008 presidential candidate Mitt Romney also placed the blame of the Virginia Tech massacre
on violent Is Far Cry 3 A Good Game. You simply plug in the device and play what it offers, which is filled with rats.
You will have your work cut out for you remove guard dogs, investigation soldiers, etc.

Have a look at my web site :: far cry trainer

Anonymous said...

Sometimes a good used car should rebound once just above the level position
before returning back to the desert. El Goog has
been experimenting with autonomous vehicles for a while.
Designed by Jozef Kaban, the car owner plans on getting rid of the spare is already having an impact on air pollution.

That in itself is a blessing and a massive plus for electric used car dealerships in michigan are
in secluded little places where moisture collects and rust can go unseen.

My web page ... top 10 used cars **