View Full Version : Displaying output from html within page frame
02-12-2012, 07:42 PM
I am fairly new to programming and I want to run a html script within the page frame area that I have created for all of the pages on my website.
The Page Frame is defined with CSS. I have tried putting a link to run the script on the page frame, but it opens into a new window full screen.
The script also opens a php script, which I want to confine to this page frame.
I have tried using frameset which does almost mimic the page frame, but it does not look consistant with the rest of my site.
I would appreciate any suggestions on how I can achieve what I am aiming for.
02-12-2012, 08:07 PM
You use the term "frame".
Do you mean you have a <div> ... </div> section on your page?
Say you have one main page, you'll call it "index.php". (note the .php extension).
That is the default page that gets displayed when someone visits your site.
Consider it like a template. All pages use the same "index.php" script, but the
contents change accordingly.
In your directory, you have other files saved ... like p1.php, p2.php .. these are
different pages of text,html, etc. that you want displayed on your main page.
On your main page, you determine which "other file" to stick within the <div>...</div> area.
An example of using PHP to dynamically place information on your page ...
If your site is called "mysite.com" ... going to that will display your main page.
If they use a link like "mysite.com/?p=3" it will display the main page, but
the contents of file p3.php will be placed in the <div>...</div> section.
Look at the URL on this page you're reading now (codingforums). You'll see
coding like ?t=251402 ... that variable is used by the PHP script to know which
thread to display. No matter what thread you view, it's using the same PHP
script, but changing the content on the page.
02-12-2012, 09:28 PM
I'm not sure that I have explained the problem very well.
Below is the part of the css script that is difined as 'page box class in the html script.
css part script:
font : 16px 'Arial', Helvetica, sans-serif;
text-align : left;
position : absolute;
left : 0px;
top : 182px;
width : 1019px;
height : 585px;
html part script:
<div id="e18" class="page_box"></div>
I always want the output to display within this area leaving the header logo and navigation tabs available to use once the scripts that have been actioned or the user decides to abort the script. As I mentioned before I have an html script that then triggers a php script, which outputs a pdf document for printing. Once printed the user may want to go on to use another part of my site, I want the navigation tabs to be available at any time.
Do you get want I am trying to do?
02-12-2012, 10:57 PM
You may wanna embed the PDF with the <object> element (http://joliclic.free.fr/html/object-tag/en/index.php). I don’t know how reliable printing from that window would work, though.
02-13-2012, 05:07 PM
The PDF output is working OK!
I am using FPDF which converts the output from MySQL into printable text.
My problem is that when you go into the scripts that I have written to use this, it does not look consistant with the rest of my site.
I have tried using frameset to mimic the other web pages, but when I put the navigation tabs in a separate frame the resulting output when a link is chosen also opens in the frame. Is there a way of opening the link in a different frame to what it is actioned in?
02-13-2012, 05:32 PM
Yes, using "target".
I don't follow the part about the other scripts that use it don't look like the rest of your site.
Can you show us what you mean?
If everything is your website, why would it not look the same?
Or are you putting external websites (someone else's site) inside your frames?
02-14-2012, 11:41 PM
Managed to figure out what you said about target on the w3 site.
What I meant was that I wanted all of the content of the pages to display in the same area on the screen and all of the navigation tabs to be on each page. I have used the frameset tag and named each frame e.g. frame1 etc and used target to display in the correct frame.
Thanks for your help once again!
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.