We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40169
    • 16 Posts
    Please give me advice.

    On my page I have a segment with news. But the last news have a different style (different chunk template). Have in getResource I show only last news and in the second getResource I will show other news but not the last. &parents=`n` is the same.

    This question has been answered by aximotorr. See the first response.

      • 37105
      • 194 Posts
      Perhaps you can use the placeholder [[+idx]] in your template chunk and conditionally render different code based on the idx.
      [[+idx:is=`1`:then=`<div class='some style'><img src='someimage'/></div>`:else=`<div class='some other style'><img src='some other image'/></div>`]]

      You can also use pdoResources available in pdoTools. This snippet has the &tplFirst option so you can define a custom template for the first result and use the &tpl option
      for all other results.

      See https://docs.modx.pro/en/components/pdotools/snippets/pdoresources
        Codeplaza Webdesign: for professional websites at low cost
        • 17301
        • 932 Posts
        On the second getResources call you just need to set the offset to 1.

        &offset=`1`

          ■ email: [email protected] | ■ website: https://alienbuild.uk

          The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
        • discuss.answer
          • 40169
          • 16 Posts
          @LK, thank you - just what I need