Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quick Question - $ENV{'SERVER_NAME'} 1

Status
Not open for further replies.

Alphabin

Programmer
Dec 8, 2002
119
CA
If have specific properties for different server name. I came up with following:

Code:
$Server = "$ENV{'SERVER_NAME'}";
$S1_SN = '[URL unfurl="true"]www.domain1a.com'[/URL] || '[URL unfurl="true"]www.domain1b.com';[/URL] 	
$S2_SN = '[URL unfurl="true"]www.domain2a.com'[/URL] || '[URL unfurl="true"]www.domain2b.com';[/URL]

Code:
if ($Server == $S1_SN) {
$stylesheet = 'style.css';
}
else {
$stylesheet = 'style2.css';
}

So now, even if the Domain is $S2_SN it takes the $S1_SN properties...
 
surely this can't work? wouldn't you have to evaluate this or something?

the script also uses the incorrect [red]==[/red] syntax instead of [red]eq[/red]


Kind Regards
Duncan
 
Can you develop more about the eval ...
Even with the eq '$SD_SN' it's still doesn't resolve
 
@S1_SN = (' '
@S2_SN = (' '
$Server = ' # for example

foreach $serverName1 (@S1_SN) {
if ($Server eq $serverName1) {
print "found in S1_SN - style.css used\n";
$stylesheet = 'style.css';
}
}

foreach $serverName2 (@S2_SN) {
if ($Server eq $serverName2) {
print "found in S2_SN - style2.css used\n";
$stylesheet = 'style2.css';
}
}

how's this? - is this of use to you?


Kind Regards
Duncan
 
$serverName1 match found in S1_SN - style.css used
$serverName1 match found in S1_SN - style.css used
$serverName2 match found in S2_SN - style2.css used
$serverName2 match found in S2_SN - style2.css used


Kind Regards
Duncan
 
The || (OR) was the error. Thank you for your help.

BTW, this is personal app I'm working on...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top