Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2005-04-08 03:02:57
- Andrew
- Plugin Author

- Registered: 2004-02-23
- Posts: 730
pretext & global variables
Two things…
First, I feel like changeset 273 may be an important revision that plugin developers may want to check out. Basically, now you can pre-populate $pretext now. (this may also turn out to be entirely uninteresting, but it at least feels like something that should be useful)
This leads me to item number 2: I’m sure from time to time you’ve had to rely on creating global variables from within your plugins in order to track values through iterative loops (like in my comment alt & comment num plugins). I’m not sure if it was actually possible to do this before, but after seeing ^ that changeset it got me wondering if it’d be safer to inject your values into $pretext. Is this poor programming practice? Dangerous? Or is it worse to have your own custom variables floating around in there?
Offline
Re: pretext & global variables
bump
Just came across this post and I’m wondering the same.
Offline
Re: pretext & global variables
For iterative loops you can use static variables in your functions. Putting things in the global scope always runs the risk of clashing with something else. Basicaly the same advice as for functions: Make sure you use a prefix in your function- and variable-names to reduce the chances of clashes.
Offline
Pages: 1