Jump to content

Recommended Posts

Hi all and thanks so much for the help in my last post.

But it did not solve it 100% so I try to post again.

 

This is how the index.php file looks now

 

"

<?php

$IPaddress=$_SERVER['REMOTE_ADDR'];$two_letter_country_code=iptocountry($IPaddress);function iptocountry($ip) {$numbers = preg_split( "/\./", $ip);include("ip_files/".$numbers[0].".php");$code=($numbers[0] * 16777216) + ($numbers[1] * 65536) + ($numbers[2] * 256) + ($numbers[3]);foreach($ranges as $key => $value){if($key<=$code){if($ranges[$key][0]>=$code){$two_letter_country_code=$ranges[$key][1];break;}}}

 

    if ($two_letter_country_code == "IS")include('is.htm');

    else include('en.htm');

}

?>

<meta name="keywords" content="" />

<meta name="description" content="" />

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title></title></head><body>

</body></html>

"

Like this the files "is.htm" and "en.htm" loads up in new window

 

But I want to have an Iframe on my index page and load the "is.htm" and "en.htm" into the iframe.

 

Then this is how I want the index file to look like.

"

<?php

$IPaddress=$_SERVER['REMOTE_ADDR'];$two_letter_country_code=iptocountry($IPaddress);function iptocountry($ip) {$numbers = preg_split( "/\./", $ip);include("ip_files/".$numbers[0].".php");$code=($numbers[0] * 16777216) + ($numbers[1] * 65536) + ($numbers[2] * 256) + ($numbers[3]);foreach($ranges as $key => $value){if($key<=$code){if($ranges[$key][0]>=$code){$two_letter_country_code=$ranges[$key][1];break;}}}

 

    if ($two_letter_country_code == "IS") then open this file--->('is.htm') in iframe named mainframe

  if ($two_letter_country_code=="US" || $two_letter_country_code=="GB" ||    $two_letter_country_code=="UK" || $two_letter_country_code=="AU")  then open this file--->('en.htm') in iframe named mainframe

 

    else    open file ('en.htm');

}

?>

<meta name="keywords" content="" />

<meta name="description" content="" />

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title></title>

</head>

<body>

<iframe src="dont know what to put here" height="100%" width="100%" name="mainframe"></iframe>

</body>

</html>

 

 

These codes does not work

"

<?php

if ($bla == 'blabla') {

    $file = 'file1.php'

} else {

    $file = 'file2.php'

}

?>

 

<iframe src="<?php echo $file ?>" name="mainframe" height="600px" width="800px">

</iframe>

 

and

 

if (blah == blah) {

    $content = 'path/to/file1.php';

} else {

    $content = 'path/to/file2.php';

 

}

 

<iframe src="<?php echo $content;?>" name="mainframe" height="600px" width="800px">

</iframe>

"

 

I know this is something simple but I cant figure it out so I ask you all for a little help.

Please  :) :) :)

Link to comment
https://forums.phpfreaks.com/topic/87183-one-more-question-about-iframe/
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.