We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31902
    • 342 Posts
    Any suggestions how this might be accomplished?

    I’m in the process of building a site for a law firm. This site has, among other things, a group of pages that are each devoted to the different attorneys of the site. Each attorney has his/her own page to edit.

    This site also features an area which provides a list of articles that were written by all of these attorneys. The list of articles are presented/generated by way of Bob Ray’s incredible blog tutorial, which you can read here:

    http://rtfm.modx.com/display/revolution20/Creating+a+Blog+in+MODx+Revolution

    I’ve implemented this tutorial many, many times on different sites and it works great. Works great on this site, too.

    What the boss wants me to do now is to make...in addition to having the blog appear as a blog style format, with all the articles being presented together...each article by a particular attorney needs to be listed on the same page as the author’s (attorney’s) own page, without the other attorney’s articles being in the mix.

    I need to have each article get filtered out from the pack and show up in the author’s page automatically, without the attorney having to think about listing the title of the article at the bottom of his/her page and linking it to the proper page (probably too much for a lawyer to have to think about smiley ).

    Can anyone provide any suggestions on how to do something like that? I was thinking about using the individual ’posted by’ code to be something of a trigger, or filter, for this method somehow.

    I hope I made sense. Thank you in advance.

    Using Revo 2.0.8
    PHP Version 5.2.10
      • 31902
      • 342 Posts
      To show something of what I was thinking, at the bottom of one of the pages, I added the following code in a chunk:

      [[!If? &subject=`[[+createdby:userinfo=`fullname`]]` &operator=`true` &then=`
        [[!getResourcesTag?
        &elementClass=`modSnippet`
        &element=`getResources`
        &tpl=`PostHome`
        &parents=`48`
        &limit=`20`
        &includeContent=`1`
        &includeTVs=`1`
        &showHidden=`1`
        &hideContainers=`1`
        &cache=`0`
        &pageVarKey=`page`
      ]]` &else=``]]


      As you can see, I utilized the If snippet to use as a conditional statement.

      Unfortunately, it didn’t work (it just presented the first 20 articles of the articles container, no matter who (by way of username) authored them) but I don’t know if I’m close to being on the right track or not.

      I also tried using the above code but replacing the ’true’ with:

      [[+createdby:userinfo=`fullname`]]


      That just resulted in a blank area of the page (no result this time).

      I’m not much of a code monkey. Can anyone help here?

      Using Revo 2.0.8
      PHP Version 5.2.10
        • 33997
        • 150 Posts
        You need to add a WHERE clause to your getResources tag, telling the call to only pull documents where the field you have the author name matches the author’s name. Check out the documentation for further info:

        where: A JSON-style expression of criteria to build any additional where clauses from. See below for an example. See http://rtfm.modx.com/display/xPDO20/xPDOQuery.where

        Output a list of child Resources of the current Resource, based on the Resource-template:
        [[!getResources? &parents=`[[*id]]` &where=`{"template:=":8}` &tpl=`myRowTpl`]]

        Output a list of child Resources of the current Resource, where the Resource-template ID is 1 or 2:
        [[!getResources? &parents=`[[*id]]` &where=`{"template:=":1, "OR:template:=":2}` &tpl=`myRowTpl`]]
        http://rtfm.modx.com/display/ADDON/getResources
        http://rtfm.modx.com/display/xPDO20/xPDOQuery.where
          "Great spirits have always encountered violent opposition from mediocre minds." -Albert Einstein
          • 31902
          • 342 Posts
          Thank you, goonz, for replying.

          Can you elaborate on the {"template:=":8} part? I’m not sure what to do with that. What does it refer to? Does the "8" part of that refer to the id of the articles container?

          Sorry to be such a nube... I think I need a bit more hand-holding.

          Again, thanks in advance.
            • 31902
            • 342 Posts
            Still trying to brainstorm this thing. Here is a thought I’m following...

            Please take a look at this chunk of code. It’s much as above but with some differences:

            [[!getResourcesTag?
              &elementClass=`modSnippet`
              &element=`getResources`
              &tpl=`blogAttorneyListPost`
              &parents=`48`
              &where=`[[+createdby:userinfo=`username`]]`=`lawyerUserNameGoesHere``
              &limit=`20`
              &depth=`2`
              &includeContent=`1`
              &includeTVs=`1`
              &showHidden=`1`
              &hideContainers=`1`
              &cache=`0`
              &pageVarKey=`page`
            ]]


            Notice the...

            &where


            ...portion. I’m thinking of putting one of these chunks in each of the lawyer’s pages then hard-coding the lawyer’s username into the code, as above. Now, the code above does not work (it still displays all of the articles, by all lawyers...not just those filtered by this particular username) but I don’t know why (except that I don’ know what I’m doing, of course ;-) ).

            Can anyone confirm or not whether I’m on the right track with my thinking? If so, what should the correct wording be within the ’where’ conditional?

            Thanks.
              • 33997
              • 150 Posts
              I apologize, I don’t think I’ll be any more help. I’m not a Revo user, so I can’t really give specifics.
                "Great spirits have always encountered violent opposition from mediocre minds." -Albert Einstein
                • 31902
                • 342 Posts
                Thank you anyway, goonz. Anyone else?
                  • 31902
                  • 342 Posts
                  Thanks, Lucy. Yeah, I tried them. Wasn’t sure what to do with the template:=":8 part. Tried all sorts of combinations. I’m not even sure I’m in the ball park, code wise, with what I’m trying to accomplish.
                    • 31902
                    • 342 Posts
                    Thank you, Lucy. Unfortunately, it didn’t work. Nothing showed up this time, as opposed to having all articles show up...just an empty space. Tried different variations on what you suggested.
                      • 31902
                      • 342 Posts
                      Quote from: Lucy at Jun 23, 2011, 03:28 PM

                      Oh - I think it might need to be the user ID number NOT their username.

                      Can you elaborate a bit more? How would it be written? I need a bit of hand-holding here.

                      The test environment I set up here uses an article that I ("admin") wrote, just to make sure the article that shows up in my test page is the one that is supposed to show up (no other articles other than the one authored by "admin"). I believe the ID number for my username is 1.

                      Unfortunately, using this:

                        &tvFilters=`createdby==1`
                        &processTVs=`1`
                        &tvPrefix=``


                      ...didn’t work either. A blank space in my test page.

                      Thanks.