We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20648
    • 26 Posts
    Hi,
    I use ditto 2.1 to show a summary of articles on my front site

    My call is this:
    [!Ditto? &parents=`26` &display=`4` &orderBy=`createdon DESC` &tpl=`shortStory` &extenders=`summary`&truncLen=`50` &filter=`ShowOnHomepage,1` &seeTruUnpub=`1`!]  


    I have a TV which holds a article image for each article, and I use the snippet MiniPhoto to make a thumb. So far so good...

    What I want to achieve is Ditto to show the chunk, called longStory, when the article on the front is clicked. Why? I want the TV article image to show on the full story.

    Here is my chunk for shortStory, which shows on the front page.
    <div class="grid_3">  
    <h2><a href="[~[+id+]~]">[+pagetitle+]</a></h2>  
    <a href="[~[+id+]~]" title="[+pagetitle+]"><img src="[[MiniPhoto? &file=`[+articleImage+]` &width=`200` &height=`150` &quality=`93` &dir=`mini` &isclip=`1` &interlace=`0` &bgcolor=`ffffff`]]"  /></a>
    [+summary+]  
    <p><a href="[~[+id+]~]">Read more</a></p>  
     </div>  
    


    Here is my chunk for longStory, which I want Ditto to use when an article on the front site is clicked
    [+pagetitle+]
    <img src="[+articleImage+]"  />
    [+content+]
    


    Is this possible to do with Ditto in one call? Something like defining in the call, a tpl for the short story and a tpl for the full story?
    If this is not possible, is there a workaround to make it work?
    I’m a bit confused I have to say...

    Hoping for an answer. Thanks.

    Murias
      • 5340
      • 1,624 Posts
      maybe you could use PHx

      This might work but I did not test it:
      &tpl=`[+showLong:is=`1`: then=`longStory `:else=`shortStory`+]`

      More info here
        • 3707
        • 241 Posts
        Is there a reason why you don’t want to link to the article document from Ditto and display the image there using [*articleImage*]?
          • 4385
          • 372 Posts
          I second the use of PHx, but use phx:thumb to create the thumbnail for articleImage ( src="[*articleImage:thumb=`&w=200`*] )
            DropboxUploader -- Upload files to a Dropbox account.
            DIG -- Dynamic Image Generator
            gus -- Google URL Shortener
            makeQR -- Uses google chart api to make QR codes.
            MODxTweeter -- Update your twitter status on publish.
            • 20648
            • 26 Posts
            Hi,
            Thanks for the quick answers.

            bob1000: Thank you! Putting the [*articleImage*] directly into the html template for my articles, solved it. Stupid me, I have read and search so much, that I totally lost track!

            bwente:phx:thumb is new to me. I guess I have to install the PHx plugin? Do I need more than that to make it work? Another snippet like thumb or phpthumb? Is there any documentation where I can read more?

            Sorry for my stupid question. I am just trying to get the hang of it. So far I think modX is just fantastic.
              • 4385
              • 372 Posts
              Yes, PHx is required. But once you have it working you will love it. Then you can add a custom modifier like phx:thumb http://wiki.modxcms.com/index.php/PHx/CustomModifiers#phx:thumb
                DropboxUploader -- Upload files to a Dropbox account.
                DIG -- Dynamic Image Generator
                gus -- Google URL Shortener
                makeQR -- Uses google chart api to make QR codes.
                MODxTweeter -- Update your twitter status on publish.
                • 7231
                • 4,205 Posts
                You do not need to install the PHx plugin to use it within Ditto TPL chunks...it is part of Ditto (and a few other scripts as well like MaxiGallery and Jot). You only need to install the lugin if you want to use it in the site content (and template variable).

                  [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                  Something is happening here, but you don&#39;t know what it is.
                  Do you, Mr. Jones? - [bob dylan]
                  • 20648
                  • 26 Posts
                  Thank you for the clearness and help.
                  I have installed phpthumb and PHx, just to be shure...
                  And this works perfectly for my use.

                  If anyone wonders, this is my code in the Ditto TPL chunk:
                  <a href="[~[+id+]~]" title="[+pagetitle+]"><img src="[+articleImage:phpthumb=`w=200`+]"  /></a>

                    • 25803 ☆ A M B ☆
                    • 721 Posts
                    Quote from: dev_cw at Jun 30, 2009, 05:18 PM

                    You do not need to install the PHx plugin to use it within Ditto TPL chunks...it is part of Ditto (and a few other scripts as well like MaxiGallery and Jot). You only need to install the lugin if you want to use it in the site content (and template variable).



                    Indeed. And when you do install the PHx plugin in makes a mess of Ditto pagination so unless you need it site wide I’d stick with the PHx built into Ditto.