We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20231
    • 12 Posts
    Hello, I’m new to MODx, but am enjoying learning. I’ve just gone through all of Mary’s tutorials over at her CodingPad site (which are great, btw), and have read documentation and searched this forum, but am having trouble figuring out something:

    I’m working on a website which will have, besides the normal about, services, and contact pages, a portfolio section and a blog section. I’ve got these set up and working thanks to Mary’s tutorials, but I’m looking for a way to display information from each of these sections on my home page.

    I want to pull in three featured projects from the portfolio section (the 3 most recent are fine), and display the project’s thumbnail (I’ve set up a TV for the portfolio section for adding that image), a title, and short summary.

    I also want to pull two featured blog posts. We have two authors on the site, representing the two different sides of our business (design and tech), and I want to display a featured post from each, side by side, with different styling. The logical method for pulling in these posts (they share the same main blog), is to pull them in by author.

    Here’s an example image:


    What would be the best way to accomplish this?

    Thanks!
      • 20231
      • 12 Posts
      Ok, I’ve been able to figure out a part of my earlier question; how to pull in documents by their author. Mostly done through a lot of trial and error:

      [!Ditto? &parents=`12` &tpl=`featured-blog-post` &display=`1` &filter=`createdby,1,1` &extenders=`summary` &truncLen=`200` !]


      The
      &filter=`createdby,1,1`
      was key here. Basically, it says, "filter out any documents not created by the author with the ID of 1." Figured I’d post it here, since us designers have a hard time reading code-speak sometimes. smiley
        • 16278
        • 928 Posts
        You’re probably getting there on your own, but you might find some documentation for Ditto 2.1 that I’m drafting of some use. It’s at http://www.pogwatch.com/ditto/ I’m focusing on the parameters for the current version of Ditto, as most of what you’ll find in the forums and wiki is a bit out of date. The documentation on parameters at http://ditto.modxcms.com/files/snippet-ditto-php.html is comprehensive and up to date but difficult to follow in places.
        For your home page you probably just need to use &display=`3` and a suitable template (in a chunk).
        cool KP
          • 20231
          • 12 Posts
          kp52: thanks, I already found and read through your documentation, and yes, it helped. My main problem is just the learning curve of how all the pieces tie together. But I’m getting there rapidly now, I hope. Here’s my final Ditto call for the featured work on my home page that ended up working:

          [!Ditto? &parents=`8` &tpl=`featured-work` &tplFirst=`featured-work-first` &tplLast=`featured-work-last` &total=`3` &display=`all` !]