We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33982 ☆ A M B ☆
    • 476 Posts
    So I did a posting a few weeks back with this same problem and I was trying to solve the problem with PHx in conjunction with Ditto, but it didn’t work.

    I’m running on MODx 0.9.6, Ditto 2.0.2, PHx 2.1.2

    What I’m trying to do is just have Ditto change the TPL based, in my case not having a picture vs. having one, on certain criteria. I’m building a website for a client which has an endorsement section. Sometimes there is a picture for people giving the endorsement, sometimes not. For the endorsement page I’m calling Ditto like so:

    [[Ditto? &startID=`55` &tpl=`endorsementpicTPL` &summarize=`50` &sortDir=`DESC` &sortBy=`pub_date` &depth=`1` ]]
    


    Here’s a test page (not actually a live MODx page, but just coded so I can explain what I’m trying to accomplish)...as you’ll be able to see from the example, when there’s a picture, it obviously shows up and when no picture, I want a different background and more room for text:

    http://lumpkinforcongress.com/t_endorsements_pic.html

    Here is my original post when I was trying to use PHx to solve the problem:

    http://modxcms.com/forums/index.php/topic,17699.msg111378.html#msg111378

    It’s a bit lengthy, but after following the advice given from others, I couldn’t get it to work.

    Anybody have any experience with having changing the TPL on a Ditto call?

      Precision Web Development ... SmashStack.com
      • 6726
      • 7,075 Posts
      I agree with ganeshXL here, the logic is not to alternate tpl but to insert conditionnal logic in your tpl

      And yes, it’s always better to "split" information into TVs when you need to process that information you have more control.
      Plus, it helps your editor make sure they have filled all required fields.

      If you need further assistance, just post you tpl code and we’ll figure that out smiley
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 33982 ☆ A M B ☆
        • 476 Posts
        Hey All,

        That fixed the problem...thank you so much. Like you said, it was a matter of putting the PHx logic into the TPL itself and control the T.V.’s in the way you suggested.

        Thanks! grin
          Precision Web Development ... SmashStack.com