ok, I'm REALLY new to php. as a matter of fact I have never done it before. Here is my problem. I have a page using iframes (<!-- w --><a class="postlink" href="http://www.dikaios.net/lowband">www.dikaios.net/lowband</a><!-- w -->). Now, if someone googles something, and get's linked to <!-- w --><a class="postlink" href="http://www.dikaios.net/lowband/contact.html">www.dikaios.net/lowband/contact.html</a><!-- w --> they get no navigation bars, so I am going to have it forward them to index.html instead. But, if I made index.html index.php, could I have it forward them to index.php?contact, and have the index page load the contact page into the iframe? also, I'd like to learn php, as I'd eventually like to have the site done in php...is there a good book, or anything?
AaronHave index.php?iframe=contact
Then somewhere in the code put..
<iframe src=http://www.htmlforums.com/archive/index.php/"<?echo $iframe;?>.html"></iframe>
so the code it would look like this:
<iframe src=http://www.htmlforums.com/archive/index.php/"contact.html"></iframe>Thanks!! that works great! The problem is, if I do that, then when people just go straight to index.php, they get an error, because there is to ".html" file. how can I work around this? Is there a way to tell it "if iframe == null; iframe = main" or something like that?
Aaronthis will do it
if (!$_GET['iframe']){
$iframe = "main";
} else {
$iframe = $_GET['iframe'];
}
put that towards the top of your index.php page.Ok, I did that, and it works GREAT. I changed everything to php. I got rid of the else after the if statement because it seemed redundant, and it works without it. Now if you go to <!-- w --><a class="postlink" href="http://www.dikaios.net/lowband/test/contact.php">www.dikaios.net/lowband/test/contact.php</a><!-- w --> it will use Javascript to forward you to <!-- w --><a class="postlink" href="http://www.dikaios.net/lowband/test/index.php?iframe=contact">www.dikaios.net/lowband/test/index.php?iframe=contact</a><!-- w --> and it works perfectly. BUT I have one iframe called players (<!-- w --><a class="postlink" href="http://www.dikaios.net/lowband/test/index.php?iframe=players">www.dikaios.net/lowband/test/index.php?iframe=players</a><!-- w -->) and that iframe has an iframe inside it. I want to be able to forward to something like ...index.php?iframe=players&player=jimmy to have it load index.php with players.php in the iframe and with jimmy.php in the iframe that is inside players.php (confused?). I thought I could just add
<?php if (!$_GET['player'])
{
$iframe = "load";
}?>
to players.php and use this:
<iframe src=http://www.htmlforums.com/archive/index.php/"<?echo $player;?>.php"></iframe>
to load the iframe. it doesn't work. the player frame loads, but the jimmy.php does not load. What am I doing wrong? Why is the variable not making to the last layer?
thanks
AaronWhen you did index.php?iframe=players&player=jimmy. It loads these variables into index.php. So, that is why the first iframe is working. But no variables have been loaded into players.php.
In index.php you could have something like:
if(player == 'jimmy')
$new_iframe = '<iframe src=http://www.htmlforums.com/archive/index.php/"players.php?player=jimmy"></iframe>';
Then in your html code just put:
<? echo $newiframe;"?>since you are using $iframe for the first iframe you have to set a new variable to the second iframe inside the first iframe. $new_iframe is good so instead of what ?gkj said I would do this.
<?php
if (!$_GET['player'])
{
$new_iframe = "load";
}
?>
and do the samething you did in the first iframe. the code in the first iframe should load another iframe correct? well it is the same code as you did in the first.
index.php has
<iframe src=http://www.htmlforums.com/archive/index.php/"<?echo $iframe;?>.html"></iframe>
and in that iframe you have
<iframe src=http://www.htmlforums.com/archive/index.php/"<?echo $new_iframe;?>.html"></iframe>
make sense? if not I would just ditch these iframes because I am all iframed out Ok, the problem with the first solution, is that I'd have to have like 20 if statements eventually. And the problem with the second, is that I don't see how it's passing the player variable to the players.php page. so I tried this:
<iframe id="main" name="main" align="middle"
frameborder="0" width="600" height="250" marginheight="0"
marginwidth="0" scrolling="no"
src=http://www.htmlforums.com/archive/index.php/"<?echo $iframe;?>.php<?php if ($_GET['player']) echo "?player="+$player ?>">
Loading...</iframe>
testing to see if I got the player variable, and if so trying to make the iFrame src= <!-- m --><a class="postlink" href="http://www.htmlforums.com/archive/index.php/players.php?player=jimmy">http://www.htmlforums.com/archive/index ... ayer=jimmy</a><!-- m --> but I'm not sure what I'm doing wrong...can I even echo like this? it works if you DON'T have a player variable, but if you do, it has an error.
Any Ideas?
<!-- m --><a class="postlink" href="http://www.dikaios.net/lowband/test/index.php?iframe=players&player=jimmy">http://www.dikaios.net/lowband/test/ind ... ayer=jimmy</a><!-- m -->
<!-- m --><a class="postlink" href="http://www.dikaios.net/lowband/test/index.php?iframe=players">http://www.dikaios.net/lowband/test/ind ... me=players</a><!-- m -->
<!-- m --><a class="postlink" href="http://www.dikaios.net/lowband/test/index.phpthis">http://www.dikaios.net/lowband/test/index.phpthis</a><!-- m -->
<?php
if (!$_GET['player'])
{
$new_iframe = "load";
}
?>
goes into the player page. if it was sent in the url it will read that variable. the $_GET variable is to the whole document, doesn't matter how many pages you have loading.
so you have
if (!$_GET['iframe']){
$iframe = "main";
} else {
$iframe = $_GET['iframe'];
}
in the first iframe page and the other in the player page.
if you get to many variable to look for then you need to work it into a switch statement.Ok, index.php seems to work fine. BUT players.php still isn't working right. I have this in players.php:
<?php if (!$_GET['player'])
{
$player = "load";
}?>
BUT even if I have a player variable (<!-- w --><a class="postlink" href="http://www.dikaios.net/lowband/test/index.php?iframe=players&player=jimmy">www.dikaios.net/lowband/test/index.php? ... ayer=jimmy</a><!-- w -->) it doesn't see it, and makes $player=load I still don't get it...I may have to set up if statements...how do you do that switch command?
Aaronthere is your problem. you are saying that if there isn't $GET['player'] you will load "load" into the iframe.
but if there was a variable then you don't set it.
<?php
if (!$_GET['player'])
{
$player = "load";
} else {
$player = $_GET['player'];
}
?>
also try not to make it all one line as it is hard to read.
a switch is lik so
switch ($_GET['player']){
case "player1":
$player = "player1";
break;
case "player2":
$player = "player2";
break;
etc...
default:
$player = "load"
break;
}
default will always load if $_GET['player'] is not set.
get it?here...maybe with these files you can see what's wrong...I can't seem to get it, and I hate that!! There's probably something VERY simple that I'm missing.
EDIT: if there are more files that you need or anything, just let me know. And if you are all sick of seeing this thread, let me know The zip of the whole site is available here:
<!-- m --><a class="postlink" href="http://www.dikaios.net/lowband/test/test.ziphmm">http://www.dikaios.net/lowband/test/test.ziphmm</a><!-- m --> I thought the url went all the way down to the last document but it didn't. so we have to make a modification to the index page.
src=http://www.htmlforums.com/archive/index.php/"<?echo $iframe;?>.php?player=<? echo $_GET["player"]?>">Loading...</iframe>
add that. if it is empty it will still load load.php page.
that works eureka!
Thanks, it works perfectly...check it out! They all forward correctly:
<!-- w --><a class="postlink" href="http://www.dikaios.net/lowband/contact.php">www.dikaios.net/lowband/contact.php</a><!-- w -->
<!-- w --><a class="postlink" href="http://www.dikaios.net/lowband/jimmy.php">www.dikaios.net/lowband/jimmy.php</a><!-- w -->
<!-- w --><a class="postlink" href="http://www.dikaios.net/lowband/vision.php">www.dikaios.net/lowband/vision.php</a><!-- w -->
Anyway, thanks a ton.
Aaron:rocker:
AaronHave index.php?iframe=contact
Then somewhere in the code put..
<iframe src=http://www.htmlforums.com/archive/index.php/"<?echo $iframe;?>.html"></iframe>
so the code it would look like this:
<iframe src=http://www.htmlforums.com/archive/index.php/"contact.html"></iframe>Thanks!! that works great! The problem is, if I do that, then when people just go straight to index.php, they get an error, because there is to ".html" file. how can I work around this? Is there a way to tell it "if iframe == null; iframe = main" or something like that?
Aaronthis will do it
if (!$_GET['iframe']){
$iframe = "main";
} else {
$iframe = $_GET['iframe'];
}
put that towards the top of your index.php page.Ok, I did that, and it works GREAT. I changed everything to php. I got rid of the else after the if statement because it seemed redundant, and it works without it. Now if you go to <!-- w --><a class="postlink" href="http://www.dikaios.net/lowband/test/contact.php">www.dikaios.net/lowband/test/contact.php</a><!-- w --> it will use Javascript to forward you to <!-- w --><a class="postlink" href="http://www.dikaios.net/lowband/test/index.php?iframe=contact">www.dikaios.net/lowband/test/index.php?iframe=contact</a><!-- w --> and it works perfectly. BUT I have one iframe called players (<!-- w --><a class="postlink" href="http://www.dikaios.net/lowband/test/index.php?iframe=players">www.dikaios.net/lowband/test/index.php?iframe=players</a><!-- w -->) and that iframe has an iframe inside it. I want to be able to forward to something like ...index.php?iframe=players&player=jimmy to have it load index.php with players.php in the iframe and with jimmy.php in the iframe that is inside players.php (confused?). I thought I could just add
<?php if (!$_GET['player'])
{
$iframe = "load";
}?>
to players.php and use this:
<iframe src=http://www.htmlforums.com/archive/index.php/"<?echo $player;?>.php"></iframe>
to load the iframe. it doesn't work. the player frame loads, but the jimmy.php does not load. What am I doing wrong? Why is the variable not making to the last layer?
thanks
AaronWhen you did index.php?iframe=players&player=jimmy. It loads these variables into index.php. So, that is why the first iframe is working. But no variables have been loaded into players.php.
In index.php you could have something like:
if(player == 'jimmy')
$new_iframe = '<iframe src=http://www.htmlforums.com/archive/index.php/"players.php?player=jimmy"></iframe>';
Then in your html code just put:
<? echo $newiframe;"?>since you are using $iframe for the first iframe you have to set a new variable to the second iframe inside the first iframe. $new_iframe is good so instead of what ?gkj said I would do this.
<?php
if (!$_GET['player'])
{
$new_iframe = "load";
}
?>
and do the samething you did in the first iframe. the code in the first iframe should load another iframe correct? well it is the same code as you did in the first.
index.php has
<iframe src=http://www.htmlforums.com/archive/index.php/"<?echo $iframe;?>.html"></iframe>
and in that iframe you have
<iframe src=http://www.htmlforums.com/archive/index.php/"<?echo $new_iframe;?>.html"></iframe>
make sense? if not I would just ditch these iframes because I am all iframed out Ok, the problem with the first solution, is that I'd have to have like 20 if statements eventually. And the problem with the second, is that I don't see how it's passing the player variable to the players.php page. so I tried this:
<iframe id="main" name="main" align="middle"
frameborder="0" width="600" height="250" marginheight="0"
marginwidth="0" scrolling="no"
src=http://www.htmlforums.com/archive/index.php/"<?echo $iframe;?>.php<?php if ($_GET['player']) echo "?player="+$player ?>">
Loading...</iframe>
testing to see if I got the player variable, and if so trying to make the iFrame src= <!-- m --><a class="postlink" href="http://www.htmlforums.com/archive/index.php/players.php?player=jimmy">http://www.htmlforums.com/archive/index ... ayer=jimmy</a><!-- m --> but I'm not sure what I'm doing wrong...can I even echo like this? it works if you DON'T have a player variable, but if you do, it has an error.
Any Ideas?
<!-- m --><a class="postlink" href="http://www.dikaios.net/lowband/test/index.php?iframe=players&player=jimmy">http://www.dikaios.net/lowband/test/ind ... ayer=jimmy</a><!-- m -->
<!-- m --><a class="postlink" href="http://www.dikaios.net/lowband/test/index.php?iframe=players">http://www.dikaios.net/lowband/test/ind ... me=players</a><!-- m -->
<!-- m --><a class="postlink" href="http://www.dikaios.net/lowband/test/index.phpthis">http://www.dikaios.net/lowband/test/index.phpthis</a><!-- m -->
<?php
if (!$_GET['player'])
{
$new_iframe = "load";
}
?>
goes into the player page. if it was sent in the url it will read that variable. the $_GET variable is to the whole document, doesn't matter how many pages you have loading.
so you have
if (!$_GET['iframe']){
$iframe = "main";
} else {
$iframe = $_GET['iframe'];
}
in the first iframe page and the other in the player page.
if you get to many variable to look for then you need to work it into a switch statement.Ok, index.php seems to work fine. BUT players.php still isn't working right. I have this in players.php:
<?php if (!$_GET['player'])
{
$player = "load";
}?>
BUT even if I have a player variable (<!-- w --><a class="postlink" href="http://www.dikaios.net/lowband/test/index.php?iframe=players&player=jimmy">www.dikaios.net/lowband/test/index.php? ... ayer=jimmy</a><!-- w -->) it doesn't see it, and makes $player=load I still don't get it...I may have to set up if statements...how do you do that switch command?
Aaronthere is your problem. you are saying that if there isn't $GET['player'] you will load "load" into the iframe.
but if there was a variable then you don't set it.
<?php
if (!$_GET['player'])
{
$player = "load";
} else {
$player = $_GET['player'];
}
?>
also try not to make it all one line as it is hard to read.
a switch is lik so
switch ($_GET['player']){
case "player1":
$player = "player1";
break;
case "player2":
$player = "player2";
break;
etc...
default:
$player = "load"
break;
}
default will always load if $_GET['player'] is not set.
get it?here...maybe with these files you can see what's wrong...I can't seem to get it, and I hate that!! There's probably something VERY simple that I'm missing.
EDIT: if there are more files that you need or anything, just let me know. And if you are all sick of seeing this thread, let me know The zip of the whole site is available here:
<!-- m --><a class="postlink" href="http://www.dikaios.net/lowband/test/test.ziphmm">http://www.dikaios.net/lowband/test/test.ziphmm</a><!-- m --> I thought the url went all the way down to the last document but it didn't. so we have to make a modification to the index page.
src=http://www.htmlforums.com/archive/index.php/"<?echo $iframe;?>.php?player=<? echo $_GET["player"]?>">Loading...</iframe>
add that. if it is empty it will still load load.php page.
that works eureka!
Thanks, it works perfectly...check it out! They all forward correctly:
<!-- w --><a class="postlink" href="http://www.dikaios.net/lowband/contact.php">www.dikaios.net/lowband/contact.php</a><!-- w -->
<!-- w --><a class="postlink" href="http://www.dikaios.net/lowband/jimmy.php">www.dikaios.net/lowband/jimmy.php</a><!-- w -->
<!-- w --><a class="postlink" href="http://www.dikaios.net/lowband/vision.php">www.dikaios.net/lowband/vision.php</a><!-- w -->
Anyway, thanks a ton.
Aaron:rocker: