We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17883
    • 1,039 Posts
    Hi PMS. Just installed your module and so far this is just.... great, exactly what I was looking for! Great documentation from what I can see until now, just discovering all the goodies. One thing: With MODx Evo 1.0 the manager theme path for the stylesheet is not correct anymore. Line 19 in yams.module.inc.php has to be:

    <link rel="stylesheet" type="text/css" href="media/style/MODxCarbon/style.css" ></link>


    Perhaps it is possible to include the manager theme that is selected in the configuration.

    So, back to work, I will give feedback when the installation is set up.





      • 22851
      • 805 Posts
      I’ve added the stylesheet issue to my To Do list. I’ll have a delve into the MODx code to see how it’s set there. There’s probably a simple and consistent way to grab the path to the stylesheet that works across versions.
        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.
      • The stylesheet being used in in the system_settings table, and of course the siteCache.idx.php file, in the manager_theme entry. So you can get it via tags as [(manager_theme)], and via code as $modx->conf[’manager_theme’]. The path is always the same, manager/media/style/...
          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
          • 17883
          • 1,039 Posts
          Thx Susan!

          @PMS: Two improvements in the documentation would be useful:

          1. For Wayfinder make clear that if server name method is used, you have to use the template set in the folder "std".
          2. Make clear that Wyfinder (and I assume also all other snippets) have to be called uncached.

          Questions:

          1. Is it possible to write the standard field pagetitle of the default language in the standard modx table? Reason is, I have to type in the pagetitle twice, the default field and also in my default language. Otherwise I would write a plugin onDocFormSave and copy my default language pagetitle over to the site_content table.

          2. Much more important: Do you have a plan for different aliases for different languages? This is an absolute must imho. I know this is very difficult because the URL creation of MODx is done with the alias field and there seems to be no way of changing this. But perhaps there is a way of altering it later in the output. Like

          if language != default {
          preg_replace($alias,$alias_lang, $modx->documentOutput)


          But then the htaccess doesn`t know where to link to. Very difficult... Ideas?

          So far your module is just awesome! Exactly how a multilingual solution has to be.

          Cheers,
          Marc
            • 22851
            • 805 Posts
            @Sottwell:

            I have modified my development version to set the style sheet path dynamically. The fix will appear in the next update (1.0.2).

            @MadeMyDay:

            Thanks for the valuable documentation feedback. I rushed it a bit, so there’s bound to be lots of room for improvement. That said, I didn’t agree with either of your comments - but that’s almost certainly evidence that the documentation does need improving (or of some error).

            With regards to point 1about which Wayfinder templates to use: If you use the server name method, then you need to make sure that the templates include the full URLs to your documents (including the server name). Therefore you need to use the templates in the "full" folder. If, on the other hand, you are not using the server name method, then you can get away with just using the templates in the "std" folder. These just output relative URLs from the site root, like Wayfinder does by default.

            With regards to point 2 about Wayfinder needing to be run uncached: I’m not sure about that. I have it running with Wayfinder cached and my pages cacheable. I get the correct language content in all cases. Why do you think that Wayfinder needs to be run uncached?

            With regards to the standard document pagetitle field on multilingual documents: For multilingual documents the standard document title becomes a text identifier for the document and all its language variants within the MODx backend. This identifier is visible in the MODx document tree. It needn’t be the same as the default language page title and some people might even prefer it to be a free text field rather than linked to the page title that appears on the front-end document output. I think the following is needed:

            • The YAMS ManagerManager script should be updated to rename the default document pagetitle field to something like "Internal document name".
            • The YAMS "Other Params" tab should be updated to include an option to synchronise the document title to be the same as the default language page title when the document is saved. I don’t think the ManagerManager mm_synch_fields function works with template variables, so I’ll do this with a plugin that works on the OnDocFormSave event like you suggested. I’ll just tweak an existing plugin I have that updates the alias when the document is saved.
            I’ll stick this on my To Do list.

            With regards to language dependent aliases: I have considered this but not in great depth until now. It was clearly not going to be as simple as the other multilingual document fields and I wasn’t even sure if I would be able to get those working at the time. I do understand the benefit of language dependent aliases from a SEO point of view.

            Here is my analysis of how this all works based on experience and a quick browse of the source code: An HTTP Request for a page is made. This is handled by the server, which converts this into a request for the MODx index.php page with the file path and file name sent as the "q" query parameter. MODx parses the request (executeParser function in the document.parser.class.inc.php function) and looks up the document identifier of the document associated with that path and name dependent on the FURL settings. (It seems to use a lookup-table called documentListing, which maps to ids, but I looked in the document.parser.class.inc.php file and couldn’t find where it is initialised.) If the document identifier for the given path was not found, then the OnPageNotFound event is invoked and once that has completed the user is redirected to the error page specified in the MODx config, or the site start if it is not set.

            So, if a user tries to access a page via an URL that contains a language dependent alias then for anything but the default langauge, the OnPageNotFound event would be called and the error/start page redirection would occur, since MODx doesn’t know to look in template variables. The obvious place for YAMS to plugin and change MODx behaviour is the OnPageNotFound event. YAMS could analyse the q query parameter by looking at template variable content tables in the database to figure out the id of the correct page. It would also have to ensure that the query param is consistent with FURL requirements (alias and path etc.), YAMS server name and root name modes and that the document identifier is for a multilingual document. If all that is achieved then it would have to call the sendForward function, supplying the correct document id and exit to continue parsing of the correct page.

            So, I think it could work in principle... but it would need quite a bit of work and testing. I’d be glad to hear from anyone that thinks it isn’t possible, since that would save me time should I decide to go ahead and try to implement it.
              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.
            • (It seems to use a lookup-table called documentListing, which maps to ids, but I looked in the document.parser.class.inc.php file and couldn’t find where it is initialised.)
              I believe that’s from the siteCache.idx.php file.
                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
                • 29774
                • 386 Posts

                So, if a user tries to access a page via an URL that contains a language dependent alias then for anything but the default langauge, the OnPageNotFound event would be called and the error/start page redirection would occur, since MODx doesn’t know to look in template variables. The obvious place for YAMS to plugin and change MODx behaviour is the OnPageNotFound event. YAMS could analyse the q query parameter by looking at template variable content tables in the database to figure out the id of the correct page. It would also have to ensure that the query param is consistent with FURL requirements (alias and path etc.), YAMS server name and root name modes and that the document identifier is for a multilingual document. If all that is achieved then it would have to call the sendForward function, supplying the correct document id and exit to continue parsing of the correct page.

                Spot on, that’s exactly how to do it. But I am not convinced that language dependent aliases are worthwhile given that each language already has it’s own independent domain or subdomain and thus unique indexable URI. Providing the document <title> is set correctly in the relevant language (by far the most important optimisation for organic keyword searches) I’m not sure there would be any SEO benefit in having the aliases translated. Or can someone prove me wrong? Of course language dependent FURLs would arguably aid usability, but are they really worth the extra loading of using a 404 redirect on every page view?
                  Snippets: GoogleMap | FileDetails | Related Plugin: SSL
                  • 17883
                  • 1,039 Posts
                  Hi PMS,

                  thank you very much for your feedback.

                  With regards to point 1about which Wayfinder templates to use: If you use the server name method, then you need to make sure that the templates include the full URLs to your documents (including the server name). Therefore you need to use the templates in the "full" folder. If, on the other hand, you are not using the server name method, then you can get away with just using the templates in the "std" folder. These just output relative URLs from the site root, like Wayfinder does by default.

                  Makes sense, but isn`t the case in my installation. It is your 1.0.1 alpha version, perhaps the folders are mixed up? For example this is the row tpl from wayfinder/std/

                  <li[+wf.id+][+wf.classes+]>
                    <a href="(yams_/root:[+wf.docid+])[+wf.link+]" title="[[YAMS? &get=`content` &docid=`[+wf.docid+]` &from=`pagetitle`]]" [+wf.attributes+]>[[YAMS? &get=`content` &docid=`[+wf.docid+]` &from=`menutitle`]]</a>
                    [+wf.wrapper+]
                  </li>


                  Aaaaah, wait! Perhaps the problem is the base href? With base href the above template works for the server name version. Hmmm, also works without base href.

                  With regards to point 2 about Wayfinder needing to be run uncached: I’m not sure about that. I have it running with Wayfinder cached and my pages cacheable. I get the correct language content in all cases. Why do you think that Wayfinder needs to be run uncached?

                  I don`t know, but at least the homepage the link is wrong in every language and points to the default standard homepage. But this also may have to do with the confusion above.

                  The YAMS "Other Params" tab should be updated to include an option to synchronise the document title to be the same as the default language page title when the document is saved. I don’t think the ManagerManager mm_synch_fields function works with template variables, so I’ll do this with a plugin that works on the OnDocFormSave event like you suggested. I’ll just tweak an existing plugin I have that updates the alias when the document is saved.

                  This would be wonderful! So the user can decide wether to syncronize the pagetitle or put an individual one. Perfect!

                  So, if a user tries to access a page via an URL that contains a language dependent alias then for anything but the default langauge, the OnPageNotFound event would be called and the error/start page redirection would occur, since MODx doesn’t know to look in template variables. The obvious place for YAMS to plugin and change MODx behaviour is the OnPageNotFound event. YAMS could analyse the q query parameter by looking at template variable content tables in the database to figure out the id of the correct page. It would also have to ensure that the query param is consistent with FURL requirements (alias and path etc.), YAMS server name and root name modes and that the document identifier is for a multilingual document. If all that is achieved then it would have to call the sendForward function, supplying the correct document id and exit to continue parsing of the correct page.

                  Yeah, that sounds like a possibility. This is like the solution I use for my multidomain solution for the different 404-pages. I plugin onPageNotFound, look in which main folder I am and forward to the individual 404-page (with correct 404 header).

                  But I am not convinced that language dependent aliases are worthwhile given that each language already has it’s own independent domain or subdomain and thus unique indexable URI.

                  Don`t underestimate the advantages of speaking URLs. If I have a russian/german site with russian as standard, the links for the german audience would be a pain. If I mail or even twitter (without tinyurl) them the recipients knows what it is about only by looking at the URL. Some russian words in the URL are not helpful then.

                  Of course language dependent FURLs would arguably aid usability, but are they really worth the extra loading of using a 404 redirect on every page view?

                  No, of course they wouldn`t. But the forwarding is only done and the 404 header is only sent after the plugin is hooked in and forwards to the correct page. So no problem here I think.
                    • 22851
                    • 805 Posts
                    @Sottwell: Thanks again for your help. I’ll take a look at the siteCache.idx.php file.

                    @therebechips:I can’t prove you wrong, but I am pretty certain that the ’wording’ of the domain and the rest of the URL is used by search engines to decide the likely relevance of a given page to a given search query. I don’t know the details of how they do this, but I’m pretty sure that having terms that people are likely to search for in the URL as well as in the content is likely to help matters. Thats-why-people-go-to-the-trouble-of-having-long-descriptive-filenames.html. I can only imagine that having the URL contain words that are in the same language as the content will help - even if it is just a little. As MadeMyDay said, no redirection of any kind should be required using the approach I mentioned previously. From within the OnPageNoteFound event MODx should just be instructed to load the content of the correct page and then stop.

                    @MadeMyDay: The template you quoted is of the form that should be in the std folder. (yams_/root:[+wf.docid+])[+wf.link+] means, "include the standard wayfinder url but precede it by (a slash followed by the language root name) if on a multilingual page". The standard wayfinder URL is relative URL from the server root and is preceded by a slash.

                    Please can you confirm whether you have server name mode activated or not? If you have server name mode activated then you should be using the templates in the full folder instead. In that case whether or not you are using a base href meta tag is of no consequence. I would recommend always using the templates in the full folder. You can’t (shouldn’t be able) to get into trouble that way. I suggest you do that, clear your cache, and then report back if you are still having problems.



                      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.
                      • 17883
                      • 1,039 Posts
                      @PMS: You have got PM, you can look yourself ;-)