Ok, well I was trying this as an experiment for a substitute for frames. Because I have all types of frames and I couldn't find anything on the web relating to this so I decided to take a punch at something new.
You don't really need any knowledge of programming for this I will try to make it as easy as possible for everyone that uses the internet and makes websites. You will probably need a good understanding of HTML, we will be using HTML and PHP.
Before we start I would like to show everyone what it would look like in action. http://www.myjourneythroughrunescape.frih.net/ourpage.php ( Thanks to Star Wars Fanatic for hosting it. Since I am too lazy to.)
Ok lets create two files. (ourpage.php, framepage.php)
Let's copy and paste this code below into ourpage.php.
ourpage.php
Ok, so now lets go through this part by part.
The <table>, <tr>, and <td> tags is our layout of our page if you don't understand that go google: html table. Now lets move on:
ourpage.php
This is our link to activate our, what I will call PHP frame. ourpage.php?action=link&what=framepage.php this is our address to the php part of the page which will display the framepage.php in our PHP frame.
So that was simple just a link and a table now lets look at the real brains behind this... (Not Me I Meen The PHP =P )
ourpage.php
Ok so this is just collecting the data we sent from the link. So the first line well just tells the server that the following code is PHP and needs to be parsed and such stuff. Second and Third line are checking the URL for the action part the 4th line is collecting the variable from the link which in this case is framepage.php and turning it into variable $link. The last lines you don't need to worry about but leave them in there.
ourpage.php
Now this part take the variable $link and displays that page. So the first line you already know about the second is opening up a function everything in between { and } in this will happen when the link is pressed. Now include "$link"; will display the variable $link but since its a page it will display that page.
The rest again don't worry about but you need it.
Now onto framepage.php:
framepage.php
Pretty straight forward. Hope you understand and if you do not php and the problems with frames then you will understand why this is a good thing.
Thanks for reading would love feedback.
Last edited by cr3ativ3 on Thu Jan 25, 2007 4:08 am; edited 3 times in total
You don't really need any knowledge of programming for this I will try to make it as easy as possible for everyone that uses the internet and makes websites. You will probably need a good understanding of HTML, we will be using HTML and PHP.
Before we start I would like to show everyone what it would look like in action. http://www.myjourneythroughrunescape.frih.net/ourpage.php ( Thanks to Star Wars Fanatic for hosting it. Since I am too lazy to.)
Ok lets create two files. (ourpage.php, framepage.php)
Let's copy and paste this code below into ourpage.php.
ourpage.php
| Code: |
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="51%" align="center" valign="top"><a href="ourpage.php?action=link&what=framepage.php">Click Here</a></td> <td width="49%" align="center" valign="top"> <?php if (isset($_GET['action'])) { switch (strtolower($_GET['action'])) { case 'link' : do_link(@$_GET['what']); break; default : break; } } ?> <?php function do_link($link) { include "$link"; }; ?> </td> </tr> </table> </body> </html> |
Ok, so now lets go through this part by part.
The <table>, <tr>, and <td> tags is our layout of our page if you don't understand that go google: html table. Now lets move on:
ourpage.php
| Code: |
|
<a href="ourpage.php?action=link&what=framepage.php">Click Here</a> |
This is our link to activate our, what I will call PHP frame. ourpage.php?action=link&what=framepage.php this is our address to the php part of the page which will display the framepage.php in our PHP frame.
So that was simple just a link and a table now lets look at the real brains behind this... (Not Me I Meen The PHP =P )
ourpage.php
| Code: |
|
<?php if (isset($_GET['action'])) { switch (strtolower($_GET['action'])) { case 'link' : do_link(@$_GET['what']); break; default : break; } } ?> |
Ok so this is just collecting the data we sent from the link. So the first line well just tells the server that the following code is PHP and needs to be parsed and such stuff. Second and Third line are checking the URL for the action part the 4th line is collecting the variable from the link which in this case is framepage.php and turning it into variable $link. The last lines you don't need to worry about but leave them in there.
ourpage.php
| Code: |
|
<?php function do_link($link) { include "$link"; }; ?> |
Now this part take the variable $link and displays that page. So the first line you already know about the second is opening up a function everything in between { and } in this will happen when the link is pressed. Now include "$link"; will display the variable $link but since its a page it will display that page.
The rest again don't worry about but you need it.
Now onto framepage.php:
framepage.php
| Code: |
|
This is the page displayed by your php frame. |
Pretty straight forward. Hope you understand and if you do not php and the problems with frames then you will understand why this is a good thing.
Thanks for reading would love feedback.
Last edited by cr3ativ3 on Thu Jan 25, 2007 4:08 am; edited 3 times in total
