-
- 1,078 Posts
Well...that did not work. Got some kind of Parse Error when I tried to view the resource in my browser.
Tried else return;
also else return();
and just plain return ();
Doing this on just the top FormIt Snippet, though many of the add ons have multiple snippets associated with them.
???
[ed. note: mmcgee last edited this post 9 years, 9 months ago.]
-
- 1,078 Posts
That didn't work. Unless the error is generated on my contact page with FormIt because I have not made the edit to every snippet?
Parse error: syntax error, unexpected '}' in /home/mysite/public_html/core/cache/includes/elements/modsnippet/2.include.cache.php on line 37
-
- 1,078 Posts
Thanks for helping. I hope the developers will chime in soon.
"else" only goes with "if" conditionals.
if(some-condition) {
do-something;
} else {
do-something-else;
}
No. Each one is treated as a function, so each one should end with a return statement, even if it's just an empty "return;" statement.
-
- 1,078 Posts
I'll try adding return; to each snippet and see if it gets rid of the MODx errors and or creates other issues. It would be helpful if the error could indicate which snippet is causing the problem. The error messages are kind of vague.
That's because they aren't really errors and have little to do with the actual plugin, they're return values from the functions that are invoked by the events, which in turn include your plugin code. Any plugin using that event that doesn't have an empty return value will have the same effect. Any return from a plugin's code goes to the error log, and if there is no return statement then it falls through to the parent function's return value.
http://rtfm.modx.com/revolution/2.x/developing-in-modx/basic-development/plugins#Plugins-CustomValidation