We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37234
    • 44 Posts
    I may not understand what exactly getResourceField addon is used for, but here is how I am trying to use it.

    I have getResourceField installed and have the tag
    [[getResourceField? &id=`5` default]]
    in my homepage template and it is pulling in the just page title of the page with an id of 5. Great, it works.

    1) How can I get it to pull in ALL the contents/html of that page and not just the page title?

    2) Can I wrap tags around different HTML elements on that page and selectively pull in certain HTML elements?

    Why I am trying this:
    Basically you can't use TinyMCE editor to edit chunks in WYSIWYG mode. I'm trying to find a way to put all the html elements on a regular hidden page, and pull in certain elements of that page into different parts of a template.

    Any ideas?

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

    [ed. note: helpmejesus last edited this post 14 years, 11 months ago.]
      • 3749
      • 24,544 Posts
      I'm not totally clear on what you're trying to do, but getResourceField pulls in a single resource field (as the name suggests). It will also get template variables. It will not get any HTML that is in the page template, since that isn't part of the resource.

      If I understand you, you can use any resource fields that appear on the Create/Edit Resource panel to hold your content and pull them in with getResourceField. If you need more sections for content, you can create template variables for each one and get them with getResourceField as well.

      If you want a bunch of the fields at once, you can create a Tpl chunk with placeholders for each one (both the resource fields and the TVs) and display that chunk with the getResources snippet.

      For example, if the Tpl chunk is called MyTplChunk and the ID of the page you have all your content on is 12, the tag would look something like this:

      [[!getResources? 
          &tpl=`MyTplChunk` 
          &resources=`12` 
          &includeContent=`1` 
          &includeTVs=`1`
          &processTVs=`1`
          &tvPrefix=``
      ]]



        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
      • discuss.answer
        • 32316
        • 387 Posts
        you need to tell it what fields you want, i.e. &field=`content`
        The Manual is located here: http://rtfm.modx.com/display/ADDON/getResourceField#getResourceField-Examples


        You might also check into using getResources - getResourceField can only return one field and getResources multiple fields which would be more useful in your case.


        Another tip: to see what a getResources call is returning try it without specifying a template and use a print_r() to print out the array


        Edit - cross posted - I started this post before Bob had posted, got distracted came back and finished it [ed. note: whistlemaker last edited this post 14 years, 11 months ago.]
          • 37234
          • 44 Posts
          Thanks guys, I am new to MODX and have yet to setup any template variables...ever. I did read up on them today and watched a video tutorial.

          My homepage template has a quad column of buttons to promote content. I would like for the client to be able to edit these areas with TinyMCE in a chunk, however because I am using MODX Revolution, and with this version you can not edit chunks with TinyMCE editor. So I am looking for a work around.

          Ive attached and highlighed in red the four sections I want to make editable for the client. Its just raw html data so I was hoping to use 4 chunks with TinyMCE editor, but because I cant... Im looking for other options.

          So two questions actually:
          1) how would you handle the 4 content areas from the attached image so the client could edit it?
          2) the main image in the attached also rotates through 4 divs/images via javascript. What would be the best way to setup this in MODX so the client can upload images and change the text on the rotating homepage images?
            • 4172
            • 5,888 Posts
            for both its possible to use a hidden resource and use the MIGX-TV (add image,title,text-fields for all divs into one TV) to fill them and get the formated output by the included getImageList-snippet
            or you could use subresources and getResources for each div (for the image a image-tv).

            I would try MIGX
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 37234
              • 44 Posts
              whistlemaker, that was perfect!

              [[getResourceField? &id=`20` &field=`content`]]
                • 32316
                • 387 Posts
                nice to know when things worked out!