Solved

Can PHP be used like iframes?

Posted on 2011-09-07
14
359 Views
Last Modified: 2012-05-12
I have put a site together using two iframes (to allow continuous music).

These iframes are not displaying properly though in IE8 and Chrome so i'm wondering if it is possible to use PHP include rather than an iframe?

It would need to work so the user actually stays on one page but navigates around the site in the same way as an iframe.

Is this possible?
0
Comment
Question by:BrighteyesDesign
  • 5
  • 3
  • 3
  • +3
14 Comments
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 36495041
yes, you can include it in the IFRAME
0
 

Author Comment

by:BrighteyesDesign
ID: 36495118
Thanks for that, the thing is though is that the problem is with the iframe so i'm guessing the problem will still be there i'll give it a go though.

How would the code be, I have tried this but I get a 404.html even though that URL path is correct?

 <iframe src="<?php include("http://www.riad-hikaya.com/enter.html"); ?>" width="1062" height="645" scrolling="no" frameborder="0" id="frame1"  allowTransparency="true" background="transparent"></iframe>
0
 
LVL 30

Accepted Solution

by:
Marco Gasi earned 125 total points
ID: 36495132
Hi, BrighteyesDesign. Using include you change nothing: php include only 'includes' all code within the included file into the iframe. For browser which receives tha page top display this changes nothing respect to use normal iframe syntax: the page browser receives is the same...
0
 
LVL 34

Assisted Solution

by:Beverley Portlock
Beverley Portlock earned 250 total points
ID: 36495284
If your IFRAME has a different domain than the surrounding page then this can trigger a security setting in IE.  The solution is to specify a P3P tag.

http://www.w3.org/P3P/

See this for an example of what someone else went through

http://stackoverflow.com/questions/389456/cookie-blocked-not-saved-in-iframe-in-internet-explorer

0
 

Author Comment

by:BrighteyesDesign
ID: 36495307
Thanks for that, everything is on the same domain though.
0
 
LVL 34

Expert Comment

by:Beverley Portlock
ID: 36495317
Fair enough, but remember that domain.com  and sub.domain.com also count as different.

Cheers

BP
0
 
LVL 30

Expert Comment

by:Marco Gasi
ID: 36495359
@bportlock, the problem is that asker uses iframe to play continous music in his site - wonderful site but unfortunately I think I'll never can sleep in that residence...:-( Site works perfectly with all browsers except IE8 and Chrome. It seems to be a css problem than a php problem: I can't help him, maybe you can but I fear you're talking about an unrelated question which can confuse the real problem here :-)

Bye
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 34

Assisted Solution

by:Beverley Portlock
Beverley Portlock earned 250 total points
ID: 36495428
@marqusG

When I see the words 'iframe', 'ie' and 'not working' in the same sentence I remember a particularly horrible day I had thanks to IE7 and the P3P problem. I have seen it bite others too, particularly when it is mentioned that other browsers are OK.

It may well be a different problem, but if it is not then this is not the sort of thing that people think of. If it is not the problem then that is OK with me - I am not pushing it as the solution, but at least the OP is aware of this potential bump in the road.

BP
0
 
LVL 30

Expert Comment

by:Marco Gasi
ID: 36495467
Oh, well, I misunderstood your intentions and I apologize for this. On to the next :-)
0
 

Author Comment

by:BrighteyesDesign
ID: 36495920
Thanks all,

I have figured out that when JQuery is removed from the page it works ok.

The thing is I need JQuery on there which is why I was looking to ditch iframes and look if pure php was possible.

The original, more general question is still open here http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_27295018.html
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 125 total points
ID: 36497572
Here is the issue as I see it.  To start the music playing you have to make a request to the server.  When the connection closes, the server will probably stop playing the file.  Certainly the browser would stop playing the file when the connection closes.  So if you want to have continuous music and still navigate the site, you must keep two requests in play at all times - one for the music and one for the web pages.

There is no really good design pattern for what you have described, but there may be an idea if you use an external browser tab or window for all the non-music web pages.  You would use the target attribute of the href tag to open a new tab or window.  However this by itself will not give the client the music if the pages are deep-linked.  To achieve that you would probably need to use a cookie of some sort and dynamically generate the site navigation.
0
 

Author Closing Comment

by:BrighteyesDesign
ID: 36498391
Thanks all, i'm guessing that's a no to pure PHP solution then for this problem. Elsewhere, I have been pointed towards AJAX so i'm going to see what that's all about!
0
 
LVL 33

Expert Comment

by:Slick812
ID: 36498657
greetings BrighteyesDesign, having your music be continuous while navigating from page to page, may be a problem. I had a fairly sussesful set up for that, using the old style "frameset" with the flash music player in one frame and the page contents in another, you might look at the instructions for framesets here - http://www.w3.org/TR/html4/present/frames.html
However, they may have some or all of the problems using the JQuery JS framework, some JS like JQuery and Mootools, when they are first loaded do a document object model "Scan" for page elements they need to have "configured" or "captured" for the event monitor etc. , this may cause the flickering, or the IFrame failure for you. I can not think of a way to use PHP as placing a DIV with code that might do what you need, ,
AS far as what I would try to do, is use an AJAX send-receive to change the "Page Content", so you can have the music play without ever changing the entire page... Just My thoughts, I feel that the "Old Way" is to change page contents by changing the web address of the browser with a "Link", , due to increased bandwidth for most ISP, I see more and more web sites using the "New Way" of changing user content with AJAX. I have spent a good deal of time recently updating many of my pages to use AJAX or javascript to change page views, instead of links.
0
 

Author Comment

by:BrighteyesDesign
ID: 36498744
Thanks Slick,

I actually looking at AJAX now, i'm just having trouble loading some JQuery content...

I have a question open here if you can help?   http://www.experts-exchange.com/Programming/Languages/Scripting/AJAX/Q_27296093.html#a36498716
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

747 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now