We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18646
    • 106 Posts
    I have a page that has a table with a series of rows:

    Date: PDF Name and Link
    Date: PDF Name and Link
    Date: PDF Name and Link

    This page is long. I want to pull the top two rows into a chunk to put on other pages in a different format. I think Ditto can do this, but I can’t figure out the logic to make it work. I think the best way to do this would be to assign a class to each of the table rows that I want pull, and have PHx do it’s thing using a custom modifier to sniff for that presence of that class.

    Am I off base here? I know I can do this by dumping all the PDF’s into a directory and reading the contents out of that directory by filtering with a timestamp, but I really want to avoid doing that much work. Does anyone have a suggestion? Thanks all.

    Regards,
    Matt
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Ditto is for listing multiple documents, not for picking out bits of a single document’s content.

      You could write a snippet to parse the page, break out the table rows into an array, then use the first two elements of that array. Or just make a chunk with the desired links, or copy/paste the first two links into the document’s summary and use a snippet with the getField function... there’s most likely at least six ways to do this; actually moving the .pdf files into one directory and using a snippet to grab the newest two is probably easier than fiddling with trying to parse out two fields from a table! If you write the snippet correctly, you’ll even be able to use the same snippet for the page with the full list!
        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
        • 18646
        • 106 Posts
        Thank you for your insight Susan. I notice that you’re always one of the first posters to jump on a question and I always find your topics informative and insightful! I will try a few things and see what others think as well.

        Regards,
        Matt