We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49277
    • 7 Posts
    Hi,

    I'm new to the MODX world and have recently taken over the maintenance of an existing site. I'm having an issue getting my head around how the following chunk works:

    <div class="home-links clearfix">
    		<a href="[[~[[++id.page1]]]]"><img src="/path/to/img/banners/page1-1.png" alt="page title"/><span>{[[getResourceField? &id=`[[++id.page1]]`]]}</span></a>
    </div>


    The full chunk contains 4 of these links and the chunk is included in a template. My issue is with the <a href="[[~[[++id.page1]]]]"> part, specifically the id.page1 part. I've deleted one of the pages and created a new page that I want to link via this chunk (replacing the old page). Can anyone explain what the ++id.page1 means and how I can find the equivalent for my new page?

    I've changed it to [[~145]] 145 being the id of the new page which works but I then have to manually set the information in <span> tag which isn't ideal, I want everything to match up.

    From looking around the documentation [[++id.page1]] is a system setting although I can't find any setting called id?

    Thanks

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

    • Does the site have an extra called "ClientConfig"? It allows editors to use system settings without actually giving access to the Manager's System Settings. This looks like it might be using something like that.
        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
      • Oh, and by the way... you don't need to delete a resource and create another one. You can re-use a resource simply by editing it, then its ID doesn't change. I seldom actually delete a resource, if I don't want to use one I just unpublish it and empty its content. Then later when I want a new resource I recycle one of the unpublished ones.
          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
          • 3749
          • 24,544 Posts
          The System Setting would be id.page1.

          When you open the System Settings grid, you're only seeing settings in the 'core' namespace. That id.page1 setting might be in another namespace. You should be able to put id.page1 in the search box at the upper right, then search each namspace in turn using the drop-down namespace menu at the top of the grid.

          As Susan suggests, ClientConfig might be installed (look for it on the Components or Extras menu, depending on the version of MODX). If so, it will probably give you a more convenient way to set that setting.
            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
            • 49277
            • 7 Posts
            Hi Guys,

            Thanks for the responses. FYI I'm using MODX Revolution 2.2.14-pl (advanced).

            From the components menu there's no mention of ClientConfig, just MIGX, Quip and VersionX.

            I've gone to System -> System Settings, in the "Search by Key" text box I entered "id.contact" which is used in the snippet (i.e instead of id.page1 which links to the "contact" page) I've then gone through all namespaces but I've not found anything. Searching by "id" finds some plenty of settings but I'm expecting to find a setting with a key called "id.contact"

            Oh, and by the way... you don't need to delete a resource and create another one. You can re-use a resource simply by editing it, then its ID doesn't change. I seldom actually delete a resource, if I don't want to use one I just unpublish it and empty its content. Then later when I want a new resource I recycle one of the unpublished ones.

            A good tip, I'm learning the hard way here :\
              • 3749
              • 24,544 Posts
              Now I'm confused. wink

              Your example above refers to the id.page1 System Setting. What's id.contact doing in the discussion?

              Maybe it will help to explain the tag in your example:

              [[~[[++id.page1]]]]


              It's really two tags, a System Setting Tag inside a link tag. It will be parsed from the inside out. The System Setting tag

              [[++id.page1]]


              will be replaced by the value of the id.page1 System Setting (let's say it's 12), leaving this link tag:

              [[~12]]


              The link tag will be replaced by the URL of the resource with the ID of 12.

              The getField tag to the right of that will be replaced by the pagetitle of that resource.

              The point of doing it this way is to allow you to change the System Setting and have all the links point to a different page, though it's kind of a goofy way of doing that, imo, unless there are different custom menus on a lot of pages.

              More typically, the menu is either done with Wayfinder, or placed in a chunk that's then included in all relevant templates with a chunk tag:

              [[$MenuChunk]]


              In the latter case, the links would look like this:

              <div class="home-links clearfix">
                      <a href="[[~12]]"><img src="/path/to/img/banners/page1-1.png" alt="page title"/><span>{[[getResourceField? &id=`12`]]}</span></a>
              </div>


              Since the chunk is included everywhere you need the menu, editing the chunk changes them all.





                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
                • 49277
                • 7 Posts
                To update this:

                Now I'm confused. wink

                Your example above refers to the id.page1 System Setting. What's id.contact doing in the discussion?

                Apologies for being confusing, id.contact is another link in the chunk (the full chunk is the line quoted in my original post 4 times each with a different id.* e.g id.contact, id.page1 etc. In any case I can't find any reference to id.* in the system settings page.

                The link tag will be replaced by the URL of the resource with the ID of 12.

                The getField tag to the right of that will be replaced by the pagetitle of that resource.

                The point of doing it this way is to allow you to change the System Setting and have all the links point to a different page, though it's kind of a goofy way of doing that, imo, unless there are different custom menus on a lot of pages.

                There are 2 versions of the site, in English and Japanese both versions use the same template which includes the same chunk. I tried changing the chunk and hard coding the id as the sample in the previous post but that then links to the English version of a page from the Japanese page.

                For now I've been able to workaround this issue, I was having problems on a local test server so I've restored the server from a backup made before I started making changes and having this issue.

                What I'm really trying to achieve here is take a resource that is an articles container and turn it into a "regular" page. I want to duplicate the resource, then change the original resource to a "regular" page that then links to the duplicated articles container. This will ensure that the menu navigation chunk still works as the id of the page won't have changed.
                • discuss.answer
                  • 3749
                  • 24,544 Posts
                  I'm easily confused. wink

                  What I'm really trying to achieve here is take a resource that is an articles container and turn it into a "regular" page. I want to duplicate the resource, then change the original resource to a "regular" page that then links to the duplicated articles container. This will ensure that the menu navigation chunk still works as the id of the page won't have changed.

                  I'm not sure that's possible. I believe Articles does some complicated fu when you create the articles container and I'm not sure it can be duplicated or converted to a regular page without creating issues. I think the Articles plugin is also tied to the original page, but I'm not sure.

                  The ++id.page1 tag is definitely a Setting tag, so there almost has to be a Setting that matches it, but it just occurred to me that it could be a Context Setting or a User Setting. A Context Setting would be much more likely since it's a multi-language site. Go to System -> Contexts. Right-click on a Context and select "Update Context". The Settings are on the "Context Settings" tab. I bet you'll find them there.
                    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
                    • 49277
                    • 7 Posts
                    it just occurred to me that it could be a Context Setting or a User Setting. A Context Setting would be much more likely since it's a multi-language site. Go to System -> Contexts. Right-click on a Context and select "Update Context". The Settings are on the "Context Settings" tab. I bet you'll find them there.

                    Yeap there it is! So I've created my new resource and then updated the id.page1 setting found under the system -> context from the old id to the new one and everything is as expected.

                    Thank you very much for your time! smiley
                      • 3749
                      • 24,544 Posts
                      Glad I could help. Sorry I didn't think of it sooner. 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