We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52279
    • 1 Posts
    Hi everyone. I'm fairly new to MODX, and so far it's totally rocking. This might seem a huge newbie question here, so please don't slaughter me. I really would prefer not to use jQuery for this.

    Okay so I have a page which is a simple template which allows the user to type in different service with a short description.

    <div class="item">
      <h1>Service Title</h1>
      <p>Description...</p>
    </div>
    


    Is there anyway for getResources to pull in this page, and then put each service title <h1> into a tpl which displays it as a list on another page? I can't seem to get it to work without pulling everything in.

    Basically I want all the service headings to be pulled on the home page. Maybe I should of made each .item a template variable maybe? Some guidance would be appreciated! (no jQuery pls)

    Thanks in advance!

    ---
    modxcloud
    revo 2.50
      • 3749
      • 24,544 Posts
      I think your mistake is putting all the information you want to pull out into the 'content' field of the Resource. You shouldn't need a Template Variable or any JS.

      You can put the service headings in the 'pagetitle' or 'longtitle' fields of the resource, and the description in the 'description' field.

      That way you can display them anywhere and pull them in anywhere with getResources or pdoResources. This would be in your Template:

      <div class="item">
        <h1>[[*pagetitle]]</h1>
        <p>[[*description</p>
      </div>
      


      BTW, I think the NewsPublisher extra would be perfect for letting the users create the resources.

      [[!NewsPublisher? &show=`pagetitle,description` &require=`pagetitle,description` &parentid=`12`]]


      Change the &parentid value to the ID of the container that holds the service pages.

      BTW, if the service pages will contain more information, in addition to the title and description, you'll want to add a tag for the 'content' field to the template and add that field to the properties in the NewsPublisher tag.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting