On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hey there,

    A couple of days ago I installed YAMS on a test site. It made me really happy, and everything just worked without too much hassle.


    Unfortunately... somebody notified me of the fact it’s not retuning *anything* anymore.

    Emptying the site cache through the manager fixes it.. until you refresh the front-end page again. That makes me conclude it’s a caching issue..

    I’m running MODx 1.0.3 / YAMS 1.1.9 (from the repository).

    There are two languages set, all with the accompanying TV’s etc.

    Server config:
    Uniqueness of Multilingual Aliases - not unique
    Multilingual Aliases - yes
    Redirection Mode - default
    Status Code for Redirection to Pages in the Default Language - Temporary (307)
    Status Code for Redirection to Pages in Non-Default Languages - See other (303)
    Status Code for Change of Language - See other (303)
    MODx URLs - empty

    Hide Redundant Fields - hide
    Document Layout - Tabify
    Autoupdate Manager Document Title - no
    Use MODx stripAlias - yes
    Use Mime-type dependent suffixes? - no
    Site start filename - include filename
    Containers as folders - leave as files
    Confirm Language Param - yams_lang
    Change Language Param - yams_new_lang
    MODx Subdirectory - as the subdir without slashes
    URL Conversion Mode - default
    Easylingual Compatibility Mode - no


    When looking at the source of the pages, it is completely empty.

    Using the NET tab of Firebug, it shows a HTTP status of 200 (using a random non existant url gives HTTP 404 and the (monolingual, different template) default page as set in the modx configuration. It gives the response headers, but the response itself is empty, as is the source.



    Within the template, there is a YAMS snippet call, uncached:
    [[YAMS? &get=`repeat` &beforetpl=`@code:<div id="taalselectie">` &repeattpl=`talen_vlag_overig` &currenttpl=`talen_vlag_huidig` &aftertpl=`@code:</div>`]]

    The rest of the template is basic html.



    Could somebody help me out? I have no idea where to look for the fix.
      Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

      Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
    • I turned off caching of documents, which makes the website available again. However it seems to be a big bug (or silly typo?) and it’s really more of a workaround then a fix, so I’m still wondering what could be done to fix this.


      After disabling caching, I started to work with a YAMS + Wayfinder combo to build a menu (using http://svn.modxcms.com/docs/pages/viewpage.action?pageId=13205620 to replace the default templates), however that (once again...) results in a blank page being displayed. (with no response/source in the Net tab of Firebug)

      When I put the contents of the tpl files in a chunk, call that instead, and use regular text instead of the YAMS snippet calls in the template, the page once again shows.

      Perhaps, a snippet problem?

      <?php
      require( $modx->config['base_path'] . 'assets/modules/yams/yams.snippet.inc.php' );
      ?>


      The body part of the template now:
      <body>
      	[*content*]
      [[Wayfinder? &level=`1` &startId=`0` &rowTpl=`@FILE:assets/modules/yams/tpl/wayfinder/doc/row.tpl`]]
      [[YAMS? &get=`repeat` &beforetpl=`@code:<div id="taalselectie">` &repeattpl=`talen_vlag_overig` &currenttpl=`talen_vlag_huidig` &aftertpl=`@code:</div>`]]  
      </body>


      When there are no snippets calls to YAMS in the .tpl file/chunk it works and displays the content properly (although the menu is monolingual). The language selector works like it should.

      Some more checks:
      This does not work and result in a blank page (default row.tpl):
      <li[+wf.id+][+wf.classes+]>
        <a href="(yams_doc:[+wf.docid+])" title="[[YAMS? &get=`data` &docid=`[+wf.docid+]` &from=`pagetitle`]]" [+wf.attributes+]>[[YAMS? &get=`data` &docid=`[+wf.docid+]` &from=`menutitle`]]</a>
        [+wf.wrapper+]
      </li>

      This does work and shows the page, however it results in all links being {link} which aint too useful. The links (urls) are made correctly tho.
      <li[+wf.id+][+wf.classes+]>
        <a href="(yams_doc:[+wf.docid+])" title="{title}" [+wf.attributes+]>{link}</a>
        [+wf.wrapper+]
      </li>


      Almost-a-fix:
      I was looking through the placeholders list of YAMS, and *nearly* got a fix... I found that this outputs the pagetitle for the language identified by "nl".. however it’s not multilingual *yet*.
      ((yams_data:[+wf.docid+]:pagetitle_nl))

      So I went looking for the current language tag placeholder, which is (yams_id). Which would mean:
      ((yams_data:[+wf.docid+]:pagetitle_(yams_id)))

      Which outputs the call, like: ((yams_data:4:pagetitle_nl)), but does not process it, which is the final step I’m stuck with as I can imagine that will probably involve changing the snippet - something I’m not too fond of doing myself... Anybody any ideas?
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
      • Hi markieham.

        Please could you verify the plugin events that YAMS is activated on and make sure that YAMS always appears first in the plugin event order? How have you configured the URLs of your different languages? Are you using different root names?

        I am surprised that &beforetpl=`@code:<div id="taalselectie">` works because I didn’t think that you could use quotes in the values of snippet parameters. I might be wrong there though.
          YAMS: Yet Another Multilingual Solution for MODx
          YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
          Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
        • Events ticked:

          Template Service Events
          OnLoadWebDocument
          OnParseDocument
          OnWebPageInit
          OnWebPagePrerender

          Cache Service Events
          OnLoadWebPageCache

          Parser Service Events
          OnPageNotFound

          Documents
          OnBeforeDocFormSave


          Where it appears in the order, YAMS is the first. (Just triple checked tongue)


          As for the languages, there’s Dutch (tag nl) and Frisian (tag fy). Frisian is the default language and has no root name. Dutch has a root name of /nl/.


          As for the quotes - I didn’t even realise there were quotes, but it didn’t give any problems yet. Unless the quotes would cause the cache to break, is that even possible?
          Edit: just confirmed it still shows a blank page when enabling cache, without quotation marks in the snippet call
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
          • So, lets forget Wayfinder for the moment and concentrate on the first problem. If I have understood correctly, then if you don’t have any snippet calls in you template it works fine, but if you add

            [[YAMS? &get=`repeat` &beforetpl=`@code:<div id="taalselectie">` &repeattpl=`talen_vlag_overig` &currenttpl=`talen_vlag_huidig` &aftertpl=`@code:</div>`]]

            then it only works when the document is uncachable. It should work whether or not the document is cacheable. Please could you show me what the contents of the chunks talen_vlag_overig and talen_vlag_huidig are? Then I can try to reproduce your problem given all the info you have provided.

            Thanks.
              YAMS: Yet Another Multilingual Solution for MODx
              YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
              Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
            • Ah.. there’s something I didn’t try yet. Yes, you are right.

              When the template has the YAMS snippet call and the page is cachable, it will only show once - the next visit/refresh shows a blank page.
              When the template does not have the YAMS snippet call and the page is cachable, it will remain visible.
              When the template is not cachable, it works with and without the snippet call.

              Refering to your earlier (2nd last post) remark about the quotes in the snippet call: I now only have the following in my page’s body, and it acts as mentioned above:
              	[*content*]
              [[YAMS? &get=`repeat` &beforetpl=`@code:<div>` &repeattpl=`talen_vlag_overig` &currenttpl=`talen_vlag_huidig` &aftertpl=`@code:</div>`]]  


              When leaving only the following as the snippet call, the page displays the content, and underneath "(yams-repeat:4)(/yams-repeat:4)". (But the page shows and is cachable)
              [[YAMS? &get=`repeat`]]


              Trying out showed that whenever a chunk is called (repeat or current) it fails.

              Chunk "talen_vlag_huidig (3)":
              <div class="taalvlag huidig"><img alt="(yams_name)" src="[(site_url)]assets/images/flags/(yams_id).png"/></div>  


              Chunk "talen_vlag_overig (2)":
              <div class="taalvlag taal_(yams_id)"><a href="(yams_docr)" lang="(yams_tag)" title="(yams_name_in_(yams_id+))"><img alt="(yams_name)" src="[(site_url)]assets/images/flags/(yams_id).png"/></a></div>



                Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
              • I have set up a local install (MODx 1.0.3, YAMS 1.1.9 ) exactly as you have specified above (2 languages, default with no root name, other with, same snippet call and chunks etc.) but it all works fine for me. I don’t get the same problem with blank pages on subsequent views, so I am at a loss as to what the problem could be at the moment....

                Please could you go to Reports>System Info>phpinfo() and tell me 1) what version of PHP you are using and 2) what version of PCRE you are using.

                Is it possible that the PHP ini_set function has been disabled for your server? If so and you are using a PHP version > 5.2.0, then you might want to try finding some other way of setting the PHP pcre.backtrack_limit value to 16000000, such as via a phi.ini or apache config file, in case it is a regexp problem.

                It might also help if I could log in and take a look myself. If that’s possible, please send me a personal message with the details. Thanks.
                  YAMS: Yet Another Multilingual Solution for MODx
                  YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
                  Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
                • Login details have been sent.

                  1) PHP version 5.2.13

                  2) PCRE library version 7.9 2009-04-11


                  Looking forward to see what you can find.

                  If you can help fixing the problem, I’ll consider sending over a donation smiley
                    Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                    Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                  • Just to let you know that I have made some progress on this. I exported your database and imported it locally and I can now reproduce the blank page problem. I’ve run it through a debugger and the result is very weird. PHP seems to crash on a line that looks perfectly reasonable. (Concatenation of a couple of strings and a few string variables which are returned as a result of a function.) That’s all I’ve got time for now, but I’ll try with a more recent version of PHP later to see if that makes a difference.
                      YAMS: Yet Another Multilingual Solution for MODx
                      YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
                      Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
                    • I also sent you the config file yesterday through the email address you sent me.

                      (Just to confirm you saw it wink)
                        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.