1

I think i'm facing a problem in this block of code:

    <!-- TemplateBeginIf cond="((TemplateRepeatIndex+1) % 2) == 0" -->
    <div class='moduleDe2'></div>
<!-- TemplateEndIf -->

it works perfectly without the "+1". I think templateRepeatIndex+1is interpretated as 01 11 21 31 41 etc ...

Sorry if that's a stupid question, i'm sure the solution is easy. Thank you for your help

  • can you try: <!-- TemplateBeginIf cond="(((TemplateRepeatIndex)+1) % 2) == 0" --> – Saurabh Gangwar Apr 8 '16 at 12:03
  • thank you but it does not work ! – user1178 Apr 8 '16 at 12:13
1

In 2011, one of the templates is using

<span class="number">@@parseInt(${TemplateRepeatIndex})+1@@</span>

I believe DWT to JScript based, so you can use stuff like that to enforce type. I did check the project for Custom Functions, but there isn't one, so I think that should work out of the box, so to speak.

In a conditional, something like

<!-- TemplateBeginIf cond="(parseInt(TemplateRepeatIndex)+1) % 2 == 0" -->

should work (untested).

  • thank you for your help. i get the following error : JScriptException: Expression 'parseInt("0")+1) % 2 == 0' had error 'Expected ';'' – user1178 Apr 8 '16 at 12:38
  • i also tried to use your first solution and i got this : JScriptException: Expression '@@parseInt(${"0"})+1@@ % 2 == 0' had error 'Invalid character' – user1178 Apr 8 '16 at 12:42
  • 1
    Answer for conditional updated - added a missing bracket. Not sure why the first wouldn't work as copy/pasted. Perhaps 2009 doesn't like the ${} syntax? – Dave Forber Apr 8 '16 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy