Posted on: 07/31/06 02:24am
By: Turner
I have a handful of sites running on one codebase. This means every site must have the same custom registration fields. I'd like to snip the custom registration functions and put a call in lib-custom.php that checks the url (i.e. "if ($_SERVER['HTTP_HOST'] == 'www.url.com')") and then require_once (the appropriate registration functions).
But when I do this, the code itself displays at the top of the site. Anyone know what gives?
(Is there a better way to do what I am trying to do?)
Thanks!
-Jeff
Including Functions for Registrations
Posted on: 07/31/06 11:34pm
By: Blaine
Post an extract of one of the functions with your change so we can see.
Including Functions for Registrations
Posted on: 08/01/06 12:24am
By: Turner
In lib-custom.php I want to do this:
if ($_SERVER['HTTP_HOST'] == 'urlforsite1') {
require_once ('c:/site-path/registrationcodeforsite1.php');
} else if ($_SERVER['HTTP_HOST'] == 'urlforsite2') {
require_once ('c:/site-path/registrationcodeforsite2.php');
}
I want to move the custom registration code from lib-custom.php into a file registrationcodeforsite1.php so it would contain this
function custom_usercreate($uid) {
user create stuff unique for site1
}
function custom_userdisplay($uid) {
user display stuff unique for site1
}
function custom_useredit($uid) {
user edit stuff unique for site 1
}
I want to duplicate the custom registration stuff in a file registrationcodeforsite2.php so that it would contain something like this:
function custom_usercreate($uid) {
user create stuff unique for site2
}
function custom_userdisplay($uid) {
user display stuff unique for site2
}
function custom_useredit($uid) {
user edit stuff unique for site 2
}
With this scheme, I can have completely different registrations being run by the same code.
Unfortunately, when I do the require_once above, the actual code in registrationcodeforsite1.php displays when I simply want it to load and be available for use.
Including Functions for Registrations
Posted on: 08/01/06 02:27am
By: machinari
don't mind me guessing, but my first guess would be that your required files simply don't have the proper open and closing tags, eg., <?php //code here ?>.
The tags indicate that the code in between should be parsed as PHP code rather than plain text.
Including Functions for Registrations
Posted on: 08/01/06 03:20am
By: Turner
(I obviously need some sleep)
Uh, Thanks, and goodnight...