Hello,
I’m just trying to code my first own snippet (which will output stored emergency service dates of different doctors and drug stores).
I got a question concerning the scope of "my" variables. My snippet code in the manager is just a "require file.php" and the real programming is done in external files. The variables that I use, are they all global? Should I capsule the snippet’s code in functions to make my variables local and to avoid interference with other snippets, plugins or core code?
Thanks for your thoughts
Martin
I think that’s exactly what I do. I have a link to a file that I code within eclipse. I then only need to upload my files but not change the snippet code in modX. Is it okay when I use echo to generate code for the output or should I do it by return value?
Thx for your tipps
Martin
Oh, I just noticed that this is NOT exactly what i was doing. But now I do. The last code you posted is that in the modX snippet, right? And I do my coding in the included file. Looks nice.
Thanks again
Martin