Hi I’m writing a snippet that displays some dynamic content on the home page. The snippet works on other pages, but the require() function causes an error on the home page. The path is absolute so I’m at a loss as to what the problem is. Relative paths fail, paths using $_SERVER variables fail. Any guidance would be helpful.
Thanks
Try using
MODX_BASE_PATH in your include or require statement:
ex:
include MODX_BASE_PATH."assets/snippets/mysnippet/includes/myincludedfile.php";
I’ve had success using this technique, hopefully it helps
-
☆ A M B ☆
- 2,475 Posts
That’s pulling from the database as well, right? That works on multiple servers so long as the directory structure is the same. I’ll have to give that a try. Where is there a list of MODx constants?