We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30497
    • 245 Posts
    Quote from: PMS at Aug 24, 2009, 04:10 AM

    Hi @towerofbabel

    My understanding of how Wayfinder works was wrong. I assumed that Wayfinder would be using all its default templates unless they are overridden by the user using &...Tpl=`...`. However, your commented out Wayfinder call demonstrates that that isn’t the case: Wayfinder is clearly not using the &hereTpl or for the selected document - . It is using your customised &rowTpl instead. I checked with the Wayfinder documentation, and for rowTpl it says:
    The rowTpl template is used to output each document, folder, or weblink (unless one of the templates below is used)
    (I have highlighted the important bit.) There is similar extra logic for the outerTpl too, which is only overridden by the innerTpl if it is specified.

    So, since the outer template doesn’t contain any YAMSified content, in general you only need to include the following parameter in your Wayfinder call to get the default behaviour:
    &rowTpl=`@FILE:assets/modules/yams/tpl/wayfinder/mode/row.tpl`

    where mode is replaced by doc or docr.

    In your case you’ll need to use your custom rowTpl in place of the YAMS one.

    Sorry for the confusion. Please let me know if this works. If so, I’ll update the YAMS documentation.

    EDIT: Updated. OuterTpl is not needed.

    Great, thanks for the help. You can update the YAMS documentation - this works perfectly.
      • 18250
      • 37 Posts
      Hi,

      been struggling about this for quite some time.. Did anyone encounter problems with accessing content on second level in navigation?
      I’m using latest YAMS with aliases and Wayfinder. Wayfinder outputs correct urls on all levels but when accessing 2nd level pages, I always get 404.
      All pages have their aliases saved for each language version.

      Just can’t figure it out sad

      So www.mysite.com/services works, www.mysite.com/services/something doesnt work.

      Any ideas?
        • 22851
        • 805 Posts
        Quote from: marclar at Aug 24, 2009, 04:57 PM

        So www.mysite.com/services works, www.mysite.com/services/something doesnt work.
        Any ideas?

        Are you using the very latest version of YAMS (1.1.3 alpha). There was a bug which caused this problem in 1.1.2 alpha that has been fixed in 1.1.3.

        There’s also a bug in 1.1.3 alpha with friendly alias paths which that means that any friendly alias suffixes and prefixes are applied at every level, not just on the filename. I have already fixed this. If you can wait an hour or two I’ll release 1.1.4 alpha which fixes the bug.

        Paul
          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.
          • 22851
          • 805 Posts
          YAMS 1.1.4 alpha is now available for download. This is primarily a bug fix release.

          - Bug Fix: Corrected the Wayfinder How To? module documentation.
          - Implemented automatic redirection of weblinks. This wasn’t implemented before.
          This works with multilingual weblinks too. In the content fields of a
          multilingual weblink it is possible to specify the same or different URLs or
          docIds for each language. When using a docId, the target document will be
          displayed in the same language as the source document, or the default language
          if the final document is monolingual.
          - Made the $yams->ConstructURL( $langId, $docId ) method public so that it can
          be used as a replacement for $modx->makeUrl( $docId ) when YAMSifying existing
          snippets etc.
          - Bug Fix: Correct a bug in the implementation of friendly url suffixes and prefixes.
          This bug made the suffixes and prefixes active at every level instead of just
          the filename.
          - Bug Fix: Updated the server config. It now displays the correct output when
          unique multilingual aliases only are being used. It also advises on virtual
          host configuration when server name mode is being used.
          - Corrected a potential bug whereby the second argument of preg_quote was not
          specified.
          - Reorganised the params on the ’Other Params’ tab and updated the multilingual
          alias text a bit.

            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.
            • 30497
            • 245 Posts
            Hi PMS,

            Three questions:

            1. How do I use my own custom TVs with YAMS? Maybe I’m blind, but I couldn’t see it in the documentation anywhere.

            2. I am using the 1.0.5 beta. Is it worth me upgrading to the latest alpha? Should I consider the latest alpha less stable in regard to OLD features, or only new ones (multi0lingual aliases)?

            3. YAMS and performance: I am noticing a performance hit with page loads, and I am not sure if it is YAMS-related or not. YAMS is the only real difference between this website and around 10 others I have at dreamhost. Any comments would be helpful.

            Thanks.
              • 22851
              • 805 Posts
              Quote from: towerofbabel at Aug 25, 2009, 03:59 PM

              1. How do I use my own custom TVs with YAMS? Maybe I’m blind, but I couldn’t see it in the documentation anywhere.
              You’re right. It’s not documented. Should be though. It’s quite simple:

              1. Create one tv for each language, using the following naming convention: mytemplatevariable_langid
              2. Include the tv in your template using the following snippet call:
              [[YAMS? &get=`tv` &from=`mytemplatevariable`]]
              


              Quote from: towerofbabel at Aug 25, 2009, 03:59 PM

              2. I am using the 1.0.5 beta. Is it worth me upgrading to the latest alpha? Should I consider the latest alpha less stable in regard to OLD features, or only new ones (multi0lingual aliases)?
              Nothing major has changed with regards to parsing and document rendering between 1.0.5 beta and the latest alpha. Most of the changes have related to aliases and redirection. These changes affect how ALL aliases are dealt with, not just multilingual ones, but the existing functionality should be unaffected.

              If you don’t need multilingual aliases then you should be fine sticking with 1.0.5 beta for the time being. However, I plan to introducing some important changes to document parsing and rendering which will hopefully improve performance. At that stage you will probably want to upgrade.

              Quote from: towerofbabel at Aug 25, 2009, 03:59 PM

              3. YAMS and performance: I am noticing a performance hit with page loads, and I am not sure if it is YAMS-related or not. YAMS is the only real difference between this website and around 10 others I have at dreamhost. Any comments would be helpful.

              There is only one potential performance problem with YAMS and that comes with excessive use of [[YAMS? &get=`content` ...]]. This `content` version of the YAMS snippet call will grab info from the database - one call per language.

              All other YAMS placeholders and snippet calls resolve to standard tvs, chunks, etc. - basically a standard template, behind the scenes and so there should be virtually no performance hit from these - particularly if you are making full use of caching.

              The problem is that the YAMS Ditto and Wayfinder extensions currently make use of the `content` version of the snippet call to pull in multilingual content. So, they result in at least one database query per language, per multilingual tv per template, per document accessed etc. If you have large ditto calls that access many documents, or several ditto calls and Wayfinder calls on a single page, then this can soon amount to thousands of database queries - which is very inefficient. If those calls are cacheable then you should only get the performance hit on first page load though.

              My advice to mitigate this until I have implemented a solution to this problem is to make as full a use of caching as possible and to structure the site/calls so that only small menus and lists are displayed.

              Page loads on a YAMS website that doesn’t implement [[YAMS? &get=`content` ...]] should be almost as efficient as those of a standard MODx website.
                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.
                • 10958
                • 8 Posts
                Hi PMS,

                i’ve found a bug in your code, version 1.0.5 beta.

                If the default language is not active YAMS redirect to 404 page.


                ORIGINAL CODE


                public function DetermineCurrentLangId()
                    {
                
                      // Determines the current lang id
                      // Also initialises the select and parse lang id
                      if ( $this->itsMODx->insideManager() )
                      {
                        return FALSE;
                      }
                
                      $docId = $this->itsMODx->documentIdentifier;
                      
                      // If the page has not been found then the docId can be NULL
                      if ( ! ctype_digit( strval( $docId ) ) )
                      {
                        // When no $docId has been set, this is because no page
                        // has been found... in which case
                        // assume that the document is the site error
                        // page
                        $docId = $this->itsMODx->config['error_page'];
                        // return FALSE;
                      }
                
                      if ( ! $this->itsUseLanguageQueryParam )
                      {
                        // First check to see if the lang has been set as a query parameter
                        if ( isset( $_GET[ $this->itsLangQueryParam ] ) )
                        {
                          $langId = $_GET[ $this->itsLangQueryParam ];
                          // This updates the cookie...
                          $success = $this->SetCurrentLangId( $langId, $docId );
                          if ( $success )
                          {
                            return TRUE;
                          }
                        }
                      }
                
                      // If not, then try to determine the lang
                      // by checking what the headers are
                      // // and by checking whether its supposed to be a multilingual document
                
                      if ( $this->IsValidMultilingualRequest( $langId ) )
                      {
                        // This updates the cookie...
                        $success = $this->SetCurrentLangId( $langId, $docId );
                        if ( $success )
                        {
                          return TRUE;
                        }
                      }
                
                      // So, either it is a monolingual document
                      // or an unrecognised URL
                      // If a language has previously been set,
                      // then retrieve it from the cookie
                      if ( isset( $_COOKIE['yams_lang'] ) )
                      {
                        $langId = $_COOKIE['yams_lang'];
                        $success = $this->SetCurrentLangId( $langId, $docId );
                        if ( $success )
                        {
                          return TRUE;
                        }
                      }
                	  
                      return FALSE;
                	  
                    }



                PATCH CODE

                public function DetermineCurrentLangId()
                    {
                
                      // Determines the current lang id
                      // Also initialises the select and parse lang id
                      if ( $this->itsMODx->insideManager() )
                      {
                        return FALSE;
                      }
                
                      $docId = $this->itsMODx->documentIdentifier;
                      
                      // If the page has not been found then the docId can be NULL
                      if ( ! ctype_digit( strval( $docId ) ) )
                      {
                        // When no $docId has been set, this is because no page
                        // has been found... in which case
                        // assume that the document is the site error
                        // page
                        $docId = $this->itsMODx->config['error_page'];
                        // return FALSE;
                      }
                
                      if ( ! $this->itsUseLanguageQueryParam )
                      {
                        // First check to see if the lang has been set as a query parameter
                        if ( isset( $_GET[ $this->itsLangQueryParam ] ) )
                        {
                          $langId = $_GET[ $this->itsLangQueryParam ];
                          // This updates the cookie...
                          $success = $this->SetCurrentLangId( $langId, $docId );
                          if ( $success )
                          {
                            return TRUE;
                          }
                        }
                      }
                
                      // If not, then try to determine the lang
                      // by checking what the headers are
                      // // and by checking whether its supposed to be a multilingual document
                
                      if ( $this->IsValidMultilingualRequest( $langId ) )
                      {
                        // This updates the cookie...
                        $success = $this->SetCurrentLangId( $langId, $docId );
                        if ( $success )
                        {
                          return TRUE;
                        }
                      }
                
                      // So, either it is a monolingual document
                      // or an unrecognised URL
                      // If a language has previously been set,
                      // then retrieve it from the cookie
                      if ( isset( $_COOKIE['yams_lang'] ) )
                      {
                        $langId = $_COOKIE['yams_lang'];
                        $success = $this->SetCurrentLangId( $langId, $docId );
                        if ( $success )
                        {
                          return TRUE;
                        }
                      }
                	  
                	  //
                	  // current lang not active PATCH!!!!!!!
                	  // 
                
                	  if (!in_array("".$this->itsCurrentLangId, $this->itsActiveLangIds)) {
                		$this->SetCurrentLangId($this->itsDefaultLangId,$docId );
                		return TRUE;
                	  }
                	  
                      return FALSE;
                	  
                    }




                Giorgio
                  • 21700
                  • 42 Posts
                  Hi Guys,

                  First of all: I’m very impressed by YAMS. However, a few question arose:

                  I seem to be unable to remove or add languages. I get this error:

                  [tt]Warning: fopen(/home/skytel/domains/skyxs.nl/public_html/e-welfare/assets/modules/yams/class/../yams.config.inc.php) [function.fopen]: failed to open stream: Permission denied in /home/skytel/domains/skyxs.nl/public_html/e-welfare/assets/modules/yams/class/yams.class.inc.php on line 1158

                  Could not add language with lang id "nl"[/tt]

                  In the file <site root>/assets/modules/yams/class/yams.class.inc.php there is a reference to <site root>/assets/modules/yams/class/../yams.config.inc.php, so essentially there should be a file named yams.config.inc.php in the directory yams. However, I cant find it in the YAMS install dir and a search on this forum didn’t offer me any suggestions. I included a screenshot of the code where the file is referenced.

                  Can I simply remove this reference? Or can someone supply me the config file? Or should I create it myself?

                  Thanks in advance!

                  ------

                  And 2nd question:
                  How to use a localized title? Because the tabs do give me fields for the translated content, but what to do with the pagetitle and introtext?

                  Thanks again,

                  noes
                    • 22851
                    • 805 Posts
                    @Giorgio.

                    Thanks for the patch. Looks fine. I’ll integrate it with the next version. The only thing that puzzles me is how you ended up with the $this->itsCurrentLangId being invalid at that point in the first place. Normally the $this->itsCurrentLangId is initialised before that function is called.

                    @neos

                    YAMS will create the yams.config.inc.php file when you first try to configure it via the module interface. The fact that you are getting that error suggests that YAMS hasn’t got permission to write the file. Please change the permissions of the /home/skytel/domains/skyxs.nl/public_html/e-welfare/assets/modules/yams/ directory to make it writeable by the apache user or group. If you don’t know what they are, you’ll have to have a look in your apache config files. Under linux, using an account with appropriate rights or sudo, something like the following should work:

                    sudo chown -R apacheuser:apachegroup /home/skytel/domains/skyxs.nl/public_html/e-welfare/assets/modules/yams/
                    sudo chmod u+rw /home/skytel/domains/skyxs.nl/public_html/e-welfare/assets/modules/yams/
                    


                    where apacheuser and apachegroup are the correct ones for your server.
                      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.
                      • 22851
                      • 805 Posts
                      @neos.

                      You should get multiple fields for the menutitle and pagetitle too - one for each language - and they should be tabbed too. If you are not getting that, then please can you send me a screenshot and tell me which version of YAMS and MODx you are using?

                      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.