467,075 Members | 1,089 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,075 developers. It's quick & easy.

Two PHP Scripts on same page?

Hello,

I have two small PHP scripts running on a test page at:
http://www.usernomics.com/ergonomic-...essories5.html

Both scripts work perfectly when there is one script on a page. However, if
I place two on the page (one above the other), the second script will not
render. I get no PHP error messages - the script will just not render.

I think the PHP Scripts are OK as they were automatically generated by RSS
Feed Burner and both do run separately.

There may be an issue with having separate calls of some kind on the page or
my server might not be set right. I did a server test that I think shows
that it is OK but I am not sure. The results table is at
http://www.usernomics.com/ergonomic-...ries-test.html . The
only think I have in my htaccess file for PHP is: "AddType
application/x-httpd-php .htm .html" .

I am new to PHP and was wondering if anyone can see why both scripts will
not run together?

Thanks a lot,

Bob
Jul 26 '05 #1
  • viewed: 3830
Share:
7 Replies


ergobob wrote:
Hello,

I have two small PHP scripts running on a test page at:
http://www.usernomics.com/ergonomic-...essories5.html

Both scripts work perfectly when there is one script on a page. However, if
I place two on the page (one above the other), the second script will not
render. I get no PHP error messages - the script will just not render.


Its cuz both scripts have a <body></body> It seems to render ok here
in IE, in FF its all wierd, like the divs are overlapping. Probly in
your browser, its stopping at the first </body>.

--
juglesh

Jul 26 '05 #2

"juglesh" <ju*********@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...


ergobob wrote:
Hello,

I have two small PHP scripts running on a test page at:
http://www.usernomics.com/ergonomic-...essories5.html

Both scripts work perfectly when there is one script on a page. However,
if
I place two on the page (one above the other), the second script will not
render. I get no PHP error messages - the script will just not render.


Its cuz both scripts have a <body></body> It seems to render ok here
in IE, in FF its all wierd, like the divs are overlapping. Probly in
your browser, its stopping at the first </body>.

--
juglesh


Thanks for the information juglesh. I am new to all of this. How would you
change that to make it work?

Thanks,

Bob
Jul 26 '05 #3


ergobob wrote:
"juglesh" <ju*********@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...


ergobob wrote:
Hello,

I have two small PHP scripts running on a test page at:
http://www.usernomics.com/ergonomic-...essories5.html

Both scripts work perfectly when there is one script on a page. However,
if
I place two on the page (one above the other), the second script will not
render. I get no PHP error messages - the script will just not render.


Its cuz both scripts have a <body></body> It seems to render ok here
in IE, in FF its all wierd, like the divs are overlapping. Probly in
your browser, its stopping at the first </body>.

--
juglesh


Thanks for the information juglesh. I am new to all of this. How would you
change that to make it work?


You'll have to look at the scripts you are including. Without knowing
exactly what youre working with, (is the main page yours? are you
including the other scripts, or are you starting with one script, and
adding the other, etc) What I would do, is make my own page.php. Then
include the scripts you need. But, edit those scripts so they dont
have the body tags. Your page will have the body tags. So your script
will look like:

<head>stuff</head>
<body>
include scriptone.php
include scripttwo.php
</body>

Or, you could edit the closing body tag out of the first, and the
opening body tag out of the second.

Then youre going to need to look at your divs and figure out the
positioning, relative/absolute, etc.

hth
--
juglesh

Jul 27 '05 #4

Without being able to see the PHP code it's difficult to pin-point what the
problem may be (viewing the source of a page online just returns HTML, no
PHP).

Just a little brainstorm:

- make sure any open braces '{' are matched with a closing brace '}'

- make sure all '<?php' tags are matched with a closing '?>' tag

- check if one of the scripts has a 'die();' command, if so, it could be
terminating the page at that point

Having 2 PHP scripts on the same page should cause no problems at all. So
I'm thinking it's probably an overlapping tag of some sort.

Luke


"ergobob" <ergobob@sonic[REMOVE].net> wrote in message
news:7a******************@typhoon.sonic.net...
Hello,

I have two small PHP scripts running on a test page at:
http://www.usernomics.com/ergonomic-...essories5.html

Both scripts work perfectly when there is one script on a page. However, if I place two on the page (one above the other), the second script will not
render. I get no PHP error messages - the script will just not render.

I think the PHP Scripts are OK as they were automatically generated by RSS
Feed Burner and both do run separately.

There may be an issue with having separate calls of some kind on the page or my server might not be set right. I did a server test that I think shows
that it is OK but I am not sure. The results table is at
http://www.usernomics.com/ergonomic-...ries-test.html . The
only think I have in my htaccess file for PHP is: "AddType
application/x-httpd-php .htm .html" .

I am new to PHP and was wondering if anyone can see why both scripts will
not run together?

Thanks a lot,

Bob

Jul 27 '05 #5
Hi Guys,

Thanks for the reply. I thought I would give you more information in the
hopes that it will help.

Both scripts are supposed to pull in 10 news articles. There is an ad at the
very bottom of the news articles from RSS Feed Reader. The first script
shows the 10 articles but the second script only shows the ad. It does not
bring in the 10 articles.

If I reverse the order of the feeds, it shows that both work but on the
first one renders the 10 articles. Also, the PHP was automatically generated
by RSS Feed Reader so I think they both work fine. It is the second of the
sequence that is the problem.

The PHP scripts are very similar but they bring in articles from two
different feeds. The host is the same for both though.

Below are the PHP scripts.

Does this give you any ideas? Several people have looked at
this with no solution.

Thanks a lot,

Bob

---
<!-- RSS Feed Reader Usability In The News -->
<div class="centerall"><a
href="http://www.usernomics.com/news/user-interface-design-news.html"
title="Usernomics In The News">Usability In The News</a></div>
<div class="centermedium">Latest Headlines
<div class="scroll">
<?php
include
("http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FNe wsErgonomicsUserInterfaceDesignComputerHumanIntera ctionhci&newpage=&chead=&atl=&desc=1&auth=&dts=&wi dth=128&max=10&tlen=0&rnd=&bt=&bs=None&nmb=1&ntb=1 &naf=1&nst=1&nwd=0&nht=0&dlen=100&bg=%23FFFFFF&bc= &tc=BLACK&ts=8&tfont=Verdana,+Arial,+Sans-serif&rf=".$HTTP_SERVER_VARS['SERVER_NAME'].$HTTP_SERVER_VARS['PHP_SELF']."&phpout=1");
?>
</div>
<div class="centermedium"><a
href="http://feeds.feedburner.com/NewsErgonomicsUserInterfaceDesignComputerHumanInte ractionhci"
title="Usability News Feed"><img src="images/site/rss.gif" alt="Usability In
The News RSS Feed"></a></div>
</div>
<!-- /RSS Feed Reader Usability In The News -->

<!-- /RSS Feed Reader Ergonomics In The News -->
<div class="centerall"><a
href="http://www.usernomics.com/news/workplace-ergonomics-news.html"
title="Ergonomics In The News">Ergonomics In The News</a></div>
<div class="centermedium">Latest Headlines

<div class="scroll">
<?php
include
("http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FUs ernomicsWorkplaceErgonomicsSafetyBiometrics&newpag e=&chead=&atl=&desc=1&auth=&dts=&width=128&max=10& tlen=0&rnd=&bt=&bs=None&nmb=1&ntb=1&naf=1&nst=1&nw d=0&nht=0&dlen=100&bg=%23FFFFFF&bc=&tc=BLACK&ts=8& tfont=Verdana,+Arial,+Sans-serif&rf=".$HTTP_SERVER_VARS['SERVER_NAME'].$HTTP_SERVER_VARS['PHP_SELF']."&phpout=1");
?>

</div>
<div class="centermedium"><a
href="http://feeds.feedburner.com/UsernomicsWorkplaceErgonomicsSafetyBiometrics"
title="Ergonomics News Feed"><img src="images/site/rss.gif" alt="Ergonomics
In The News RSS Feed"></a></div>
</div>
<!-- /RSS Feed Reader Ergonomics In The News -->

</div>
Jul 27 '05 #6

Odd :).

I'm wondering whether the rssfeeder site's script is identifying your site
once with the URL of the first include

$HTTP_SERVER_VARS['SERVER_NAME'].$HTTP_SERVER_VARS['PHP_SELF']

and is then refusing to serve you any more with the second include, as a
security measure.

Could be a good question to ask the rssfeeder site's owner.

Luke

"ergobob" <ergobob@sonic[REMOVE].net> wrote in message
news:r7******************@typhoon.sonic.net...
Hi Guys,

Thanks for the reply. I thought I would give you more information in the
hopes that it will help.

Both scripts are supposed to pull in 10 news articles. There is an ad at the very bottom of the news articles from RSS Feed Reader. The first script
shows the 10 articles but the second script only shows the ad. It does not
bring in the 10 articles.

If I reverse the order of the feeds, it shows that both work but on the
first one renders the 10 articles. Also, the PHP was automatically generated by RSS Feed Reader so I think they both work fine. It is the second of the
sequence that is the problem.

The PHP scripts are very similar but they bring in articles from two
different feeds. The host is the same for both though.

Below are the PHP scripts.

Does this give you any ideas? Several people have looked at
this with no solution.

Thanks a lot,

Bob

---
<!-- RSS Feed Reader Usability In The News -->
<div class="centerall"><a
href="http://www.usernomics.com/news/user-interface-design-news.html"
title="Usernomics In The News">Usability In The News</a></div>
<div class="centermedium">Latest Headlines
<div class="scroll">
<?php
include
("http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Ffeeds.feedburne
r.com%2FNewsErgonomicsUserInterfaceDesignComputerH umanInteractionhci&newpage
=&chead=&atl=&desc=1&auth=&dts=&width=128&max=10&t len=0&rnd=&bt=&bs=None&nmb
=1&ntb=1&naf=1&nst=1&nwd=0&nht=0&dlen=100&bg=%23FF FFFF&bc=&tc=BLACK&ts=8&tfo
nt=Verdana,+Arial,+Sans-serif&rf=".$HTTP_SERVER_VARS['SERVER_NAME'].$HTTP_SE
RVER_VARS['PHP_SELF']."&phpout=1"); ?>
</div>
<div class="centermedium"><a
href="http://feeds.feedburner.com/NewsErgonomicsUserInterfaceDesignComputerH
umanInteractionhci" title="Usability News Feed"><img src="images/site/rss.gif" alt="Usability In The News RSS Feed"></a></div>
</div>
<!-- /RSS Feed Reader Usability In The News -->

<!-- /RSS Feed Reader Ergonomics In The News -->
<div class="centerall"><a
href="http://www.usernomics.com/news/workplace-ergonomics-news.html"
title="Ergonomics In The News">Ergonomics In The News</a></div>
<div class="centermedium">Latest Headlines

<div class="scroll">
<?php
include
("http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Ffeeds.feedburne
r.com%2FUsernomicsWorkplaceErgonomicsSafetyBiometr ics&newpage=&chead=&atl=&d
esc=1&auth=&dts=&width=128&max=10&tlen=0&rnd=&bt=& bs=None&nmb=1&ntb=1&naf=1&
nst=1&nwd=0&nht=0&dlen=100&bg=%23FFFFFF&bc=&tc=BLA CK&ts=8&tfont=Verdana,+Ari
al,+Sans-serif&rf=".$HTTP_SERVER_VARS['SERVER_NAME'].$HTTP_SERVER_VARS['PHP_
SELF']."&phpout=1"); ?>

</div>
<div class="centermedium"><a
href="http://feeds.feedburner.com/UsernomicsWorkplaceErgonomicsSafetyBiometr
ics" title="Ergonomics News Feed"><img src="images/site/rss.gif" alt="Ergonomics In The News RSS Feed"></a></div>
</div>
<!-- /RSS Feed Reader Ergonomics In The News -->

</div>

Jul 27 '05 #7

"luke" <ld*******@eml.nope> wrote in message
news:f_*******************@news.xtra.co.nz...

Odd :).

I'm wondering whether the rssfeeder site's script is identifying your site
once with the URL of the first include

$HTTP_SERVER_VARS['SERVER_NAME'].$HTTP_SERVER_VARS['PHP_SELF']

and is then refusing to serve you any more with the second include, as a
security measure.

Could be a good question to ask the rssfeeder site's owner.

Luke

"ergobob" <ergobob@sonic[REMOVE].net> wrote in message
news:r7******************@typhoon.sonic.net...
Hi Guys,

Thanks for the reply. I thought I would give you more information in the
hopes that it will help.

Both scripts are supposed to pull in 10 news articles. There is an ad at

the
very bottom of the news articles from RSS Feed Reader. The first script
shows the 10 articles but the second script only shows the ad. It does
not
bring in the 10 articles.

If I reverse the order of the feeds, it shows that both work but on the
first one renders the 10 articles. Also, the PHP was automatically

generated
by RSS Feed Reader so I think they both work fine. It is the second of
the
sequence that is the problem.

The PHP scripts are very similar but they bring in articles from two
different feeds. The host is the same for both though.

Below are the PHP scripts.

Does this give you any ideas? Several people have looked at
this with no solution.

Thanks a lot,

The answer to the problem is to put <?php unset($arnews);?>
before each include.

Bob
Jul 28 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Patricio Stegmann | last post: by
3 posts views Thread by Unregistered | last post: by
17 posts views Thread by StevePBurgess@gmail.com | last post: by
3 posts views Thread by shapper | last post: by
5 posts views Thread by webmaster@imca-int.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.