We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31902
    • 342 Posts
    Quote from: Lucy at Jun 23, 2011, 08:49 PM

    edit: Oh - that’s what you did try... Let me think about this some more.

    LOL. Thanks. Please feel free to suggest when you can. I appreciate all help.
      • 31902
      • 342 Posts
      Honestly, I have a real love/hate relationship with this system. I mean, how hard can this be?

      What I have now is this:

      In the bottom of the individual attorney’s page, I have a chunk with this code:

      [[!getResources?
        &parents=`48`
        &hideContainers=`1`
        &tpl=`blogAttorneyListPost`
        &limit=`20`
        &sortby=`createdby`
      ]]


      I have another chunk called blogAttorneyListPost with:

      <div class="blogPost">
      <a href="[[~[[+id]]]]">[[+pagetitle]]</a>
      [[+createdby:userinfo=`fullname`]]
      <div class="clear"></div>
      </div>

      All this basically does is list all of the articles in container with ID 48. So far so good.

      All I’m trying to accomplish right now is to have the system present only the articles out of that container that were written by a certain person (by way of full name) and present it on the page. None of the other ones. How do I filter the other ones out?

      It can’t be this hard! What the heck am I doing wrong??? Thanks in advance.
        • 4172
        • 5,888 Posts
        createdby isn’t a TV, so you cannot use &tvfilters to filter by that field, but you can use the &where-property
        try:

        [[!getResources?
          &parents=`48`
          &hideContainers=`1`
          &tpl=`blogAttorneyListPost`
          &where=`{"createdby:=":1}`
        ]]


        or

        [[!getResources?
          &parents=`48`
          &hideContainers=`1`
          &tpl=`blogAttorneyListPost`
          &where=`{"createdby:=":"1"}`
        ]]
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 4172
          • 5,888 Posts
          Quote from: Lucy at Jun 24, 2011, 07:34 PM

          Createdby isn’t a tv ?!!!

          Oh how I long for a MODx Fundamentals course...

          http://rtfm.modx.com/display/revolution20/Glossary+of+Revolution+Terms
          http://rtfm.modx.com/display/revolution20/Tag+Syntax
          http://rtfm.modx.com/display/revolution20/Template+Variables
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 28275
            • 2 Posts
            please, excuse me - I’m just a confused newbie...
            http://rtfm.modx.com/display/revolution20/Commonly+Used+Template+Tags#CommonlyUsedTemplateTags-AllTags
            How does [tt][[*createdby]][/tt] relate to all this ? it is a TV, isn’t it ?

            Marc
              • 4172
              • 5,888 Posts
              Seems there are some different definitions on the documentations what TVs are.

              The definition, what comes nearest to my understanding is this one:
              http://rtfm.modx.com/display/MODx096/What+are+Template+Variables

              found on Evo 096 Documentation.

              A Template Variable (TV) is an extra or custom Resource Field that is created by the site developer.
              ......................................................
              TVs are template specific, meaning they can only be used in templates that they are assigned to.

              For me all fields, which are in the site_content - table are resource-fields.
              They are sometimes called also standard-template-variables.

              In any case, in this context with getResources and tvFilters they aren’t TVs, or at least, you have to differentiate between standard-template-variables and custom-template-variables.
              With tvFilters you can only filter by real TVs (custom-template-variables), which are stored in the site_tmplvar_contentvalues - table.
              For resource-fields or standard-template-variables, if you want so, you need the &where - property for filtering.

                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 3749
                • 24,544 Posts
                Lucy, I’ve edited the docs your link pointed to. It was common to refer to the "resource fields" (that’s the official term) as "Template Variables" in the past, but that term is now reserved for user-created fields.

                The main reason for the change is to prevent the kind of confusion you experienced and make it clear that Template Variables are indeed different animals. wink

                Thanks for pointing out the error in the docs.
                  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
                  • 3749
                  • 24,544 Posts
                  Quote from: Lucy at Jun 26, 2011, 01:14 PM

                  Very glad I can contribute in some way, even if it’s just by being confused. laugh

                  That’s my main method of contributing. wink
                    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
                    • 31902
                    • 342 Posts

                    Yes! Yes! Yes! This worked!!! Bruno17, I love you...and your family...and your dog (if you have one)! You made my day!

                    The answer was this:

                    [[!getResources?
                      &parents=`48`
                      &hideContainers=`1`
                      &tpl=`blogAttorneyListPost`
                      &limit=`20`
                      &where=`{"createdby:=":1}`
                    ]]


                    What a happy day this is turning out to be.

                    Thanks again, Bruno17 and thank you to all of you who responded. This is a great community (although I still do have a love hate relationship with this systm). And now to my other problem having to do with permissions. But... that is another thread.


                    Quote from: Bruno17 at Jun 24, 2011, 07:27 PM

                    createdby isn’t a TV, so you cannot use &tvfilters to filter by that field, but you can use the &where-property
                    try:

                    [[!getResources?
                      &parents=`48`
                      &hideContainers=`1`
                      &tpl=`blogAttorneyListPost`
                      &where=`{"createdby:=":1}`
                    ]]
                    ...