Solved

iframe external linking issue.

Posted on 2004-09-14
19
185 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
Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

 

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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

685 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