We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39839
    • 14 Posts
    Hello all

    I want list resources but don't want get the last child resourcer wtih [[!getResource]]
    For example:

    Parent resources
    - child resources 01
    - child resources 02
    - child resources 03
    - child resources 04
    - child resources 05
    - child ...
    - child ..
    - child resources n


    [[!getResources? &parents=`8` &sortby=`{"menuindex":"DESC"}` &resources=´-last´ &includeContent=`1` &tpl=`CHLogrosDetalle`]]

    Thank you at all.
      • 42046
      • 436 Posts
      There may well be a neater solution but you could use &tplLast to serve a blank template for the last resource.
        • 39839
        • 14 Posts
        Hello Dan.

        Thank your for your responde.
        The idea is get all child resources and put it into a <ul><li>...</li></ul> but don't get the last child resources
        For example

        MODX RESOURCES
        ---------------
        Parent resources
        - child resources 01
        - child resources 02
        - child resources 03
        - child resources 04
        - child resources 05
        - child ...
        - child ..
        - child resources n

        HTML : Don't get last child resources
        -----

        <ul>
        <li> child resources 01 </li>
        <li> child resources 02 </li>
        <li> child resources 03 </li>
        <li> ... </li>
        <li> ... </li>
        <li> ... </li>
        <li> child resources n-1 </li>
        </ul>
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Use tplLast with an empty chunk. Or, use some JQuery to remove the ul's last-child. http://api.jquery.com/last-child-selector/

          You could also use a snippet to count the resources in question, subtract one, then use that snippet as the limit property. This would be problematical if there's a chance that the actual last resource could be unpublished or protected. Another snippet solution would be to get the ID of the last resource and use it for the "-resources" property.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 39839
            • 14 Posts
            Hello Sottwell.

            Thank you for your response, now my Modx is ok.

            I send a image