We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14404
    • 84 Posts
    Guys,

    I need your help, I’m having this ditto call: Dealers in Europe

    [[Ditto? &parents=`161` &tpl=`country`]]


    This chunk for tpl: country

    <a href="#" onclick="toggle_visibility('country');"><h1>[+pagetitle+]</h1></a>
    <div id="country" style="display:none; width:100px;">[+introtext+]</div>
    


    Pagetitle does show, introtext doesn’t. I have no clue whats wrong, even when i put it somewhere else, it just doesn’t display anything :S Also when i put the YAMS code:
    [[YAMS? &get=`data` &docid=`[+wf.docid+]` &from=`pagetitle`]]
    
    in the country tpl it doesn’t show anything.. what to do?

    By the way, the template contains this code for the javascript action:
    <script type="text/javascript">
    <!--
        function toggle_visibility(id) {
           var e = document.getElementById(id);
           if(e.style.display == 'block')
              e.style.display = 'none';
           else
              e.style.display = 'block';
        }
    //-->
    </script>

    Script is working!

    Cheers
      • 14404
      • 84 Posts
      Btw, even when im just using a plain template like: <h1>[+pagetitle+[</h1> <p>[+content+[/p] or <p>[+introtext+]</p> it doesn’t work.. See http://manter.com/nl/contact-nl/contact-dealers-nl/europa for the result
        • 5340
        • 1,624 Posts
        Quote from: Joeeeeh at Mar 18, 2010, 08:06 AM

        Btw, even when im just using a plain template like: <h1>[+pagetitle+[</h1> <p>[+content+[/p] or <p>[+introtext+]</p> it doesn’t work.. See http://manter.com/nl/contact-nl/contact-dealers-nl/europa for the result

        Change

        <h1>[+pagetitle+[</h1> <p>[+content+[/p] or <p>[+introtext+]</p>

        to

        <h1>[+pagetitle+]</h1> <p>[+content+]</p> or <p>[+introtext+]</p>
          • 14404
          • 84 Posts
          Quote from: cipa at Mar 18, 2010, 08:15 AM

          Quote from: Joeeeeh at Mar 18, 2010, 08:06 AM

          Btw, even when im just using a plain template like: <h1>[+pagetitle+[</h1> <p>[+content+[/p] or <p>[+introtext+]</p> it doesn’t work.. See http://manter.com/nl/contact-nl/contact-dealers-nl/europa for the result

          Change

          <h1>[+pagetitle+[</h1> <p>[+content+[/p] or <p>[+introtext+]</p>

          to

          <h1>[+pagetitle+]</h1> <p>[+content+]</p> or <p>[+introtext+]</p>

          Haha im sorry, was writing too fast i guess, thats what i have wink
            • 27672
            • 168 Posts
            <a href="#" onclick="toggle_visibility(’country’);"><h1>[+pagetitle+]</h1></a>
            <div id="country" style="display:none; width:100px;">[+introtext+]</div>

            if this tpl is getting called multiple times you’re going to have a bunch of divs with the id of "country", so your js call probably will not work, and since you have your "display:none;" styled in line on your div, it won’t show.

            your template only contains:
            <h1>[+pagetitle+]</h1><div style="width:100px;">[+introtext+]</div>

            what happens? i see no reason that shouldn’t work, then get the javascript working.

            for example i use this tpl in a ditto call:
            <p><a href="[~[+id+]~]"><strong>[+menutitle+]</strong> »</a><br />[+introtext+]</p>

            it’s very similar to your’s and works just fine.
              • 14404
              • 84 Posts
              Yes but thats the problem, things like that were always working, and still working.. but not in this case? even when i remove all the JS.. The problem was that it just didnt show the content or the introtext, i’v changed the ditto call to:

              [!Ditto? &id=`(yams_id)` &language=`(yams_mname)` &tpl=`country` &dateFormat=`%d. %B %Y` &extenders=`@FILE assets/modules/yams/yams.extender.inc.php` &trunc=`true` &truncOffset=`15` &truncLen=`120` &orderBy=`menuindex ASC` !]


              and now it is working.. BUT, there is still a problem. It only works for the languages i’v filled in the content.. the [*content_en*] in fr/de/nl arent working. It shows the ditto call as you can see on http://manter.com/de/kontakt/contact-dealers-de/europe-de Only french works because i’v added it.. does anyone knows how to solve this problem?
                • 14404
                • 84 Posts
                Well, it doesn’t pick the content from the right document.. whats wrong?
                It takes the content from the parent folder instead of the childs:S
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Using [*...*] will get the value for the current page (the page the Ditto call is on, not necessarily the &parents defined page). The chunk tpl is being applied from the parent page to the content of each child page in turn. So always [*...*] will apply to the value for the page the snippet call is on while the [+...+] placeholders are applied to the chunk tpl over and over again as it loops through the child pages.
                    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
                    • 14404
                    • 84 Posts
                    Well, i’m not using any [**]’s in the tpl.. this is how it looks now:

                    <div id="country" style="width:240px; float:left">
                    <div style="float:left"><a href="[~[+id+]~]"><img src="[+countryflag+]" height="18px" width="26px"> </div>
                    <div style="float:left"><h1>[+pagetitle+]</h1></a></div>
                    <div id="landen">
                    <br>
                    [+content+]
                    </div>
                    </div>


                    And the Ditto call:
                    [!Ditto? &id=`(yams_id)` &language=`(yams_mname)` &tpl=`country` &dateFormat=`%d. %B %Y` &extenders=`@FILE assets/modules/yams/yams.extender.inc.php` &trunc=`true` &truncOffset=`15` &truncLen=`120` &orderBy=`menuindex ASC`!]


                    And the output:

                    Dutch version:
                    http://manter.com/nl/contact-nl/contact-dealers-nl/europa


                    English version:
                    http://manter.com/en/contact/contact-dealers/europe-en


                    The content_en is the Ditto call, content_nl is [*content_en*]

                    content_en on the subpage The Netherlands is what you see in
                    http://manter.com/en/contact/contact-dealers/europe-en


                    content_nl on the subpage The Netherlands is [*content_en*] and it shows
                    http://manter.com/nl/contact-nl/contact-dealers-nl/europa


                    So, whats wrong here?:S
                      • 22851
                      • 805 Posts
                      Hi Joeeeh. As explained by Sottwell, the problem is the [*content_en*] that you have placed in the [*content_nl*] of the source document that gets pulled into your ditto output. When Ditto grabs the content for the Dutch field it outputs it as [*content_en*] - which then gets evaluated in the context of the document where the Ditto snippet is rather than the context of the source document.

                      I haven’t tried this, but to get what you want you could try using something like: ((yams_data:[+id+]:content_en)) instead of [*content_en*] in the Dutch content field.

                      In the context of the source document, I *think* [+id+] will get evaluated as [*id*] - the id of the source document - and YAMS will evaluate the yams_data placeholder to get the result you want. In the context of the Ditto snippet, Ditto will also evaluate [+id+] as the id of the source document and hence you will still get the result that you want.
                        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.