We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    2. Yes, you need to use pdoMenu with some special properties.
        <nav>
            [[!pdoMenu? 
                &startId=`0` 
                &level=`1`
                &includeTVs=`mml_pagetitle`
                &prepareTVs=`1`
                &tvPrefix=`tv.`
                &loadModels=`migxmultilang`
                &prepareSnippet = `mmlTranslatePdoToolsRow`
                &tpl=`mml_MenuRowTpl`
            ]]
        </nav>
    
    

    https://github.com/Bruno17/migxmultilang/blob/master/readme.md
      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
      • 37047 ☆ A M B ☆
      • 309 Posts
      Thanks Susan. I have a very complex wayfinder menu in place now - something tells me this won't be an easy switch. Guess I'll be reading up on pdoMenu this weekend. smiley
        Lucy Iannotti
        Following Sea design & development
        http://www.following-sea.com
        New Bedford, MA
        • 4172
        • 5,888 Posts
        Quote from: lucy at Feb 27, 2015, 03:55 PM
        Issues I am having:

        1. Want to use the default resource fields for the default language and use the standard placeholders (longtitle instead of mml_longtitle). This works for pagetitle and longtitle, but not for content. Using +content in the template chunk, the secondary language (Portuguese) is translated, but the default language (English) is missing entirely. If I use +content immediately following by *content in the template, I get two instances of English content on the English page, and one instance of Portuguese content and one of English content on the Portuguese page.


        Did you try with &includeContent?

        [[!mmlCache?
          &element=`pdoResources`
          &parents=`0`
          &resources=`[[*id]]`
          &tpl=`MainTpl`
          &includeTVs=`[[mmlGetTemplateTVs]]`
          &prepareTVs=`1`
          &processTVs=`1`
          &includeContent=`1`
          &tvPrefix=``
          &loadModels=`migxmultilang`
          &prepareSnippet = `mmlTranslatePdoToolsRow`
        ]]
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 37047 ☆ A M B ☆
          • 309 Posts
          Oh that did it, thanks!!!

          (This is still one of those MODX things that often trips me up; I wonder if it wouldn't be better to treat the content field as just another TV in a resource.)
            Lucy Iannotti
            Following Sea design & development
            http://www.following-sea.com
            New Bedford, MA
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Not really, you want the listing snippets to run as lean as possible, and usually you don't need the content. So it's better for them to default to not including the content, while providing a property to allow it if it's wanted. The same principle applies with TVs. You seldom want to use all TVs that may be associated with a resource, so it's better to require a list of specific TVs that are wanted.
              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
              • 37047 ☆ A M B ☆
              • 309 Posts
              I'm an odd duck I guess. I more often than not want the content too. But of course you're right leaner is better (except for hamburgers).
                Lucy Iannotti
                Following Sea design & development
                http://www.following-sea.com
                New Bedford, MA
                • 37047 ☆ A M B ☆
                • 309 Posts
                Changed the Wayfinder menu to pdoMenu, and the menu works (almost) as before but I'm still not able to get translations working for menu titles. Also now all the titles on the links are missing.

                Here is the snippet:
                      [[!pdoMenu? 
                            &startId=`0` 
                            &level=`2`
                            &includeTVs=`mml_pagetitle,mml_menutitle,pagetitle,menutitle`
                            &prepareTVs=`1`
                            &tvPrefix=``
                            &loadModels=`migxmultilang`
                            &prepareSnippet=`mmlTranslatePdoToolsRow`
                            &tpl=`nb_mml_MenuRowTpl`
                            &innerTpl=`nbInnerTpl`
                            &outerTpl=`nbOuterTpl`
                            &parentRowTpl=`nbParentRow`
                            &innerRowTpl=`nbInnerRowTpl`
                            &innerClass=`flyout`
                            &parentClass=`has-flyout`
                            ]]


                For &includeTVs I have tried all possible combinations of the 4 TVs in the code above, not being sure whether it needs the mml_ TVs or the standard resource TVs.
                For &tvPrefix I have tried with tv. (as shown in the github example) as well as empty.

                And here is the tpl:
                <li [[+id]] class="[[+classnames]]">
                <a href="[[+link]]" title="[[+pagetitle]]" [[+attributes]]>[[+menutitle]]</a>
                [[+wrapper]]
                </li>


                Here is the log output:
                0.0000579: Loaded model "migxmultilang" from "/core/components/migxmultilang/model/"
                0.0061951: pdoTools loaded
                0.0000410: xPDO query object created
                0.0007441: Included list of tvs: mml_pagetitle, mml_menutitle
                0.0004299: leftJoined modTemplateVarResource as TVmml_pagetitle
                0.0004141: leftJoined modTemplateVarResource as TVmml_menutitle
                0.0006921: Added selection of modResource: SQL_CALC_FOUND_ROWS `id`, `type`, `contentType`, `pagetitle`, `longtitle`, `description`, `alias`, `link_attributes`, `published`, `pub_date`, `unpub_date`, `parent`, `isfolder`, `introtext`, `content`, `richtext`, `template`, `menuindex`, `searchable`, `cacheable`, `createdby`, `createdon`, `editedby`, `editedon`, `deleted`, `deletedon`, `deletedby`, `publishedon`, `publishedby`, `menutitle`, `donthit`, `privateweb`, `privatemgr`, `content_dispo`, `hidemenu`, `class_key`, `context_key`, `content_type`, `uri`, `uri_override`, `hide_children_in_tree`, `show_in_tree`, `properties`
                0.0000191: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `mml_pagetitle`
                0.0000231: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `mml_menutitle`
                0.0000679: Processed additional conditions
                0.0009401: Added where condition: modResource.parent:IN(1,5,14,15,16,23,57,119,84,2,3,122), OR:modResource.id:IN(1,5,14,15,16,23,57,119,84,2,3,122), modResource.published=1, modResource.hidemenu=0, modResource.deleted=0, modResource.context_key=web
                0.0000720: Replaced TV conditions
                0.0002320: Sorted by modResource.menuindex, ASC
                0.0005479: SQL prepared "SELECT SQL_CALC_FOUND_ROWS `modResource`.`id`, `modResource`.`type`, `modResource`.`contentType`, `modResource`.`pagetitle`, `modResource`.`longtitle`, `modResource`.`description`, `modResource`.`alias`, `modResource`.`link_attributes`, `modResource`.`published`, `modResource`.`pub_date`, `modResource`.`unpub_date`, `modResource`.`parent`, `modResource`.`isfolder`, `modResource`.`introtext`, `modResource`.`content`, `modResource`.`richtext`, `modResource`.`template`, `modResource`.`menuindex`, `modResource`.`searchable`, `modResource`.`cacheable`, `modResource`.`createdby`, `modResource`.`createdon`, `modResource`.`editedby`, `modResource`.`editedon`, `modResource`.`deleted`, `modResource`.`deletedon`, `modResource`.`deletedby`, `modResource`.`publishedon`, `modResource`.`publishedby`, `modResource`.`menutitle`, `modResource`.`donthit`, `modResource`.`privateweb`, `modResource`.`privatemgr`, `modResource`.`content_dispo`, `modResource`.`hidemenu`, `modResource`.`class_key`, `modResource`.`context_key`, `modResource`.`content_type`, `modResource`.`uri`, `modResource`.`uri_override`, `modResource`.`hide_children_in_tree`, `modResource`.`show_in_tree`, `modResource`.`properties`, IFNULL(`TVmml_pagetitle`.`value`, '') AS `mml_pagetitle`, IFNULL(`TVmml_menutitle`.`value`, '') AS `mml_menutitle` FROM `modx_site_content` AS `modResource` LEFT JOIN `modx_site_tmplvar_contentvalues` `TVmml_pagetitle` ON `TVmml_pagetitle`.`contentid` = `modResource`.`id` AND `TVmml_pagetitle`.`tmplvarid` = 13 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVmml_menutitle` ON `TVmml_menutitle`.`contentid` = `modResource`.`id` AND `TVmml_menutitle`.`tmplvarid` = 15 WHERE  (  ( `modResource`.`parent` IN (1,5,14,15,16,23,57,119,84,2,3,122) OR `modResource`.`id` IN (1,5,14,15,16,23,57,119,84,2,3,122) )  AND `modResource`.`published` = 1 AND `modResource`.`hidemenu` = 0 AND `modResource`.`deleted` = 0 AND `modResource`.`context_key` = 'web' )  ORDER BY modResource.menuindex ASC "
                0.0018351: SQL executed
                0.0001340: Total rows: 29
                0.0005078: Rows fetched
                0.0042300: Could not process or prepare TV "pagetitle"
                0.0008240: Could not process or prepare TV "menutitle"
                  (above two lines repeated many times)
                0.0508130: Prepared and processed TVs
                0.0000651: Returning raw data
                0.0001359: Tree was built
                0.0000179: Start template tree
                0.0046210: Loaded chunk "nbInnerRowTpl"
                0.0271020: Loaded chunk "nbInnerTpl"
                0.0020630: Loaded chunk "nbParentRow"
                0.0543509: Loaded chunk "nb_mml_MenuRowTpl"
                0.0684142: End template tree
                0.0017428: Loaded chunk "nbOuterTpl"
                0.2225370: Total time
                9 175 040: Memory usage
                [ed. note: lucy last edited this post 11 years, 6 months ago.]
                  Lucy Iannotti
                  Following Sea design & development
                  http://www.following-sea.com
                  New Bedford, MA
                  • 37047 ☆ A M B ☆
                  • 309 Posts
                  I have a bunch of errors in the log:

                  (ERROR @ /connectors/workspace/packages.php) Could not open file for reading: migx-2.3.2-pl.transport.zip?revolution_version=Revolution-2.2.15-pl
                  (ERROR @ /connectors/workspace/packages.php) MODX could not download the file. You must enable allow_url_fopen, cURL or fsockopen to use remote transport packaging.
                  (ERROR @ /connectors/workspace/packages.php) Could not transfer package migx-2.3.2-pl.transport.zip to /paas/c1764/www/core/packages/.
                  (ERROR @ /assets/components/migx/connector.php) Path specified for package migxmultilang is not a valid or accessible directory: /paas/c1764/www/core/components/ migxmultilang/model/
                  (ERROR @ /assets/components/migx/connector.php) Could not find specified XML schema file /paas/c1764/www/core/components/ migxmultilang/model/schema/ migxmultilang.mysql.schema.xml

                  And these repeated multiple times:

                  (ERROR @ /assets/components/migx/connector.php) Could not load class: mmlFormtabs from mysql.mmlformtabs.
                  (ERROR @ /assets/components/migx/connector.php) mmlFormtabs::load() is not a valid static method.

                  (ERROR @ /paas/c1764/www/core/components/migx/model/migx/migx.class.php : 2261) PHP warning: Invalid argument supplied for foreach()

                  It's a MODX Cloud site. Maybe I need to uninstall MIGX and MML and reinstall?
                    Lucy Iannotti
                    Following Sea design & development
                    http://www.following-sea.com
                    New Bedford, MA
                    • 37047 ☆ A M B ☆
                    • 309 Posts
                    I am also having this issue with pdoResources -- posting it here because I suspect it has more to do with an error in my MML setup and not pdoTools (but I could be wrong about that!)

                    I am revising a getResources call to use pdoResources instead so that it will work with the MML translations. The site is in MODX Cloud, Revo 2.2.15, uses pdoTools 1.10.1, MIGX 2.9.0, migxMultiLang 1.0.8

                    This is the snippet call; it is listing the pagetitle and longtitle of the page the snippet resides in (3x), rather than the expected listing of the children of resource ID 61. I have tried with and without the mml-specific TVs, without processTVs, with and without tvPrefix. Don't know what else to try. (The original getResources call worked fine.)

                    [[!pdoResources? 
                    &parents=`61`
                    &limit=`3`
                    &sortdir=`ASC` 
                    &sortby=`menuindex`
                    &showHidden=`1`
                    &tpl=`@INLINE <h4><small><a href="[[~61]]" title="[[+pagetitle]]">[[+longtitle]]</a></small></h4>`
                    &includeTVs=`mml_pagetitle,mml_longtitle,mml_menutitle,pagetitle,longtitle,menutitle`
                    &prepareTVs=`1`
                    &processTVs=`1`
                    &tvPrefix=``
                    &loadModels=`migxmultilang`
                    &prepareSnippet=`mmlTranslatePdoToolsRow`
                    ]]


                    Here is the log output:
                    0.0000560: Loaded model "migxmultilang" from "/core/components/migxmultilang/model/"
                    0.0001111: pdoTools loaded
                    0.0000401: xPDO query object created
                    0.0008330: Included list of tvs: SidebarModules, mml_pagetitle, mml_longtitle, mml_menutitle
                    0.0004351: leftJoined modTemplateVarResource as TVsidebarmodules
                    0.0003960: leftJoined modTemplateVarResource as TVmml_pagetitle
                    0.0003979: leftJoined modTemplateVarResource as TVmml_longtitle
                    0.0003870: leftJoined modTemplateVarResource as TVmml_menutitle
                    0.0006969: Added selection of modResource: SQL_CALC_FOUND_ROWS `id`, `type`, `contentType`, `pagetitle`, `longtitle`, `description`, `alias`, `link_attributes`, `published`, `pub_date`, `unpub_date`, `parent`, `isfolder`, `introtext`, `richtext`, `template`, `menuindex`, `searchable`, `cacheable`, `createdby`, `createdon`, `editedby`, `editedon`, `deleted`, `deletedon`, `deletedby`, `publishedon`, `publishedby`, `menutitle`, `donthit`, `privateweb`, `privatemgr`, `content_dispo`, `hidemenu`, `class_key`, `context_key`, `content_type`, `uri`, `uri_override`, `hide_children_in_tree`, `show_in_tree`, `properties`
                    0.0000179: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `SidebarModules`
                    0.0000162: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `mml_pagetitle`
                    0.0000141: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `mml_longtitle`
                    0.0000141: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `mml_menutitle`
                    0.0008130: Processed additional conditions
                    0.0012710: Added where condition: modResource.parent:IN(61,238,237,236,100,81,63,62), modResource.published=1, modResource.deleted=0
                    0.0000498: Replaced TV conditions
                    0.0002000: Sorted by modResource.menuindex, ASC
                    0.0000041: Limited to 3, offset 0
                    0.0005240: SQL prepared "SELECT SQL_CALC_FOUND_ROWS `modResource`.`id`, `modResource`.`type`, `modResource`.`contentType`, `modResource`.`pagetitle`, `modResource`.`longtitle`, `modResource`.`description`, `modResource`.`alias`, `modResource`.`link_attributes`, `modResource`.`published`, `modResource`.`pub_date`, `modResource`.`unpub_date`, `modResource`.`parent`, `modResource`.`isfolder`, `modResource`.`introtext`, `modResource`.`richtext`, `modResource`.`template`, `modResource`.`menuindex`, `modResource`.`searchable`, `modResource`.`cacheable`, `modResource`.`createdby`, `modResource`.`createdon`, `modResource`.`editedby`, `modResource`.`editedon`, `modResource`.`deleted`, `modResource`.`deletedon`, `modResource`.`deletedby`, `modResource`.`publishedon`, `modResource`.`publishedby`, `modResource`.`menutitle`, `modResource`.`donthit`, `modResource`.`privateweb`, `modResource`.`privatemgr`, `modResource`.`content_dispo`, `modResource`.`hidemenu`, `modResource`.`class_key`, `modResource`.`context_key`, `modResource`.`content_type`, `modResource`.`uri`, `modResource`.`uri_override`, `modResource`.`hide_children_in_tree`, `modResource`.`show_in_tree`, `modResource`.`properties`, IFNULL(`TVsidebarmodules`.`value`, '') AS `SidebarModules`, IFNULL(`TVmml_pagetitle`.`value`, '') AS `mml_pagetitle`, IFNULL(`TVmml_longtitle`.`value`, '') AS `mml_longtitle`, IFNULL(`TVmml_menutitle`.`value`, '') AS `mml_menutitle` FROM `modx_site_content` AS `modResource` LEFT JOIN `modx_site_tmplvar_contentvalues` `TVsidebarmodules` ON `TVsidebarmodules`.`contentid` = `modResource`.`id` AND `TVsidebarmodules`.`tmplvarid` = 9 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVmml_pagetitle` ON `TVmml_pagetitle`.`contentid` = `modResource`.`id` AND `TVmml_pagetitle`.`tmplvarid` = 13 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVmml_longtitle` ON `TVmml_longtitle`.`contentid` = `modResource`.`id` AND `TVmml_longtitle`.`tmplvarid` = 14 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVmml_menutitle` ON `TVmml_menutitle`.`contentid` = `modResource`.`id` AND `TVmml_menutitle`.`tmplvarid` = 15 WHERE  ( `modResource`.`parent` IN (61,238,237,236,100,81,63,62) AND `modResource`.`published` = 1 AND `modResource`.`deleted` = 0 )  ORDER BY modResource.menuindex ASC LIMIT 3 "
                    0.0008991: SQL executed
                    0.0001600: Total rows: 5
                    0.0000610: Rows fetched
                    0.0055690: Could not process or prepare TV "pagetitle"
                    0.0007679: Could not process or prepare TV "longtitle"
                    0.0007710: Could not process or prepare TV "menutitle"
                    0.0023730: Could not process or prepare TV "pagetitle"
                    0.0007720: Could not process or prepare TV "longtitle"
                    0.0007648: Could not process or prepare TV "menutitle"
                    0.0008512: Could not process or prepare TV "pagetitle"
                    0.0007470: Could not process or prepare TV "longtitle"
                    0.0007420: Could not process or prepare TV "menutitle"
                    0.0133801: Prepared and processed TVs
                    0.0020671: Created inline chunk
                    0.0031941: Returning processed chunks
                    0.0234151: Total time
                    9 699 328: Memory usage
                    [ed. note: lucy last edited this post 11 years, 6 months ago.]
                      Lucy Iannotti
                      Following Sea design & development
                      http://www.following-sea.com
                      New Bedford, MA
                      • 4172
                      • 5,888 Posts
                      Try to start with the simple call from instructions directly in your tpl-chunk, called from the mmlCache snippet:

                              [[!pdoMenu? 
                                  &startId=`0` 
                                  &level=`1`
                                  &includeTVs=`mml_pagetitle,mml_menutitle`
                                  &prepareTVs=`1`
                                  &tvPrefix=`tv.`
                                  &loadModels=`migxmultilang`
                                  &prepareSnippet = `mmlTranslatePdoToolsRow`
                                  &tpl=`mml_MenuRowTpl`
                              ]]


                      Does this translate?
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!