Solved

iframe external linking issue.

Posted on 2004-09-14
19
184 Views
Last Modified: 2013-12-25
Hi there,

I have inherited an iframes based Web site and have encountered all the downside issues that come along with a frames based site, such as search engine crawling and external linking issues.

Most importantly, I want to be able to provide third parties (other Web sites, search engines, users ...) with absolute URL's to the iframe content, however, I need to call the parent page to make the Web site usable.

Preferably I'd like to call a javascript page rather than fill up each html page with more code.

BTW., the site is many levels deep if this helps, or changes the way you think about the answer.

Cheers in advance.
0
Comment
Question by:gooner_paul
  • 8
  • 5
19 Comments
 
LVL 3

Expert Comment

by:Sasho
ID: 12059638
You could put some code to take in a command based on which you would display the appropriate content.
Here is a simple example of what I have done:

<?PHP

<?// Get the command
   $cmd = $_GET['cmd'];
   $meat='page1.html';
   if ($cmd == "page1")
   {
          $meat="page1.html";
   }
   elseif($cmd != "page2")
   {
         $meat="page2.html";
   }
   
?>
<html>
<head>
<title>Meat Page</title>
</head>
        <frameset rows="20,*,20">
            <frame name="hbar_top" scrolling="no" noresize src="header.html" >
            <frame name="mainframe" noresize src="<?=$meat?>" >
            <frame name="hbar_bot" scrolling="no" noresize src="footer.html" >
        </frameset>
</html>
0
 
LVL 3

Expert Comment

by:Sasho
ID: 12059640
Oooops I have a typo...
<?PHP

// Get the command
   $cmd = $_GET['cmd'];
   $meat='page1.html';
   if ($cmd == "page1")
   {
          $meat="page1.html";
   }
   elseif($cmd != "page2")
   {
         $meat="page2.html";
   }
   
?>
<html>
<head>
<title>Meat Page</title>
</head>
        <frameset rows="20,*,20">
            <frame name="hbar_top" scrolling="no" noresize src="header.html" >
            <frame name="mainframe" noresize src="<?=$meat?>" >
            <frame name="hbar_bot" scrolling="no" noresize src="footer.html" >
        </frameset>
</html>
0
 
LVL 3

Expert Comment

by:Sasho
ID: 12059648
If you put this in index.php...you could give out URLs like:

http://www.yoursite.com/index.php?cmd=page1
http://www.yoursite.com/index.php?cmd=page2

Cheers
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:gooner_paul
ID: 12059850
Thanks for the quick response, Sasho.

Sorry, I'm not really a PHP coder so I am a little cofused as to where the index.php page would reside. Would I have an index.html page for the parent window, an index.html page for the child window and then a php index page?

Also, is this a page by page implementation?

I am really looking for something that can be called on no matter what URL is requested, i.e., pages in search engines. This site has over 200 pages and is growing all the time.

I guess what I am trying to say is; if any absolute URL (page) from this sub-directory down (including sub-folders) is requested then load main frameset (parent window) as well

Cheers
0
 
LVL 3

Expert Comment

by:Sasho
ID: 12059901
PHP is server side code (http://www.php.net). The index.php could actually replace your index.html

I understand your dillema. You don't want 200 elseif statements.

Perhaps your index.php can take the absolute URL you are talking about and display that in the mainframe of the frameset. Something like this:
<?PHP

// Get the command
   $url = $_GET['url'];
   $meat=$url;
?>
<html>
<head>
<title>Meat Page</title>
</head>
        <frameset rows="20,*,20">
            <frame name="hbar_top" scrolling="no" noresize src="header.html" >
            <frame name="mainframe" noresize src="<?=$meat?>" >
            <frame name="hbar_bot" scrolling="no" noresize src="footer.html" >
        </frameset>
</html>

That way you can link like this:
http://www.yoursite.com/index.php?url=http://www.yoursite.com/subfolder1/subfolder2/subfolder3/index.html

0
 
LVL 3

Expert Comment

by:Sasho
ID: 12059989
I agree this question would be more appropriate elsewhere...
0
 

Author Comment

by:gooner_paul
ID: 12060288
My server handles php, I just need to find out what version. Is there a way that I can test that without having to deal with waiting for the administrator to answer tomorrow?

If you'd like to move my question that would be great.

Thanks again.
0
 
LVL 3

Expert Comment

by:Sasho
ID: 12060295
You can test it. Just create the index.php I wrote and give it a try.
0
 

Author Comment

by:gooner_paul
ID: 12060844
which index page becomes the index.php?

the parent, or the child?
0
 
LVL 3

Expert Comment

by:Sasho
ID: 12065818
The parent.
0
 

Author Comment

by:gooner_paul
ID: 12066173
Actually, I just spoke with the sys admin -- where the site is hosted -- and I was NOt on a PHP enabled server. I am now in the process of moving my files over to the new server and will be waiting for a dns change.

The version of php is: 4.3.6

perhaps, COBOLdinosaur, you can move my question to a more appropriate section.

cheers
0
 

Author Comment

by:gooner_paul
ID: 12066253
I'm also wondering if there might be a CGI fix.

I just stumbled across this as an example:
http://www.woodweb.com/cgi-bin/track/trk.pl?url=http://www.woodplanet.com/main/form/comps/
0
 
LVL 3

Accepted Solution

by:
Sasho earned 250 total points
ID: 12069319
Any server side language should be able to the do job.
0
 
LVL 5

Assisted Solution

by:ITcrow
ITcrow earned 250 total points
ID: 12187253
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
.csv files 5 93
change home folder path 4 53
Change the background and font colors in Notepad++ 5 81
powershell command to get a dll version remotely for many server 12 33
The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question