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

    I upgraded from 2.56 to 2.5.8 then 2.6 then 2.6.3

    I saw my modx error log getting filled by tons of new errors
    including large part of the code of the pages whatever they are. And a few page not rendering as they should.

    I notice a few clues about output modifers

    I changed back optimized syntaxe into old one and this solved those rendering issues
    [[!+myDocList:is=``:then=`[[*content]]`:else=`[[$marque-contenu-docs0]]`]]
    
    [[[[-!+myDocList:is=``:
    then=`*content`:
    else=`$marque-contenu-docs0`]]]]
    


    Regarding the error log after : some extract
     ... [2018-05-18 15:33:49] (ERROR @ /xxxxxxx/httpdocs/core/xpdo/om/xpdoquery.class.php : 764) Encountered empty IN condition with key id
    [2018-05-18 15:33:49] (ERROR @ /xxxxxxxx/httpdocs/core/model/modx/modparser.class.php : 540) Could not find snippet with name #1.pagetitle.
    [2018-05-18 15:33:49] (ERROR in resource 13 @ /xxxxxxxx/httpdocs/core/model/modx/modparser.class.php : 1373) Bad link tag `[[~]]` encountered
    [2018-05-18 15:33:50] (ERROR @ /xxxxxxxxx/httpdocs/core/model/modx/modparser.class.php : 540) Could not find snippet with name #27.tv.footCol1.
    [2018-05-18 15:33:50] (ERROR @ /xxxxxxxxxx/httpdocs/core/model/modx/modparser.class.php : 540) Could not find snippet with name #27.tv.footCol2.
    [2018-05-18 15:33:50] (ERROR @ /xxxxxxxx/httpdocs/core/model/modx/modparser.class.php : 540) Could not find snippet with name #27.tv.footCol3.
    [2018-05-18 15:33:50] (ERROR @ /xxxxxxxx/httpdocs/core/model/modx/modparser.class.php : 540) Could not find snippet with name #41.longtitle.
    [2018-05-18 15:33:50] (ERROR @ /xxxxxxxx/httpdocs/core/model/modx/modparser.class.php : 540) Could not find snippet with name #72.longtitle.
    [2018-05-18 15:33:50] (ERROR @ /xxxxxxxxx/httpdocs/core/model/modx/modparser.class.php : 540) Could not find snippet with name #74.longtitle.
    
    [ed. note: elz064 last edited this post 5 years, 11 months ago.]
      • 36604
      • 268 Posts
      seems suche error are only (?) for EN (english context)

      the default web (FR) context does not fire such errors...
      Still wondering what could be such
      modparser.class.php : 540) Could not find snippet with name #73.longtitle.


      any idea ?

      Thank you
        • 3749
        • 24,544 Posts
        Maybe the policy used in the Context Access ACL entry for the French context doesn't have the necessary snippet permissions?
          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
          • 36604
          • 268 Posts
          Quote from: BobRay at May 23, 2018, 04:24 AM
          Maybe the policy used in the Context Access ACL entry for the French context doesn't have the necessary snippet permissions?
          hmm.
          Thank you.
          obviously I do not know what to check.? ACL and me are not friend at all.

          this site is on since 2013

          However It appars errors are continuously coming in the log whatever the CX.

          here's something more relevant what is the relationshionship between 'snippet' and #nnumber.a_chunck_name huh:
          core/model/modx/modparser.class.php : 1373) Bad link tag `[[~]]` encountered
          [2018-05-23 00:14:21] (ERROR @ /var/www/vhosts/xxxx/httpdocs/core/model/modx/modparser.class.php : 540) Could not find snippet with name #27.tv.footCol1.
          [2018-05-23 00:14:21] (ERROR @ /var/www/vhosts/xxxxx/httpdocs/core/model/modx/modparser.class.php : 540) Could not find snippet with name #27.tv.footCol2.
          [2018-05-23 00:14:21] (ERROR @ /var/www/vhosts/xxxx/httpdocs/core/model/modx/modparser.class.php : 540) Could not find snippet with name #27.tv.footCol3.
          [2018-05-23 00:14:22] (ERROR @ /var/www/vhosts/xxxx/httpdocs/core/model/modx/modparser.class.php : 540) Could not find snippet with name #41.longtitle.
          [2018-05-23 00:14:22] (ERROR @ /var/www/vhosts/xxxx/httpdocs/core/model/modx/modparser.class.php : 540) Could not find snippet with name #72.longtitle.
          [2018-05-23 00:14:22] (ERROR @ /var/www/vhosts/xxxx/httpdocs/core/model/modx/modparser.class.php : 540) Could not find snippet with name #74.longtitle.

            • 3749
            • 24,544 Posts
            I was a little slow to realize this, but I think the issue is the result of using the FastField extra. FastField replaces the MODX parser with a different parser that processes tags beginning with # to get fields from other resources and TVs. I consider that a questionable practice and have never used FF.

            What's happening is that the original MODX parser is processing the tags. It thinks they're snippet tags and fails to find a snippet with the name held by the tags.

            Either you've lost the bit of code that makes MODX use the FastField parser (that would be my guess), or FastField is not compatible with the current version of MODX.

            First, see if the FastField plugin is enabled. If not enable it.

            If that doesn't do it, look for two System Settings with the keys: parser_class and parser_class_path If they're there, set the first to fastFieldParser and the second to {core_path}components/fastfield/model/fastfield/

            If the settings are not there, I'd re-install FastField (but I'd back up the site first).

            FYI, this is from the FastField docs:

            MODX uses modParser class for parsing default tags. This plugin adds class fastFieldParser that extends modParser. So, if modParser is modified in new version of MODX, the behaviour of plugin will be unpredictable.

            FWIW, having to get a lot of fields from docs other than the current one suggests that data that needs to be available at various points in the site is being stored in resources and TVs. Maybe it could moved into a custom DB table or a file and displayed with a custom snippet, or into System Settings and displayed with System Setting tags. Using System Settings would be relatively fast and they can be edited with the ClientConfig extra. It looks like some of it could go in chunks and be displayed with chunk tags.
              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
              • 36604
              • 268 Posts
              hi

              Thank you for those clues.

              FastField is listed in the extensions manager but does not appears in the plugin tree.

              The reinstall button did something. and a few clicks to navigate our site seams to generate now less errors into the log.

              However the plugin still not visible in the Plugin tree list...

              But as far as I can see the "Could not find snippet with name #74.longtitle" type is gone.

              Remaining errors are still
              .............../httpdocs/core/xpdo/om/xpdoquery.class.php : 764) Encountered empty IN condition with key id
              [2018-05-24 09:22:56] (ERROR in resource 33 @ /var/www/vhosts/xxxxx/httpdocs/core/model/modx/modparser.class.php : 1373) Bad link tag `[[~]]` encountered


              (already posted about it but still no solutions)

              and the new one since Modx 2.6,
              some pages fire errors with the whole html modx code into it:
              (always $%%!*cache relative with mixed IF and so on) wich is the more painful one

              some extract:

              [2018-05-24 09:26:27] (ERROR @ /var/www/vhosts/xxxxx/httpdocs/core/model/modx/modparser.class.php : 452) You should not call uncached elements inside cached!
              Outer tag: [[If? &subject=`[[+modx.user.id]]` &operator=`EQ` &operand=`0` &then=`[[$call_Login]]`    &else=`[[!$qui-est-la]]` ]]
              Inner tag If? &subject=`4` &operator=`EQ` &operand=`0` &then=`Fenêtre modale<br />
              <!-- Button to trigger modal -->
              <a href="#loginModal" role="button" class="btn" data-toggle="modal">Login</a>
              <!-- Modal -->
              <div id="loginModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
              <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
              <h3 id="myModalLabel">Modal header</h3>
              </div>
              <div class="modal-body">
              [[!getResourceField? &id=`17` &field=`content` &default=`Sorry, no data available`]]
              </div>
              <div class="modal-footer">
              <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
              
              </div>
              </div>`    &else=`[[!$qui-est-la]]`  
              .... 
                • 3749
                • 24,544 Posts
                After looking at the code, it looks like the FastField parser is now a file rather than a plugin, although the docs still refer to it as a plugin. It's being called instead of the regular parser because of those System Settings. I suspect that the errors are still coming from the FastField parser, which was last updated in 2013, due to incompatibilities with the current version of MODX (with the exception of the "bad link tag" error which remains something of a mystery).

                One of the issues at the GitHub repo for FastField has this to say: "Fastfield is not working good since Modx 2.5.2."

                I have seen those dumps of the entire MODX object, though never in my Error Log.

                I can't think of anything to suggest that wouldn't be a huge hassle. Going back to the MODX parser would bring back all the missing snippet errors. Replacing those # tags with calls to dedicated custom snippets would be tedious, but so would rewriting FastField as a proper plugin.

                If you want to provide a list with one example of each type of # tags, I could show you what the replacement snippets would look like.

                These examples assume that you change those two System Settings and go back to the MODX parser:

                For example:
                [[#41.longtitle]]


                could be replaced with getResourceField (which it appears you already have):

                [[!getResourceField? &id=`41` &field=`longtitle` &default=`Sorry, no data available`]]



                I'm guessing, somewhat, but I think this:

                [[#27.tv.footCol2]]


                Could be replaced with this:

                [[getTVValue? &docId=`27` &tv=`footCol2`]]


                and this snippet called getTVValue:

                $tvObj = $modx->getObject('modTemplateVar', array('name' => $tv));
                return $tvObj->renderOutput($docId);
                








                  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
                  • 36604
                  • 268 Posts
                  thanks a lot.

                  I only have to find out where are located those calls...obviously no idea and it will take me a lot of time to figure out.
                  Piling up tons of chunks (with conditions) is not easy to maintain. That's a weakness of Modx if you wanna use it as a designer rather than a coder...

                  I'll try to find those FastField calls. But I believe I've had to use FastField because Getressource was not working in some case due to the complexity of the structure.....
                    • 36604
                    • 268 Posts
                    Hi,
                    Thanks a lot.

                    I took some time to check this out

                    The usage of the custom tv getTVVALUE into one of my footer chunk seams to lower the number of error
                    but not 100%..
                    As this is passing through Babeltranslation to route to the current language id, there's maybe another issue with Babel:
                    here's the chunk extract (I tried different ways to disable the # fastfield call..) :
                     <!-- row of 3 columns -->            
                        <div class="row">                
                          <div class="span4"> <div class="bloc-txt no-back">
                    	  	[[getTVValue? &docId=`[[BabelTranslation? &contextKey=`[[*context_key]]` &resourceId=`27`]]` &tv=`footCol1`]]
                    		[[-diese[[-XBabelTranslation? &contextKey=`[[*context_key]]` &resourceId=`27`]].tv.footCol1]]                 
                    		</div>
                          </div>                
                          <div class="span4"><div class="bloc-txt no-back">
                    	  [[getTVValue? &docId=`[[BabelTranslation? &contextKey=`[[*context_key]]` &resourceId=`27`]]` &tv=`footCol2`]]
                    	  [[-diese[[-XBabelTranslation? &contextKey=`[[*context_key]]` &resourceId=`27`]].tv.footCol2]]
                    		</div>
                          </div>                
                          <div class="span4"><div class="bloc-txt no-back">
                    	  [[getTVValue? &docId=`[[BabelTranslation? &contextKey=`[[*context_key]]` &resourceId=`27`]]` &tv=`footCol3`]]
                    		 [[-diese[[-XBabelTranslation? &contextKey=`[[*context_key]]` &resourceId=`27`]].tv.footCol3]]
                    		</div>
                          </div>   
                    

                      • 3749
                      • 24,544 Posts
                      Your tags are deeply nested, and all are called cached. You have a resource field tag, inside a snippet tag, inside another snippet tag, inside a chunk inside a content tag. I wouldn't expect them to work reliably. 
                      
                      I would be inclined to try something like this, which should be faster and more reliable (notice the only snippet call is uncached):
                      
                      [[!getTVValue? &docId=`27` &tv=`footCol2` &contextKey=`[[*context_key]]` ]]
                      /* getTVValue snippet */
                      $tvObj = $modx->getObject('modTemplateVar', array('name' => $tv));
                      $finalDocId = $modx->runSnippet('BabelTranslation', array('context_key' => $contextKey, 'resourceId' => $docId)));
                      return $tvObj->renderOutput($finalDocId);
                      I would first try it like this to see if it's returning the correct ID HTML
                      <p>DocId returned from BabelTranslation: [[!getTVValue? &docId=`27` &tv=`footCol2` &contextKey=`[[*context_key]]` ]]


                      Snippet
                      /* getTVValue (just one line)*/
                      return $modx->runSnippet('BabelTranslation', array('context_key' => $contextKey, 'resourceId' => $docId)));
                      


                      If that works, switch to the code at the top.
                        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