[Pmwiki-users] Re: Reason for using a class (was Re: Re: Request for)

Christian Ridderström chr
Tue Jul 20 03:04:08 CDT 2004


On Fri, 16 Jul 2004, Patrick R. Michaud wrote:

> On Fri, Jul 16, 2004 at 10:50:01PM +0200, chr at home.se wrote:
> > I'd like to be able to have a separate namespace for variables that are
> > "global" to my plugin, so that they wont come into conflict with variables
> > from other plugins.
> >
> > Is there some other way than using a class to fix this?
> 
> Ummm, you can use a variable name prefix,
> For example, all of the variables in mailposts.php are prefixed with
> $MailPosts, as in $MailPostsTo, $MailPostsDelay, $MailPostsSquelch, etc.

That's what I've been doing so far, but sometimes the names become so
long...

> Another way to do it would be to use an array, as in $MailPosts['To'],
> $MailPosts['Delay'], etc.  However, note doing it as arrays, as well
> as using classes, prevents the variables from ever being used in $...Fmt
> strings, which may or may not be desirable depending on the application.

Ok. IRCC, that's the same as restriction as when putting the variable 
in an objetct.

/Christian

-- 
Christian Ridderstr?m                           http://www.md.kth.se/~chr





More information about the pmwiki-users mailing list