We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12256
    • 2 Posts
    Hi!

    I’m using Ditto to post news and it works great. I’m facing one problem though. The webpage has one main landing page and five local landing pages. The main landing page displays the 5 most recent news polls from all locations. What I want to do is display which location the news poll is related to (which is the title name of its container).

    News Example:

    Bangkok - News #1
    Tuesday 30, June 2009
    Lorem ipsum dolor sit amet, consectetur adipiscing
    elit. Pellentesque nec velit justo, vel tempor ante.

    Shanghai - News #2
    Monday 28, June 2009
    Lorem ipsum dolor sit amet, consectetur adipiscing
    elit. Pellentesque nec velit justo, vel tempor ante.

    My modx structure look like this:

    News (container)
    - Bangkok (container)
    -- News #1 (document)
    - Shanghai (container)
    -- News #2 (document)
    ... and so on

    Ditto call (where id 7 is the "News" container:
    [[Ditto? &parents=`7` &depth=`2` &tpl=`news` &sortBy=`createdon` &summarize=`5`  &total=`5` &sortDir=`DESC` &dateFormat=`%A %d, %B %Y`]]


    Ditto template:
    <div class="newsTopic">[+pagetitle+]</div>
    <div class="newsDate">[+date+]</div>
    <div class="newsDetail">[+content+]</div>
      • 3707
      • 241 Posts
      You could use the getField snippet in your Ditto template to return the parent pagetitle.

      Or you could use PHx to do the same thing.
        • 12256
        • 2 Posts
        Thanks bob1000!

        I didn’t get PHx to work properly but Ditto GetField worked fine.

        <div class="newsTopic">[[GetField? &docid=`[+parent+]` &field=`pagetitle`]] - [+pagetitle+]</div>
        <div class="newsDate">[+date+]</div>
        <div class="newsDetail">[+content+]</div>