Displaying more than one php app on same page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jeffamm
Forum Newbie
Posts: 6
Joined: Thu Apr 10, 2008 11:36 am

Displaying more than one php app on same page

Post by jeffamm »

:D What is best way to display more than one php app/script on the same page, say side by side? I could do it with iframes but those seem to have a variety of browser issues. I have bunch of php scripts that I want users to be able to see and use on the same page, but I'm a php noob and don't get how to do it. Sorry if the answer is obvious - I tried searching the forum and virtually every word I entered was disallowed by search function as too common. I'm trying to achieve the effect of a frame or iframe without the browser compatibility problems. 8O

thanks
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: Displaying more than one php app on same page

Post by Jade »

iframes are okay but I'd say css is your best bet. Use div layers and just have them butt up next to each other.
jeffamm
Forum Newbie
Posts: 6
Joined: Thu Apr 10, 2008 11:36 am

Re: Displaying more than one php app on same page

Post by jeffamm »

I don't understand. I'm familiar with CSS and <div> tags but how do I incorporate the output from different apps? I'm probably missing some basic php knowledge here, but I didn't think the apps could be built into one page. These are various scripts that I've purchased and that weren't written as part of one app.
User avatar
EverLearning
Forum Contributor
Posts: 282
Joined: Sat Feb 23, 2008 3:49 am
Location: Niš, Serbia

Re: Displaying more than one php app on same page

Post by EverLearning »

Use divs like Jade suggested, and populate them with AJAX calls.
jeffamm
Forum Newbie
Posts: 6
Joined: Thu Apr 10, 2008 11:36 am

Re: Displaying more than one php app on same page

Post by jeffamm »

OK I'm not familiar with AJAX calls but from a little web searching I see things like cross-domain ajax calls using PHP - is this what you mean? Is there a good tutorial on ajax calls for what I want to do that you can recommend?

thanks
User avatar
EverLearning
Forum Contributor
Posts: 282
Joined: Sat Feb 23, 2008 3:49 am
Location: Niš, Serbia

Re: Displaying more than one php app on same page

Post by EverLearning »

None that I can remember. Take a look at these

Ajax.Updater
Using the Ajax.Updater class

This is from Prototype Javascript framework.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Displaying more than one php app on same page

Post by RobertGonzalez »

Are you wanting to have executable php scripts that are independent of one another that can be interacted with by the user in the same browser window? Or do you just want to run multiple PHP scripts in the same window?
jeffamm
Forum Newbie
Posts: 6
Joined: Thu Apr 10, 2008 11:36 am

Re: Displaying more than one php app on same page

Post by jeffamm »

I'm not sure of the difference in the two choices so here's an example. I have a script installed in one folder of my hosting account that is for classified ads. I have a second script, totally separate from the first script, installed in a second folder, that looks up a telephone area code. I just want to have a single web page where the user can see and use the input/output screen of each script. I could create an html page with an two iframes, each one targeted on its respective script's home page. However iframes have browser compatibility issues that I want to avoid. Is there another/better way?

I hope this explains it - there's probably better/clearer language to explain what I'm trying to do, but I don't know the right terms.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Displaying more than one php app on same page

Post by RobertGonzalez »

No, you answered it pretty well. You are looking for asynchronous request/response handling, or in modern terminology, Ajax.

This means that you will have to code your page in a way that either tells the user that Javascript is required or you will have to code fall backs in case it is not.

There are boatloads of tutorials around on the use of the XMLHttpRequest object, Ajax and the like.
jeffamm
Forum Newbie
Posts: 6
Joined: Thu Apr 10, 2008 11:36 am

Re: Displaying more than one php app on same page

Post by jeffamm »

Mr. Mod, thanks - which will work on more browsers - ajax/javascript or iframes?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Displaying more than one php app on same page

Post by RobertGonzalez »

Javascript is probably going to work for you the most consistently but is not always guaranteed to be available. iFrames are just about supported everywhere, but some users have misgivings about them.

It is just about six of one and a half dozen of the other. Realistically I'd say go Ajax.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Displaying more than one php app on same page

Post by John Cartwright »

Everah wrote:. Realistically I'd say go Ajax.
In this instance I would not suggest using Ajax. For a beginner I would certainly suggest using frames in this case, since the OP may find himself a bit overwhelmed because it's likely going to entail some engineering to have the two app's play nice together in a single request. By using iframes we are treating them as separate requests (hence separate windows) and should work right away without any tweaking.

Very seldomly do I suggest using frames.. but they have their place and time.
jeffamm
Forum Newbie
Posts: 6
Joined: Thu Apr 10, 2008 11:36 am

Re: Displaying more than one php app on same page

Post by jeffamm »

OK thanks for the advice guys. Am I correct that iframes are not supported by IE7 unless it is specifically activated by the user?
Post Reply