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

    I'm following the Modx tute on how to create a blog and am getting the error below

    Notice: Undefined index: tag in D:\wamp\www\revo226b\core\cache\includes\elements\modsnippet\8.include.cache.php on line 44

    Read more: Conversion Rate Library - Perth, Western Australia

    Otherwise everything else is working ok. The page loads and pulls the content, but I still get the error.

    Here's the call
    <p>[[!getResourcesTag? &elementClass=`modSnippet` &element=`getResources` &tpl=`library-template` &parents=`2` &depth=`3` &limit=`5` &includeContent=`1` &includeTVs=`1` &showHidden=`0` &hideContainers=`1` &cache=`0` &pageVarKey=`page` ]] [[!+page.nav:notempty=`</p>
    <div class="paging">
    <ul class="pageList">[[!+page.nav]]</ul>
    </div>
    <p>`]]</p>


    Can anyone tell me where I'm going wrong?

    Thanks

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

    [ed. note: markg last edited this post 13 years, 7 months ago.]
      Content Creator and Copywriter
      • 30585
      • 833 Posts
        A MODx Fanatic
        • 30585
        • 833 Posts
        And while we're at it, why not take advantage of the Articles snippet which is pretty much the ultimate Blog solution in MODX Revo. It has some built-in placeholders for typical things like tags, comments, etc.

        If you're already using Articles, can specify which document holds the getResources call.
          A MODx Fanatic
        • discuss.answer
          • 18367
          • 834 Posts
          Treigh,

          Sorry, should have said I'm not using Articles. I'm following the original tute in the link.


          I looked at Articles but it's not really what I'm after.

          Articles doesn't do categories.

          Anyway, it seems to have fixed itself. Working fine now.



          [ed. note: markg last edited this post 13 years, 7 months ago.]
            Content Creator and Copywriter
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            That's not really an error it's a notice. It means that the variable wasn't defined. It "fixed" itself later because such a variable became used. The snippet, snippet #8 in your installation, needs to be fixed to check for the existence of the variable before trying to do something with it.

            A good example is illustrated here http://notesofgenius.com/how-fix-php-notice-undefined-index/
              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
              Which snippet is #8? (the IDs are in parentheses next to the name in the Elements tree).

              Some where around line 40 (the line numbers are often high by about 7), there's a variable: $tag that's used without being declared before that line. Most often, it's something like this:

              if ($tag)


              that should be:

              if (isset($tag) && $tag)
                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