Jump to content

Content depending on used Domain


Megami

Recommended Posts

Hi all, I have a project for a while.

Since the games get their English release (Pokémon Black and White), I'd like to make content differ between domain names, but at the same time, it needs to be in the same files.

For example:

If someone accesses the site, using HiunCity.com, they'll need to see this:

"Hiun City, the largest city in the Isshu Region, has finally been opened!"

But if they access the site, using CasteliaCity.com, it has to be:

"Castelia City, the largest city in the Unova Region, has finally been opened!"

I'm sure there's a PHP Code for this.

 

Thanks in advance!

女神

Link to comment
Share on other sites

>>requinix

No, I mean that the content differs from used domains, not to see which domain has been used.

If you now go to one of the 2 domains, the site is identical to each other.

What I want is, make the Japanese names viewable for Hiun City, and the English names viewable for Castelia City.

I know it's something with "If/Else".

Sorry, I'm a total n00b about PHP, I know HTML better.

Link to comment
Share on other sites

>>Rifts

It didn't work.

My code is:

<?php
$_SERVER["HTTP_HOST"]
?>
<h2>Welcome</h2>
<p>Welcome to the site.<br />
<?php
if ($_SERVER["HTTP_HOST"] == hiuncity.com)
{
print "Hiun City, the largest city in the Isshu Region, has finally been opened!<br />"
}
elseif ($_SERVER["HTTP_HOST"] == www.hiuncity.com)
{
print "Hiun City, the largest city in the Isshu Region, has finally been opened!<br />"
}
elseif ($_SERVER["HTTP_HOST"] == www.casteliacity.com)
{   
print "Castelia City, the largest city in the Unova Region, has finally been opened!<br />"
}   
else 
{
print "Castelia City, the largest city in the Unova Region, has finally been opened!<br />"
}
?>
We finished the site, so no big things will happen, from now on.<br />
We keep developing this project, and The CW-Network gives you Best Wishes.<br />
You're always welcome, visiting our city, working in our city, living in our city, or whatever you like!</p>
<audio autoplay="autoplay" loop="loop">
        <source src="files/bgm/hiun.ogg" type="audio/ogg" />
        <source src="files/bgm/hiun.mp3" type="audio/mpeg" />
Your browser does not support the audio element.
</audio>

 

I also tried "echo" instead of "print", but it gave me the same results.

Link to comment
Share on other sites

also: the following line doesn't do anything, so you should remove it:

 

<?php
$_SERVER["HTTP_HOST"]
?>

 

also: All commands must be followed by a semi-colon.

 

print "Hiun City, the largest city in the Isshu Region, has finally been opened!<br />";

 

if you aren't seeing a parse error when you try to run that code, you probably have error_reporting turned off. try to turn it on by putting these lines as the first lines in your file:

 

ini_set('error_reporting',E_ALL);
error_reporting(-1);

Link to comment
Share on other sites

>>Rifts

The "echo $_SERVER["HTTP_HOST"]" part worked, but adding "http://" gave no difference.

 

>>BlueSkyIS

It's working, but not like it suppose to be.

Now all the text is for Castelia (Hiun also desplays Castelia text).

 

Code is now:

<h2>Welcome</h2>
<p>Welcome to the site.<br />
<?php
if ($_SERVER["HTTP_HOST"] == 'http://hiuncity.com')
{
print "Hiun City, the largest city in the Isshu Region, has finally been opened!<br />";
}   
else
{
print "Castelia City, the largest city in the Unova Region, has finally been opened!<br />";
}
?>
We finished the site, so no big things will happen, from now on.<br />
We keep developing this project, and The CW-Network gives you Best Wishes.<br />
You're always welcome, visiting our city, working in our city, living in our city, or whatever you like!</p>
<audio autoplay="autoplay" loop="loop">
        <source src="files/bgm/hiun.ogg" type="audio/ogg" />
        <source src="files/bgm/hiun.mp3" type="audio/mpeg" />
Your browser does not support the audio element.
</audio>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.