We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36516
    • 179 Posts
    I've tripped over an odd situation with Wayfinder and template chunks. I have a website someone else built, and thus a hypothetical scenario which admittedly is easily worked around, but does raise a question about the template implementation of Wayfinder, specifically.

    In a case there I need a list of links, a menu, but the outer container ('UL') isn't required, either because the original build doesn't include it (in favour of something else largely unimportant, like 'nav' with a load of 'a's inside), I find myself in a situation where, perhaps without wanting to adapt the build to include the expected UL structure, I need simple to drop the outer wrapper and have only the rowTpl stuff.

    So I thought rather than having an essentially empty Tpl chunk containing only [[+wf.wrapper]], I could use "@INLINE [[+wf.wrapper]]. It seemed like a reasonable workaround to simplify the mode of stripping out some of the default functionality.

    Alas, it didn't work. I tried everything I could think of but it seems either I've misunderstood @INLINE, or perhaps the order in which the templates and placeholders are processed, or Wayfinder simple doesn't support @INLINE. In the case of the latter I suggest that unless there's a good reason for not supporting it, this might be something worth adding. It'd be nice to be able to simplify the basic Wayfinder implementation, though in this case you could argue it would actually make more sense to just change the build and use a proper list structure.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Both `@CODE [[+wrapper]]` and `@INLINE [[+wrapper]]` work with pdoMenu (comes with the pdoTools extra - also works with [[+wf.wrapper]])
        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
        • 36516
        • 179 Posts
        Good tip, thanks. Question stands for what people are surely still considering 'standard', in the form of Wayfinder etc.

        This is the second time in the last few days I've read 'pdoXXXXX'. I'm not a heavy modx user (yet) so forgive my ignorance, but is this apparently new development fast becoming an accepted standard? Will it eventually supersede Wayfinder etc? If performance is the order of the day (hells yeah) I can imagine something like pdoMenu but with a less 'unofficial' sounding name will be brought forth as a general replacement nobody in their right mind would ignore.

        I'd also like to understand what fundamental coding difference pdoTools employs that gives it such a performance benefit that wasn't leverages by the likes of Wayfinder in the first place. What's it doing that Wayfinder doesn't do, and is Wayfinder inferior as a result, or just different, and for what reason?

        I think I've developed a habit of hijacking my own threads...
          • 36516
          • 179 Posts
          I've just been consulting the MIGX documentation and one of the examples uses @CODE, so now I'm not sure what the difference is between @INLINE and @CODE, and whether the latter would have worked with Wayfinder as I intended.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            It looks like individual add-ons allow for @CODE or @INLINE at the discretion of the add-on developer.
              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
              • 36516
              • 179 Posts
              So... are you saying they're interchangeable? They do the same thing, all down to preference? So I could try my plan with Wayfinder using @CODE instead to see if that works.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Yes. I don't happen to have a Wayfinder installed, so I can't check the snippet code, but pdoTools does check for both, as well as for @FILE to allow use of a file for the tpl. It actually takes the inline code and generates a chunk object out of it, then lets MODX take care of parsing for placeholders as usual.
                			case 'CODE':
                			case 'INLINE':
                				$element = $this->modx->newObject('modChunk', array('name' => md5($name)));
                				$element->setContent($content);
                				$this->addTime('Created inline chunk');
                				break;
                
                  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