We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11055 ☆ A M B ☆
    • 3,112 Posts
    That’s why I like MODx, it’s just like a Mob that usually has 2 answers of question: "do you want to do it in hard way or easy way?"
      Rico
      Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
      MODx is great, but knowing how to use it well makes it perfect!

      www.virtudraft.com

      Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

      Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

      Maintainter/contributor of Babel

      Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
      • 30585
      • 833 Posts
      Hey guys,

      Thx for your help. I’ve already figured this out.

      I totally agree with you that Tvs are the way to go, but I’m not the prime user of the site and the reason I would want an automated solution is because not all the pages that have an RSS subscribe link use the same template. And even those that use the same template don’t always belong to the same news category.

      I have 5 RSS channels so far (news categories) and depending on which channel a document belongs to, its RSS subscribe link might be different.
      By subscribe link I mean: <a href="channel-number/feed-id.xml" type="application/rss+xml" title="RSS">Get updates</a>

      Here’s a quick example of what I mean.

      Channel 1
      - Doc1.html [TEMPLATE 1]
      - Doc2.html [TEMPLATE 1]
      - Doc3.html [TEMPLATE 2]
      - feed1.xml

      Channel 2
      - Doc4.html [TEMPLATE 2]
      - Doc4.html [TEMPLATE 1]
      - Doc6.html [TEMPLATE 2]
      - feed2.xml

      Channel 3
      - Doc7.html [TEMPLATE 1]
      - Doc8.html [TEMPLATE 2]
      - Doc9.html [TEMPLATE 4]
      - feed3.xml
      ...

      As you can see in this invironment, manually inputing Tv values in a case of a content-heavy website with daily updates can be a little painful for a basic user.

      Besides, I’m already using a good number of Tvs for different purposes and adding new ones surely sounds like a great idea for the purpose, but the client thinks it’s just too much a burden having to edit that many Tvs. And yes I’ve tried my convincing part, but as you know in the end what matters is what the client wants.

      It’s all been resolved anyway and thanks again.
        A MODx Fanatic
        • 11055 ☆ A M B ☆
        • 3,112 Posts
        Ah, now it’s more clear to me of what you tried to do.
        TV is good.
        But you’re also correct, too many TVs will make the client hiccups.

        How about this,
        1. Your idea is to define the RSS resource per parent.
        2. The easy path is by using TV.

        So, the better implementation could be like this.
        1. The TV belongs to parent, with a default value if you’ve already make the RSS page to the parent.
        By doing this, your client doesn’t have to fill the RSS’s TV value in any time.
        2. Use getResourceField to get the parent’s value:

        <a type="application/rss+xml" title="RSS" href="[[~[[!getResourceField? &id=`[[*parent]]` &field=`rss-page` &processTV=`1`]]]]">RSS feed for this page</a>
        /* note: the ’rss-page’ is the TV’s name */
          Rico
          Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
          MODx is great, but knowing how to use it well makes it perfect!

          www.virtudraft.com

          Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

          Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

          Maintainter/contributor of Babel

          Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
          • 30585
          • 833 Posts
          Quote from: goldsky at Dec 17, 2010, 07:25 PM

          Ah, now it’s more clear to me of what you tried to do.
          TV is good.
          But you’re also correct, too many TVs will make the client hiccups.

          How about this,
          1. Your idea is to define the RSS resource per parent.
          2. The easy path is by using TV.

          So, the better implementation could be like this.
          1. The TV belongs to parent, with a default value if you’ve already make the RSS page to the parent.
          By doing this, your client doesn’t have to fill the RSS’s TV value in any time.
          2. Use getResourceField to get the parent’s value:

          <a type="application/rss+xml" title="RSS" href="[[~[[!getResourceField? &id=`[[*parent]]` &field=`rss-page` &processTV=`1`]]]]">RSS feed for this page</a>
          /* note: the ’rss-page’ is the TV’s name */

          Bravo! That simply rocks. I just couldn’t think of it. I’m gonna use this method for sure. smiley

          Thanks goldsky --
            A MODx Fanatic
            • 3749
            • 24,544 Posts
            You could also just use a TV with a value of @INHERIT to inherit the parent’s value. Then you wouldn’t need a snippet at all:

            <a type="application/rss+xml" title="RSS" href="[[!*rss-page]]">RSS feed for this page</a>


            You’re not adding a TV, because that TV will be there anyway if the resource and parent share a template. You could also hide the TV with a form customization rule since it never needs to be set by a user.

            If you make @INHERIT the default value of the TV, once you set it on the parents, you can forget about it.
              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
              • 30585
              • 833 Posts
              Gotta love MODx, it just makes life so much easier.

              Thx for that tip Bob.
                A MODx Fanatic
                • 11055 ☆ A M B ☆
                • 3,112 Posts
                Even better, Bob.
                I’ve never used @INHERIT before. laugh
                  Rico
                  Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
                  MODx is great, but knowing how to use it well makes it perfect!

                  www.virtudraft.com

                  Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

                  Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

                  Maintainter/contributor of Babel

                  Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.