Welcome Guest ( Log In | Register )




                Web Hosting

 
Reply to this topicNew Topic
Help Turn Iframes To Php, I can't say changelocation() twice
rockgoody
post Jul 10 2005, 01:02 AM
Post #1


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 18
Joined: 6-July 05
From: United States, California
Member No.: 6,880


Hello, I am incorporating php into my site to get rid of frames, but I've come accross a problem. In my site I had a table with an iframe, then another table with an iframe inside of that. I used function changelocation to replace the first iframe, but how do I make another thing like that inside of the content of the first include? It says that it cannot redeclare changelocation() so how do I replicate an iframe inside of an iframe using php. Here's the non-php example of what I did.
http://home.comcast.net/~rockgoody/
then you click flash work, then select a flash. See how the bottom of te iframe changes? It's because I put an iframe inside of an iframe. How do I do something like that in php?

This is how I imitated the first iframe in my php revised index.php. I took out the useless code.
CODE
<?php
$content=$_GET['content'];
if (empty($content)) {
$content='news';
}
<a href="index.php?content=news"[tab][/tab]>News</a> <p>
<a href="index.php?content=flashes"[tab][/tab]>Flashes</a><p>
<a href="index.php?content=drawings"[tab][/tab]>Drawings</a>

changelocation($content);
function changelocation($content) {
switch ($content) {
case 'news':
include("contents/news.php");
break;
case 'flashes':
include("contents/flashes.php");
break;
case 'drawings':
include("contents/drawings.php");
break;
}
}
?>


Now when I'm in the index?content=flashes, how do I imitate a second iframe? What I said is probably confusing and I'm sorry. I'm new at php.
Can an experienced php scriptor give some insight?
Go to the top of the page
 
+Quote Post
loganbest
post Jul 10 2005, 05:58 PM
Post #2


Member [ Level 1 ]
Group Icon

Group: Members
Posts: 48
Joined: 18-June 05
Member No.: 6,357


what it looks like you need to do is keep this code the same in Index.php so that it displays news.php, flashes.php, etc. but in order to get another Iframe what I'd do is put the same code as above in "news.php, flashes.php, etc." so that it will display an Iframe inside of that page which is actually a second Iframe inside of Index.php
Go to the top of the page
 
+Quote Post
Hercco
post Jul 11 2005, 06:29 PM
Post #3


Super Member
Group Icon

Group: Members
Posts: 595
Joined: 4-September 04
Member No.: 228


Put that function in a separate file, then require (=include) it to your every php file and then just call "changelocation()" where ever you want the 'iframe' to appear.

Other option would be to make the 'iframe' a separate file and then include it to everyplace where you want it. The contents of the file would be what's inside the function scoop.
Go to the top of the page
 
+Quote Post
derouge
post Aug 31 2005, 11:52 PM
Post #4


Advanced Member
Group Icon

Group: Members
Posts: 111
Joined: 26-August 05
Member No.: 8,098


QUOTE (Hercco @ Jul 11 2005, 12:29 PM)
Put that function in a separate file, then require (=include) it to your every php file and then just call "changelocation()" where ever you want the 'iframe' to appear.

Other option would be to make the 'iframe' a separate file and then include it to everyplace where you want it. The contents of the file would be what's inside the function scoop.
*


The IFRAME pages I've done in PHP have been done pretty much exactly as described above. Works pretty good, too - the first option, anyways. Not so sure about the second. I might give that a try, too.
Go to the top of the page
 
+Quote Post
vujsa
post Sep 6 2005, 06:16 AM
Post #5


Absolute Newbie
Group Icon

Group: Admin
Posts: 888
Joined: 20-February 05
From: Indianapolis, Indiana, USA (Midwest)
Member No.: 2,714
myCENTs:35.43


You might be interested in this tutorial that I recently wrote. I deals with the suggestion that Hercco gave you and from the layout of your site, you may like this option.

CMS101 - Content Management System Design.

I also suggest that you read any topic here that relates to CMS and php includes.

I tend to avoid using Frames and Iframes for various reasons most reguarding page navigation and scrolling.

Hope you get the answer you need. cool.gif

vujsa
Go to the top of the page
 
+Quote Post
jvizueta
post Sep 15 2005, 05:56 AM
Post #6


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 22
Joined: 13-September 05
Member No.: 8,434


I would do the same as I've read in one of the replies above, that's the easiest way to go

just take function change location and put it in a separate file, and then just include it in all of your files that invoke it

but I would add something, don't include it this way:

include("changelocation.php");

but include it like this:

include_once("changelocation.php");

so it won't get re-declared, and it won't show you any error

just in case, you can use include_once or require_once, the only difference is that if argument in include directive is unfound, the page won't throw you an error, but with require it will
Go to the top of the page
 
+Quote Post

Reply to this topicNew Topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   15 Jimmy89 2,658 13th December 2008 - 06:05 AM
Last post by: laniczech
No New Posts 10 tamuna90 958 27th November 2008 - 08:24 AM
Last post by: iG-vijith
No New Posts 10 yakobob 3,655 7th September 2008 - 01:20 PM
Last post by: Alarm
No new   25 soleimanian 7,195 20th August 2008 - 08:07 PM
Last post by: Mordent
No New Posts   9 RDFXpro 2,893 9th August 2008 - 04:21 PM
Last post by: Guest
No New Posts   3 snutz411 1,417 31st July 2008 - 03:55 AM
Last post by: Guest
No New Posts   1 Neko Jam! 564 23rd June 2008 - 01:07 PM
Last post by: Laro696
No New Posts   0 dipesh 226 5th June 2008 - 06:35 PM
Last post by: dipesh
No New Posts   14 mariamb 2,648 28th May 2008 - 10:44 PM
Last post by: iGuest
No New Posts   1 jpw 582 20th December 2007 - 02:38 AM
Last post by: Sten
No New Posts   5 ALESSANDRO DELPIERO 1,047 25th October 2007 - 03:37 AM
Last post by: Grafitti
No New Posts   2 sazz 2,069 1st August 2007 - 03:03 PM
Last post by: xboxrulz
No New Posts   14 demolaynyc 1,813 28th April 2007 - 12:50 AM
Last post by: demolaynyc
No New Posts   4 biesbos 1,409 7th February 2007 - 01:12 AM
Last post by: FirefoxRocks
No New Posts 8 miCRoSCoPiC^eaRthLinG 909 13th January 2007 - 03:45 AM
Last post by: kage