We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I’m using Win XP Pro and used PowerArchiver to extract the archive; all the files seem fine to me as well. Chanh, any other details that might reveal the source of the problem here?
      • 34162
      • 1 Posts
      I found what my problem was!

      There were two folder one for __MACOS\snippet and one for just snippet. I opened the snippet in the "__MACOS" folder and of course I can not see it since it is a Mac files.

      Sorry!
      • Zipped with Stuffit on Mac OS X. Trust Billy to make life difficult.

        By the way, the DocMan snippet in that download is bad. Get the new one from the Downloads forum or my site if you will be using it on a new MODx. There is a good older version as well for older installations of MODx.
          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
          • 34162
          • 1 Posts
          Susan,

          I will do it!

          Thanks
            • 18397
            • 3,250 Posts
            Here is a PC zipped version of Susan’s
            • Hard to keep up with, though; there’s getting to be so many snippets and "tips" as the community grows that I’m adding two or three snippets to my private archive every few days now. And those that I tend to use a lot also tend to get modded here and there for my use, especially for multilanguage use. I guess I’ll have to start making up an archive of the snippets that I’ve customized for multilanguage, along with their language files. <sigh> and I thought I was finished with all that "responsibility" stuff when my kids left home!
                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
                • 19889
                • 616 Posts
                Hello,

                I’m sure the community very much appreciates your efforts!

                Quick question to you: I’m trying to use your language snippet to handle two companies in one website e.g. instead of having English and German, I have company A and company B. Since you’re an expert with this stuff I was wondering how you would set up the following: I’d like to use two different stylesheets - one for company A and the 2nd for company B.

                Do you have any ideas how I could achieve this.

                Thank you in advance for your input
                • The easy way:
                  Use two templates, one for all the pages in section A and one for B, identical except for the stylesheet used.

                  The hard way:
                  create a snippet or TV that determines which section you’re in (would need to check parents of current doc up to "ultimate" parent, the one whose parent is 0) and put that in the template where you normally specify your CSS file.

                  You could hard-code the template names, or name them "1.css, 2.css, etc" and be able to load them dynamically, or maybe even use the [*pagetitle*] of the doc for the name of the css file. Lots of options here.

                  ie "if (ulitmate parent) of current doc has id 1, use firstsite.css"

                  or "use (ultimate parent’s id).css"

                  ( <link rel="stylesheet" type="text/css" href="assets/site/[[GetStylesheet]]" /> )

                  [later...]
                  I even wrote a snippet to get the "ultimate" parent. I’m sure it’s pretty clunky and just about anybody could do it better (and probably already has)! But it works. This won’t give you the CSS file to use, but it does tell you which section you’re in. Using this, if you name your CSS files according to the section’s main doc/folder id, (style1.css, style33.css etc) you could do this in your template:

                  <link rel="stylesheet" type="text/css" href="assets/site/style[[GetUltimateParent]].css" />

                  // GetUltimateParent - MODx snippet
                  // recursively searches the document tree
                  // and returns the "ultimate" parent
                  // (the one whose parent is 0)
                  // of the given document.
                  //
                  // created 18 Sept 2005 by [email protected]
                  // released with LGPL licence
                  // 
                  // [[GetUltimateParent?id=xxx]] 
                  // where xxx is the id of the document 
                  // whose "ultimate" parent you want to find
                  // omit id argument to use current document's id
                  
                  $id = isset($id)?$id:$modx->documentIdentifier;
                  if($id==0) { return false; }
                  $tblsc = $this->getFullTableName("site_content");
                  $sql = "SELECT parent FROM $tblsc WHERE id = '$id'";
                  $result = $modx->dbQuery($sql);
                  $row = $modx->fetchRow($result);
                  $pid = $row['parent'];
                  if($pid == 0) { /* echo $id */ return $id; }
                  while ($pid != 0) {
                      $id = $pid;
                      $sql = "SELECT parent FROM $tblsc WHERE id = '$pid'";
                      $result = $modx->dbQuery($sql);
                      $row = $modx->fetchRow($result);
                      $pid = $row['parent'];
                      if($pid == 0) { /* echo $id */ return $id; }
                  }
                  
                    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
                    • 19889
                    • 616 Posts
                    I’ll certainly give it a try - thank you very much - I’ll also look into the language snippet again and how it maybe can be used to achieve the same - basically I like to use one stylesheet for e.g. English and another one for e.g. Italian.
                    • All you need to do is name your css files according to which language they belong to, then use the [*lang*] tv in the template:

                      <link rel="stylesheet" type="text/css" href="assets/site/style[*lang*].css />

                      Keep in mind, however, that the user has to have cookies enabled for this to work; otherwise he just gets the default language.
                        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