We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5699
    • 46 Posts
    computersolutions.cn Reply #41, 20 years, 3 months ago
    I’ve added the necessary bits to make the language vars work, but I’m getting wierdness.

    Site structure is something like this:

    English (1)
    About
    Forum

    Chinese (21)
    About
    Forum


    If I click on English, I get the *lang* variable changing to 1
    If I click on Chinese, I get the *lang* variable changing to 21.

    So far so good.

    However, if I click on one of Chinese’s submenu’s the lang variable changes magically to 1 again.

    Seems the cookie isn’t changing automagically. I’ve tried in both Firefox and IE6, both exhibit same symptoms.

    Any idea’s?
      • 19337
      • 18 Posts
      Hi together

      Somehow I think I’m not that smart like others. Ok English is not my native language, possibly that’s causing me problems setting up the Multilanguage support.

      I would like to do the same thing like "whitehat".
      - A top menu with the language to choose, German as default. (Could do this)
      - Another top menu with the content of the subfolders of the German folder. (Could do this partially)
      - And a third right menu with the content of the sub items of the subfolders. (Could not get that done)

      See attached pictures.
      My menu tree:
      tree.png

      The right mane page, everything fine, except the right menu.
      MainPage.png

      After clicking "Drogerie", the language "Deutsch" is not selected anymore, the main navigation menu swaps its place with the right menu.
      ClickingASubmenu.png

      Here the important parts of my template code:

      <div id="toptabs">        
                [!DropMenu?startDoc=`[*StartDoc*]` &levelLimit=`1`!]
                </div>


      <div id="navitabs">
               <h2 class="hide">Site menu:</h2>
               [!DropMenu?startDoc=`[*id*]`&levelLimit=`1`!]
               </div>


      <div id="sideMenu">
                [!DropMenu?startDoc=`[*id*]`&levelLimit=`1`!]
                </div>


      I would be glad if someone can help me.
      Thanks in advance
      Michel
        film:projekt ------------------- autodidakten
        • 24330
        • 28 Posts
        I’d like to use this solution with the AListApart menu snippet, on an existing site that uses MODx: http://etcth.org
        to add a subset of the existing English pages in Thai.
        (I think this AListApart snippet may be called something else, see the code below.)

        Will this work? I’ve started by following the tutorial Susan posted in this thread, but when I move the existing pages from the root level into an ’English’ folder, the nav menu on the site got crammed into one ’English’ dropdown menu with no additional levels, so I got a little spooked and moved everything back out and unpublished the folder. Anyone have some experience with this snippet and this multilanguage solution?

        Thanks in advance for your advice and help!

        - Rafael

        Menu snippet code:

        ############################
        #      CONFIGURATION       #
        ############################
        /*The standard ID if there is no id specified in the snippet call.
        This is an integer, a number, so don't use quotes.*/
        
        $standardId = 0;
        
        /*The class to use for the first ul tag. Set to 'id="nav"' if you
        have only one ALA menu.*/
        
        $ulTag = 'id="nav"';
        
        /*the tag used for opening a blank window when the document is a
        weblink. You can also use ' target="_blank"' if you want, but that
        won't be valid html. Refer to the section below on how to do the 
        opening of a new window with rel="external". Make sure you use one 
        space by the way.*/
        
        $webLink = ' rel="external"';
        
        /*the class or id to use for the current document. Also use a 
        space in the begin*/
        
        $currentTag = ' id="current"';
        ############################
        #    HTML STRICT LINKS     #
        ############################
        /* Copy the following code into the head section of your template,
        or put it in a seperate .js file if you know how:
        
        <script type="text/javascript">
        <!--
        function externalLinks() {
        	if (!document.getElementsByTagName) return;
        	var anchors = document.getElementsByTagName("a");
        	for (var i=0; i<anchors.length; i++) {
        		var anchor = anchors[i];
        		if (anchor.getAttribute("href") 
        		&& anchor.getAttribute("rel") == "external")
        		anchor.target = "_blank";
        	}
        }
        window.onload = externalLinks
        //-->
        </script>
        
        That will ensure links with rel="external" will open in new windows.
        */
        ############################
        #     NO EDITING BELOW     #
        ############################
        $id = isset($id) ? $id : $standardId ;
        $listLevel = isset($listLevel) ? $listLevel : 0;
        $thisSnippet = $etomite->getSnippetName();
        
        $children = $etomite->getActiveChildren($id,'menuindex','ASC','id, pagetitle, description, type, isfolder');
        if(!$children) { return '';	}
        
        $output .= $listLevel==0 ? '<ul ' . $ulTag .'>' : '<ul>' ;
        $listLevel++;
        
        foreach($children as $child) {
        	$linkTitle = $child['description'] ? ' title="' . $child['description'] . '"' : '' ;
        	$openWindow = $child['type']=="reference" ? $webLink : '' ;
        	$current = $child['id']==$etomite->documentIdentifier ? $currentTag : '' ;
                $output .= '<li';
                $output.= $child['isfolder']? ' class="menuparent" ' : '';
        	$output .= '><a href="[~' . $child['id'] . '~]"' . $linkTitle . $openWindow . $current . '>' .$child['pagetitle'] . '</a>';
        	$output .= $child['isfolder'] ? '[[' . $thisSnippet . '?id=' . $child['id'] . '&listLevel=' . $listLevel . ']]': '' ;
        	$output .= '</li>';
        }
        $output .= '</ul>';
        return $output;
        
          Rafael
          • 30807
          • 25 Posts
          Hello,

          Does it exist a synthetic method somewhere like in the FAQ or the documentation or a snippet/plugins in the download section? huh
            • 32942
            • 141 Posts
            Hi!

            This is my first post here tongue

            OK, I like the idea of i8n (Internationalization) and g8n (globalization) very much, but I see big problems with that script in future.
            I mean if you have a big site, you’r way of handling with variables will make big perfomanceloss.
            Where do I know that? I coded a chess system with i8n a long while ago (then left that company by the way the game I coded is located under http://games.vatansesi.com/chess/ and I hatet it forever) and recognized that 10000 Arrays are faster than 10000 Variables.
            And on the other hand I really don’t like the idea to code each site in a new folder and language. I’ts a quirk in my opinion, but not a solution.

            I solved that problem this way: I coded empty Array containers that are able to be filled with information from any language and charset.
            That information comes from a folder called languages which contains something like a database of words and sentences etc.
            An example - help.php :

            array[help] = $help;

            a file called help.lang.en.php
            contains the information "help" that is associated with %help%
            ---------------------------------------------------------
            OK lets assume you don’t want to solve that problem this way.. cuz this needs to hack the core.

            But, I suggest you to solve i8n however you want but standards compliant ;-)
            http://www-306.ibm.com/software/globalization/icu/index.jsp
            http://icu.sourceforge.net/download/

            I see that we need an icu package for PHP...hmm maybe there is one in the jungle of google?
            I hope u don’t misunderstand this, I just want to help you by giving meaningful critics.
            mb plz
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              I am in complete agreement with you. This was just my solution for a fairly small and simple site. Others far more competent than I in this field are working on much more effective solutions.
                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
                • 32942
                • 141 Posts
                wow incredibly fast answer laugh
                  • 32942
                  • 141 Posts
                  oh nooooooo I’m member number 666+additional 6 soo evil?
                  the internet doesn like me rolleyes
                    • 24330
                    • 28 Posts
                    Quote from: sottwell at Oct 26, 2006, 11:20 PM

                    Others far more competent than I in this field are working on much more effective solutions.

                    Who is working on these solutions? Are any of them currently available?
                    Please provide links if you have them. Thanks! grin
                      Rafael
                      • 25663 MODX Staff
                      • 12,272 Posts
                      Yes, it’s call the releases after the imminent 0.9.5 release. But nothing’s publicly available or ready yet.
                        Ryan Thrash, MODX Co-Founder
                        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me