We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27519
    • 275 Posts
    My custom component menu item keeps ignoring the lexicon values.

    - Created a namespace named bookingsystem pointing to core/components/bookingsystem
    - Created an action controller in above namespace pointing to bookingsystem:default for its language topics
    - Created a menu item with correct lexicon keys for name and description
    - Created the lexicon file default.inc.php in the directory lexicon/en inside the directory to which the namespace is pointing
    - Cleared the cache

    Still, in the menu the lexicon keys show up in stead of their values.

    MODx "sees" the lexicon file as their keys/values show up in System->Lexicon Management.

    Also, if I choose the option from the Component menu, the Smarty tpl is shown.

    Any clues to what I might have missed??
      MODx Revolution / MAMP / OS X
      • 28215
      • 4,149 Posts
      During CMP development, it’s a good idea to set ’cache_noncore_lexicon_topics’ to 0, or No.

      Try that and see if that helps.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 27519
        • 275 Posts
        Thanks.

        I switched it to No but it’s still showing the keys in stead of the values...

        Baffled... huh
          MODx Revolution / MAMP / OS X
          • 28215
          • 4,149 Posts
          Can you post exactly what your Menu looks like? (The Update window)
            shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
            • 27519
            • 275 Posts
            I’ve attached the update window of both the action and the menu.

            Is that what you’re looking for?
              MODx Revolution / MAMP / OS X
              • 28215
              • 4,149 Posts
              And your lexicon keys are named:

              $_lang[’bs.inserttarrif’]
              $_lang[’bs.inserttarrif.description’]

              and in the default topic file, which should be in your ’bookingsystem’ Namespace’s path/lexicon/en/ ?

              You’ve cleared the cache? They should show up, unless you’ve done something wrong.
                shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                • 27519
                • 275 Posts
                The file contents look like:

                <?php
                $_lang['bs.inserttarif'] = 'Build Tariff';
                $_lang['bs.inserttarif.description'] = 'Insert new tariff records';
                


                The file is located in lexicon/en (see attached screenshot).

                The cache was cleared and I switched that system setting of ’cache_noncore_lexicon_topics’ to No.



                  MODx Revolution / MAMP / OS X
                  • 28215
                  • 4,149 Posts
                  Can you post the contents of your inserttarriff.php file, as well as your Namespace’s path, and then give your computer a swift slap, because this should be working?

                  Also, make sure when you empty the cache that the cache/mgr/menus.cache.php file is being erased.

                  FYI, the code that generates the menu lexicons is:

                  $namespace = $menu->get('namespace');
                  if ($namespace != null && $namespace != 'core') {
                      $this->xpdo->lexicon->load($namespace.':default');
                      $ma['text'] = $this->xpdo->lexicon($menu->get('text'));
                  } else {
                      $ma['text'] = $this->xpdo->lexicon($menu->get('text'));
                  }


                  So I see no reason why it shouldnt be working.
                    shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                    • 27519
                    • 275 Posts
                    The contents of insert-tariff.php are:

                    <?php
                    
                    	return $modx->smarty->fetch( 'insert-tariff.tpl' );
                    	
                    ?>
                    


                    This actually works, as the contents of the tpl (for now just a simple "Hello world) are shown inside MODx manager frame when I choose the option from the "Components" menu.

                    See the screen shot for the path.

                    I see a menus.cache.php in the cache directory. Can I manually delete it?

                    I’ve been slapping that !@$%^ computer all afternoon... >:(

                      MODx Revolution / MAMP / OS X
                      • 28215
                      • 4,149 Posts
                      Definitely delete it and see if that helps.
                        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com