From: alex b. <en...@tu...> - 2001-07-07 22:36:55
|
> You have already pre-empted the name "BC_" prefix for > define()'s, and you call these "user constants". correct. these are constants that are used by the system, but always set by the user. > Now, what if I want a page-scope/all module defined constant. > What should I do? Where do I define() something that I wish > all modules to see in global scope. all constants are implicitly global. you can put a declare in conf.php, or you can declare a constant in your module. it's up to you. > Is this going to be possible in the *.xml file that will be > ripped into the index.php? If so, will it be put up there > at the top like: Yes. The .xml won't know anything about the set of constants, just that a certain xml structure should be ripped into a php define. so you can add whatever you like. > // ripped from /path/to/binarycloud/user/htdocs/index.xml > $SITE_EMAIL="jo...@so..."; //for email all over > $SITE_ROWS_BEFORE_PAGING=15; //for paging lists > $SITE_TEL_NO="1-800-6969"; // for telno all over > $SITE_WEBMASTER="wi...@so..."; > > or > > define(SITE_EMAIL,"jo...@so..."); It would be the latter, define. > and so forth. > > As an aside, I sort of think of these as "user constants", > but I suppose they are "site constants" or "page constants". They are also user constants. Agreed, the BC_ prefix ones are "special" and I may make an effort to make that a little more clear - but both 'sets' of constants come from the dev. > So, the question(s) are: > 1. Where should I define them for global scope? user/conf/conf.php (for the moment, soon the conf.xml) > 2. If you tell me some module that I will have to > load, such as a SiteLibrary.php, then I > guess I would have to go along with it, > but this seems wrong-headded. That would be stupid. So, yes, you are correct. > Now I want to be able to put them in the *.xml and > have them work as I described above, defining them > in global scope for THAT PAGE with any set of modules > called from and set of packages, and not have to worry > that I didn't load, say, the SiteLibrary.php that > would do it, with its potential omission. If I create > a new page(s) for the site six months after it has > been up, I might forget which bloody module globaled > my constants. This I don't understand - all 'constants' loaded by the system are system-wide (not page specific) and implicitly global. > What if I want: > > define(BUTTONS,"../resources/images/buttons/"); > define(SITE_GIZMOS,"resources/images/gizmos/"); > > Where? conf.php. > I suppose that now I am starting to get into the > operation of the XML --> php file thingy. I will > be happy when that is ready. > > And I would like to have defines()'s available in > that XML --> php. You will _only_ have defines available there. _a |