By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,216 Members | 1,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,216 IT Pros & Developers. It's quick & easy.

load frameset file form php include?

P: n/a
Hello

I'm having a problem loading a frameset file using an include in a php
file.

Nothing is displayed and when I look at the source code I see that

<html>
<head>
<title></title>
</head>
<body>
</body>
</html>

is above the frameset code - and presumably because the <body></body>
tags are there, the frameset will not work?

How can I correct this?

Cheers

Geoff
Aug 13 '08 #1
Share this Question
Share on Google+
12 Replies


P: n/a
On 13 Aug, 21:25, Geoff Cox <g...@freeuk.notcomwrote:
Hello

I'm having a problem loading a frameset file using an include in a php
file.

Nothing is displayed and when I look at the source code I see that

<html>
<head>
<title></title>
</head>
<body>
</body>
</html>

is above the frameset code - and presumably because the <body></body>
tags are there, the frameset will not work?

How can I correct this?

Cheers

Geoff
Damn, there I was carefully looking at your code, when my crystal ball
died!
Aug 13 '08 #2

P: n/a
On Wed, 13 Aug 2008 13:36:14 -0700 (PDT), Captain Paralytic
<pa**********@yahoo.comwrote:
>On 13 Aug, 21:25, Geoff Cox <g...@freeuk.notcomwrote:
>Hello

I'm having a problem loading a frameset file using an include in a php
file.

Nothing is displayed and when I look at the source code I see that

<html>
<head>
<title></title>
</head>
<body>
</body>
</html>

is above the frameset code - and presumably because the <body></body>
tags are there, the frameset will not work?

How can I correct this?

Cheers

Geoff

Damn, there I was carefully looking at your code, when my crystal ball
died!
OK!

1. The php file which has the include

<?php
@require(dirname(__FILE__) . '/../../config_php/config.php');

$name_of_user = $_SERVER['REMOTE_USER'];

$link = mysql_connect(
$conf['sql']['host'],
$conf['sql']['user'],
$conf['sql']['pass']
) or die ("cannot make connection to {$conf['sql']['db']}");

$query ="select * from best_users where " . "user_name " ."like" .
"'%" . mysql_real_escape_string($name_of_user) . "%'"; // OK

if (mysql_select_db($conf['sql']['db'],$link)) {

$result = mysql_query($query, $link);

if ($result) {
while ($row = mysql_fetch_array($result)) {

for ($n=0; $n<7;$n++) {
if ($row[$n]==1) {
include 'menu.htm';
}
}

}

} else {
echo mysql_error();
}

}

?>
2. and in menu.htm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>

<!-- frames -->
<frameset rows="75,*">
<frame src="topbar-frameset-2.php" name="topbar" scrolling="no">
<frame src="frameset2.htm" name="Display">
<noframes><BODY>
<!-- Alternative non-framed version -->
need frames browser
</body></noframes>
</frameset>
</frameset>

</html>

3. what I see when I look at the source code for the page created by
the php file above

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>

<body>

</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>

<!-- frames -->
<frameset rows="75,*">
<frame src="topbar-frameset-2.php" name="topbar" scrolling="no">
<frame src="frameset2.htm" name="Display">
<noframes><BODY>
<!-- Alternative non-framed version -->
need frames browser
</body></noframes>
</frameset>
</frameset>

</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>

<!-- frames -->
<frameset rows="75,*">
<frame src="topbar-frameset-2.php" name="topbar" scrolling="no">
<frame src="frameset2.htm" name="Display">
<noframes><BODY>
<!-- Alternative non-framed version -->
need frames browser
</body></noframes>
</frameset>
</frameset>

</html>

Cheers

Geoff

Aug 13 '08 #3

P: n/a
On Aug 13, 4:01*pm, Geoff Cox <g...@freeuk.notcomwrote:
On Wed, 13 Aug 2008 13:36:14 -0700 (PDT), Captain Paralytic
I am not going to quote all of your long code, but only the following
bit:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
If you are using html 4.01, you must use the frame set version of html
4.01, not transitional or strict. If you use an iframe, you may use
either the frameset or transitional version of html 4.01, but not
strict. Often the page will work with the wrong Doctype, but it will
not validate at the W3C validator. However I would correct the Doctype
before looking for other errors and I would next validate at W3C to
get rid of any other possible errors before looking for more exotic
problems.

Aug 13 '08 #4

P: n/a
On Wed, 13 Aug 2008 16:14:22 -0700 (PDT), cwdjrxyz
<sp*******@cwdjr.infowrote:
>On Aug 13, 4:01*pm, Geoff Cox <g...@freeuk.notcomwrote:
>On Wed, 13 Aug 2008 13:36:14 -0700 (PDT), Captain Paralytic

I am not going to quote all of your long code, but only the following
bit:
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

If you are using html 4.01, you must use the frame set version of html
4.01, not transitional or strict. If you use an iframe, you may use
either the frameset or transitional version of html 4.01, but not
strict. Often the page will work with the wrong Doctype, but it will
not validate at the W3C validator. However I would correct the Doctype
before looking for other errors and I would next validate at W3C to
get rid of any other possible errors before looking for more exotic
problems.
thanks for the suggestions - I have carrired out both but still have
the problem!

Cheers

Geoff
Aug 14 '08 #5

P: n/a
On Wed, 13 Aug 2008 13:36:14 -0700 (PDT), Captain Paralytic
<pa**********@yahoo.comwrote:
>Damn, there I was carefully looking at your code, when my crystal ball
died!
1. if I use a simple php file and menu.htm the frames work

<?php
include 'menu.htm';
?>

and menu.htm being

<html>
<head>
<title>Untitled</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
</head>

<!-- frames -->
<frameset rows="75,*">
<frame src="topbar-frameset.htm" name="topbar" scrolling="no">
<frame src="frameset2.htm" name="Display">

<noframes><body>
<!-- Alternative non-framed version -->
need frames browser
</body>
</noframes>
</frameset>

</html>
2. if I use the more complicated php file and the same menu file the
frames do not work because for some reason this has been added above
the included frameset code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
</body>
</html>

Where does this come from?!

Cheers

Geoff

3. the more complicated php file

<?php
@require(dirname(__FILE__) . '/../../config_php/config.php');

//$name_of_user = ($_POST['username']);

$name_of_user = $_SERVER['REMOTE_USER'];

$link = mysql_connect(
$conf['sql']['host'],
$conf['sql']['user'],
$conf['sql']['pass']
) or die ("cannot make connection to {$conf['sql']['db']}");

$query ="select * from best_users where " . "user_name " ."like" .
"'%" . mysql_real_escape_string($name_of_user) . "%'"; // OK

if (mysql_select_db($conf['sql']['db'],$link)) {

$result = mysql_query($query, $link);

if ($result) {
while ($row = mysql_fetch_array($result)) {

for ($n=0; $n<7;$n++) {
if ($row[$n]==1) {
//echo $n . "<br>";

//include 'ajax-groups-'. $n . ".htm";
include 'menu-'. $n . ".htm";

}
}

}

} else {
echo mysql_error();
}

}

?>
Aug 14 '08 #6

P: n/a
Message-ID: <pm********************************@4ax.comfrom Geoff Cox
contained the following:
>2. if I use the more complicated php file and the same menu file the
frames do not work because for some reason this has been added above
the included frameset code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
</body>
</html>

Where does this come from?!
Well it won't appear by magic.

What's in config.php?

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk
Aug 14 '08 #7

P: n/a
On Thu, 14 Aug 2008 08:55:12 +0100, Geoff Berrow
<bl******@ckdog.co.ukwrote:
>Message-ID: <pm********************************@4ax.comfrom Geoff Cox
contained the following:
>>2. if I use the more complicated php file and the same menu file the
frames do not work because for some reason this has been added above
the included frameset code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
</body>
</html>

Where does this come from?!

Well it won't appear by magic.

What's in config.php?
Geoff,

Brilliant!

config.php has <htmletc tags - removing them and the frameset file
loads OK.

Many thanks - I was going round in circles and would not have thought
to look in config.php thinking it was simply read to get the mysql
access details.

Cheers,

Geoff
Aug 14 '08 #8

P: n/a
cwdjrxyz wrote:
On Aug 13, 4:01 pm, Geoff Cox <g...@freeuk.notcomwrote:
>On Wed, 13 Aug 2008 13:36:14 -0700 (PDT), Captain Paralytic

I am not going to quote all of your long code, but only the following
bit:
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

If you are using html 4.01, you must use the frame set version of html
4.01, not transitional or strict. If you use an iframe, you may use
either the frameset or transitional version of html 4.01, but not
strict. Often the page will work with the wrong Doctype, but it will
not validate at the W3C validator. However I would correct the Doctype
before looking for other errors and I would next validate at W3C to
get rid of any other possible errors before looking for more exotic
problems.

Which has absolutely nothing to do with the fact the incorrect code is
being generated...

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Aug 14 '08 #9

P: n/a
On Aug 14, 8:32*am, Jerry Stuckle <jstuck...@attglobal.netwrote:
cwdjrxyz wrote:
On Aug 13, 4:01 pm, Geoff Cox <g...@freeuk.notcomwrote:
On Wed, 13 Aug 2008 13:36:14 -0700 (PDT), Captain Paralytic
I am not going to quote all of your long code, but only the following
bit:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
If you are using html 4.01, you must use the frame set version of html
4.01, not transitional or strict. If you use an iframe, you may use
either the frameset or transitional version of html 4.01, but not
strict. Often the page will work with the wrong Doctype, but it will
not validate at the W3C validator. However I would correct the Doctype
before looking for other errors and I would next validate at W3C to
get rid of any other possible errors before looking for more exotic
problems.

Which has absolutely nothing to do with the fact the incorrect code is
being generated...
I say it has everything to do with the fact that incorrect code is
being generated. If you want W3C valid code, you do not use frames
with html 4.01 transitional, you must use frameset html 4.01, although
iframes would be allowed for 4.01 transitional. The code for the page
can not be valid no matter what else it includes if a frame is used.
Of course most html browsers are so loose with standards that the page
may work anyway with invalid code. Such is not the case with xhtml 1.1
properly served as application/xhtml+xml. In such a case the page is
parsed as xml and no parsing errors are allowed by W3C standards. Thus
you get an error message from the xml parser rather than a view of the
page. An html page with errors often allows you to view the page,
although it may not be what you had in mind. One should always clean
up the html or xhtml code to validate as html or xhtml and css at the
W3C before looking for other possible errors in the code.

Aug 22 '08 #10

P: n/a
cwdjrxyz wrote:
On Aug 14, 8:32 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
>cwdjrxyz wrote:
>>On Aug 13, 4:01 pm, Geoff Cox <g...@freeuk.notcomwrote:
On Wed, 13 Aug 2008 13:36:14 -0700 (PDT), Captain Paralytic
I am not going to quote all of your long code, but only the following
bit:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
If you are using html 4.01, you must use the frame set version of html
4.01, not transitional or strict. If you use an iframe, you may use
either the frameset or transitional version of html 4.01, but not
strict. Often the page will work with the wrong Doctype, but it will
not validate at the W3C validator. However I would correct the Doctype
before looking for other errors and I would next validate at W3C to
get rid of any other possible errors before looking for more exotic
problems.
Which has absolutely nothing to do with the fact the incorrect code is
being generated...

I say it has everything to do with the fact that incorrect code is
being generated. If you want W3C valid code, you do not use frames
with html 4.01 transitional, you must use frameset html 4.01, although
iframes would be allowed for 4.01 transitional. The code for the page
can not be valid no matter what else it includes if a frame is used.
Of course most html browsers are so loose with standards that the page
may work anyway with invalid code. Such is not the case with xhtml 1.1
properly served as application/xhtml+xml. In such a case the page is
parsed as xml and no parsing errors are allowed by W3C standards. Thus
you get an error message from the xml parser rather than a view of the
page. An html page with errors often allows you to view the page,
although it may not be what you had in mind. One should always clean
up the html or xhtml code to validate as html or xhtml and css at the
W3C before looking for other possible errors in the code.

You should learn to separate PHP from HTML. The problem he reported had
absolutely nothing to do with the doctype declaration.

Please tell me how the incorrect doctype created the page source he
reported.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Aug 22 '08 #11

P: n/a
On Aug 22, 6:09*am, Jerry Stuckle <jstuck...@attglobal.netwrote:
cwdjrxyz wrote:
On Aug 14, 8:32 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
cwdjrxyz wrote:
On Aug 13, 4:01 pm, Geoff Cox <g...@freeuk.notcomwrote:
On Wed, 13 Aug 2008 13:36:14 -0700 (PDT), Captain Paralytic
I am not going to quote all of your long code, but only the following
bit:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
If you are using html 4.01, you must use the frame set version of html
4.01, not transitional or strict. If you use an iframe, you may use
either the frameset or transitional version of html 4.01, but not
strict. Often the page will work with the wrong Doctype, but it will
not validate at the W3C validator. However I would correct the Doctype
before looking for other errors and I would next validate at W3C to
get rid of any other possible errors before looking for more exotic
problems.
Which has absolutely nothing to do with the fact the incorrect code is
being generated...
I say it has everything to do with the fact that incorrect code is
being generated. If you want W3C valid code, you do not use frames
with html 4.01 transitional, you must use frameset html 4.01, although
iframes would be allowed for 4.01 transitional. The code for the page
can not be valid no matter what else it includes if a frame is used.
Of course most html browsers are so loose with standards that the page
may work anyway with invalid code. Such is not the case with xhtml 1.1
properly served as application/xhtml+xml. In such a case the page is
parsed as xml and no parsing errors are allowed by W3C standards. Thus
you get an error message from the xml parser rather than a view of the
page. An html page with errors often allows you to view the page,
although it may not be what you had in mind. One should always clean
up the html or xhtml code to validate as html or xhtml and css at the
W3C before looking for other possible errors in the code.

You should learn to separate PHP from HTML. *The problem he reported had
absolutely nothing to do with the doctype declaration.
And how is one supposed to do that when php is in part being used for
writing a whole html code to be delivered to the browser? One must
consider the whole. Any page should be validated before you look for
other possible errors.
>
Please tell me how the incorrect doctype created the page source he
reported.
What a strange question. Doctype, html etc do not create a page source
- a person, sometimes with the help of a program, creates source code.
However the Doctype plus the first instance of the use of frame insure
that the page is invalid, no matter what other code you have in it, be
it html, html generated using server side script, or html generated
using client side JavaScript. If you do not care if a page is valid,
you might talk about other code in it or used to create it and the
page may still work with a few validation errors given the loose
nature of html parsers. But if you wish valid code, you should first
correct it to validate before you start trying to find other reasons
why the page may not work. If you write valid xhtml 1.1 with the
correct mime type application/xhtml+xml set on the server, then you
can be nearly certain that a page will not work if even one validation
error is detected by the xml parser that is used.

Have you used many of the php codes given in many recent books? You
find many that generate invalid html even for html 4.01 strict and
even more that require extensive modification of php code to work
right on a true xhtml page served properly as aplicationxhtml+xml.
Unfortunately php can not be separated from html, xhtml, xml, etc in
the real world if it is to deliver code to a browser via download. Of
course no IE browser up to and including IE 7 can handled xhtml
properly served as application/xhtml+xml. One way of getting around
this is to use a php include at the very top of the page for header
exchange with the browser. If the browser reports it understands
xhtml, the code is delivered to it as written. If the browser can not
handle true xhtml, the page is rewritten from say xhtml 1.1 to html
4.01 strict using regular expressions etc to modify the code and
change the Doctype etc to that for html 4.01.

This discussion is at an end. If we both have not made our case to the
other one, we likely never will.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Aug 22 '08 #12

P: n/a
cwdjrxyz wrote:
On Aug 22, 6:09 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
>cwdjrxyz wrote:
>>On Aug 14, 8:32 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
cwdjrxyz wrote:
On Aug 13, 4:01 pm, Geoff Cox <g...@freeuk.notcomwrote:
>On Wed, 13 Aug 2008 13:36:14 -0700 (PDT), Captain Paralytic
I am not going to quote all of your long code, but only the following
bit:
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
If you are using html 4.01, you must use the frame set version of html
4.01, not transitional or strict. If you use an iframe, you may use
either the frameset or transitional version of html 4.01, but not
strict. Often the page will work with the wrong Doctype, but it will
not validate at the W3C validator. However I would correct the Doctype
before looking for other errors and I would next validate at W3C to
get rid of any other possible errors before looking for more exotic
problems.
Which has absolutely nothing to do with the fact the incorrect code is
being generated...
I say it has everything to do with the fact that incorrect code is
being generated. If you want W3C valid code, you do not use frames
with html 4.01 transitional, you must use frameset html 4.01, although
iframes would be allowed for 4.01 transitional. The code for the page
can not be valid no matter what else it includes if a frame is used.
Of course most html browsers are so loose with standards that the page
may work anyway with invalid code. Such is not the case with xhtml 1.1
properly served as application/xhtml+xml. In such a case the page is
parsed as xml and no parsing errors are allowed by W3C standards. Thus
you get an error message from the xml parser rather than a view of the
page. An html page with errors often allows you to view the page,
although it may not be what you had in mind. One should always clean
up the html or xhtml code to validate as html or xhtml and css at the
W3C before looking for other possible errors in the code.
You should learn to separate PHP from HTML. The problem he reported had
absolutely nothing to do with the doctype declaration.

And how is one supposed to do that when php is in part being used for
writing a whole html code to be delivered to the browser? One must
consider the whole. Any page should be validated before you look for
other possible errors.
Not necessarily. All PHP does is send text to the browser. Look at the
source. If it's what you expected, but it's incorrect, you need to
correct the html. If, OTOH, you're getting PHP errors, etc. it's a PHP
problem.

In this case there were no PHP errors. But the HTML being generated was
incorrect.

>Please tell me how the incorrect doctype created the page source he
reported.

What a strange question. Doctype, html etc do not create a page source
- a person, sometimes with the help of a program, creates source code.
However the Doctype plus the first instance of the use of frame insure
that the page is invalid, no matter what other code you have in it, be
it html, html generated using server side script, or html generated
using client side JavaScript. If you do not care if a page is valid,
you might talk about other code in it or used to create it and the
page may still work with a few validation errors given the loose
nature of html parsers. But if you wish valid code, you should first
correct it to validate before you start trying to find other reasons
why the page may not work. If you write valid xhtml 1.1 with the
correct mime type application/xhtml+xml set on the server, then you
can be nearly certain that a page will not work if even one validation
error is detected by the xml parser that is used.
Nope. But you don't need PHP to generate it, either. I didn't say
anything about whether I care if the page is valid or not. But you
can't seem to discern there is a difference between HTML and PHP.
Have you used many of the php codes given in many recent books? You
find many that generate invalid html even for html 4.01 strict and
even more that require extensive modification of php code to work
right on a true xhtml page served properly as aplicationxhtml+xml.
Unfortunately php can not be separated from html, xhtml, xml, etc in
the real world if it is to deliver code to a browser via download. Of
course no IE browser up to and including IE 7 can handled xhtml
properly served as application/xhtml+xml. One way of getting around
this is to use a php include at the very top of the page for header
exchange with the browser. If the browser reports it understands
xhtml, the code is delivered to it as written. If the browser can not
handle true xhtml, the page is rewritten from say xhtml 1.1 to html
4.01 strict using regular expressions etc to modify the code and
change the Doctype etc to that for html 4.01.
I really don't care what's in "many recent books". But just because you
have invalid HTML does NOT mean you have invalid PHP CODE.
This discussion is at an end. If we both have not made our case to the
other one, we likely never will.
Learn the difference between a server-side scripting language such as
PHP and the output generated and sent to the browser. They are not the
same thing.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Aug 22 '08 #13

This discussion thread is closed

Replies have been disabled for this discussion.