We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28436
    • 242 Posts
    Hello Guys,

    i’m looking for a way to modifiy a Ditto Template by the current number of a record, like the iteration in smarty.
    i want to simulate the this smarty section:

    {section name=p loop=$array}
    <div class="c4">
        <div class="c4Inner {if $smarty.section.p.iteration % 4 == 0}right{/if}">
           <!--  (My dream is to find a solution to simulate the smarty "cycle" Method) like: {cycle name=float values=" left, right"} --> 
            {$array[p].content}
        </div>
    </div>
    {if $smarty.section.p.iteration % 4 == 0}<div class="clearboth"></div>{/if}
    {/section}
    


    OK, the section is the Ditto call

    [[Ditto? &tpl=`tpl` &sortDir=`ASC` &startID=`[+id+]` &display=`all`]]


    The ’tpl’ is following:
    <div class="c4">
    <div class="c4Inner [classname_dependent_on_recordnumber]">
    [*content*]
    </div>
    </div>
    [each fourth record]<div class="clearboth"></div>
    


    Now i found the "[+current+]" Placholder from Ditto, but it give back nothing(how to use it?), and this usage example for PHx
     
    [+phx:if=`[+this+]`:is=`[+that+]`:then=`do this`:else=`do that`+]
    



    "this" should be the result of ($current_recordnumber % 4 )
    "that" should be "0"
    "then" should be ’right’
    "else" should be empty

    mmmhhh... this looks helpfull, but how to combinate the math logical or the number_of_the_current_loop here.
    Maybe a custom modifier is the better way to simulate the smarty style, but the "[+current+]" record is still missing in the modifier code.
    how to get access to it( the current recordnummer )?

    you see, much questions and a horrible english.

    I need a hint. Thank you.

    ciao, Stefan




      • 28436
      • 242 Posts
        • 6726
        • 7,075 Posts
        Nice tip Stefan, wasn’t aware of this one, cool smiley
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l&#39;outil id
          • 28436
          • 242 Posts
          Surprise! i am wondering about myself. do you know spongebob? my brain looks like his body...

          blubb blubb