The code I’m trying to integrate is really nothing more than two "require once" statements and a few echos. The echos make sense - but what about the "require once" statements? Those don’t seem to work well in a snippet. Am I not using them right? Is there a different way to use them in a snippet, or do they not belong in a snippet?
Thanks again for your help.
require / include calls work fine in modx snippets - you just have to make sure you’re using correct paths. Both absolute and relative paths should work.
-
☆ A M B ☆
- 24,524 Posts
It’s also a good way to allow config files in a snippet instead of a long string of parameters in the snippet call. Just check if the $include is set (&include=`file`), and include that file if it is, or a sane default if it isn’t. Wayfinder and I believe Ditto work that way now. Very convenient.