Jump to content
xisto Community
Sign in to follow this  
rockgoody

Help Turn Iframes To Php I cant say changelocation() twice

Recommended Posts

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://forums.xisto.com/no_longer_exists/
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.

<?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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

<{POST_SNAPBACK}>


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.

Share this post


Link to post
Share on other sites

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. ;)

vujsa

Share this post


Link to post
Share on other sites

I would do the same as I've read in one of the replies above, that's the easiest way to gojust take function change location and put it in a separate file, and then just include it in all of your files that invoke itbut 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 errorjust 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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.