We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41931 ☆ A M B ☆
    • 38 Posts
    Hi, MRHAW

    Thanks per support

    I put:
    [[if? &is=`[*mytpl*]:is:1` &then=`@TPL:article`]]

    Where [*mytpl*] is my TV and article is my chunck

    but occurred this error

    Error : Invalid argument supplied for foreach()
      • 13428 ☆ A M B ☆
      • 1,031 Posts
      @mrhaw: 'eq' is an alias of 'is'.

      @Roca: You have to use the code inside of the Ditto templates, not in the Ditto call. And if you use it inside of Ditto you have to use [+mytpl+] instead of [*mytpl*] because the second one points to the value of mytpl of the current resource (with the Ditto call) and not to the iterated resource by Ditto.

        • 41931 ☆ A M B ☆
        • 38 Posts
        I'll explain in a different way because they never even worked with PHX and not understand it completely. Maybe you guys able to help me.

        I have a list of items and I want to show you two different templates based on inside a Ditto like the image below.

        https://dl.dropboxusercontent.com/u/332507/prinscreen/tpls.jpg

        Ie it merges the articles showing quotes too.

        What I thought to do:

        Create a Tv called mytpl that's where I'll assign a template name

        My question is how to assign it in the Ditto call dynamically for example:

        article1 == template article
        article2 == template quote
        article3 == template article
        ...

        Any suggestion?

        Thanks




          • 4172
          • 5,888 Posts
          can't you have a listbox-TV 'mytpl' on each of the Resources, with input-options

          article=={{article}}||quote=={{quote}}


          Than put:

          [+mytpl+]


          into your Ditto-tpl.

          you may also need the &hiddenFields - property with all fields used in your tpls to say Ditto, which fields to catch, because Ditto may not see the placeholders in your chunks.

          To stay with Jako's suggestion, you would have
          article||quote
          as input-options and

          [+mytpl:eq=`article`:then=`{{article}}`:else=`{{quote}}`+]


          in your Ditto-tpl [ed. note: Bruno17 last edited this post 12 years, 10 months ago.]
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 41931 ☆ A M B ☆
            • 38 Posts
            Hi, Bruno17

            I even could do so if the structure of my template was equal but it's different look:

            template1
            <article class="item [+link_attributes+]">
              <div class="ldr"> <img src="[+imagem+]" data-roll="[+imagem+]" alt="[+title+]" />
                <div class="info"></div>
                <div class="panel" style="background-color:[+cor+]">
                  <h2>[+title+]</h2>
                  <div class="text">
                    <div class="content">
                      <p>[+summary+]</p>
                    </div>
                    <a href="[+codigo+]" rel="external">BUY</a> </div>
                </div>
                <div class="roll"></div>
                <span class="arr"></span> </div>
            </article>


            template2
            <aside class="item quote">
                <blockquote>
                  <p>[+summary+]<br />
                    #justsaying”</p>
                  <footer>[+title+]<br />
                    <a href="[+codigo+]" rel="external">[+URL+]</a><img src="[+URL+]" alt="" /> </footer>
                </blockquote>
              </aside>
              • 20413
              • 2,877 Posts
              Quote from: rocaoliveira at Nov 04, 2013, 08:23 AM
              Hi, MRHAW

              Thanks per support

              I put:
              [[if? &is=`[*mytpl*]:is:1` &then=`@TPL:article`]]

              Where [*mytpl*] is my TV and article is my chunck

              but occurred this error

              Error : Invalid argument supplied for foreach()

              Here is what I would try:
              [[Ditto? &startID=`3` &tpl=`[!if? &is=`[*mytpl*]:is:1` &then=`mytemplate`!]`]]

              OR
              [!Ditto? &startID=`3` &tpl=`[[if? &is=`[*mytpl*]:is:1` &then=`mytemplate`]]`!]

              Notice you can't do [[snippet? &var=`[[another snippet...
                @hawproductions | http://mrhaw.com/

                Infograph: MODX Advanced Install in 7 steps:
                http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                • 41931 ☆ A M B ☆
                • 38 Posts
                Hi, all

                I understand all the posts here and already thanking this community so helpful, I could do what I wanted so simple:

                [!if? &is=`[+mytpl+]:is:1` &then=`{{article}}` &else=`{{quote}}`!]


                Thank You All

                World Cup Brazil 2014! It's Hexa Champion [ed. note: rocaoliveira last edited this post 12 years, 10 months ago.]