473,837 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
7 4291


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*********@ho tmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.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*********@ho tmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.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@soni c[REMOVE].net> wrote in message
news:7a******** **********@typh oon.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="centeral l"><a
href="http://www.usernomics. com/news/user-interface-design-news.html"
title="Usernomi cs In The News">Usability In The News</a></div>
<div class="centerme dium">Latest Headlines
<div class="scroll">
<?php
include
("http://www.rssfeedread er.com/rss3/rss.php?url=htt p%3A%2F%2Ffeeds .feedburner.com %2FNewsErgonomi csUserInterface DesignComputerH umanInteraction hci&newpage=&ch ead=&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=%23 FFFFFF&bc=&tc=B LACK&ts=8&tfont =Verdana,+Arial ,+Sans-serif&rf=".$HTT P_SERVER_VARS['SERVER_NAME'].$HTTP_SERVER_V ARS['PHP_SELF']."&phpout=1" );
?>
</div>
<div class="centerme dium"><a
href="http://feeds.feedburne r.com/NewsErgonomicsU serInterfaceDes ignComputerHuma nInteractionhci "
title="Usabilit y 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="centeral l"><a
href="http://www.usernomics. com/news/workplace-ergonomics-news.html"
title="Ergonomi cs In The News">Ergonomic s In The News</a></div>
<div class="centerme dium">Latest Headlines

<div class="scroll">
<?php
include
("http://www.rssfeedread er.com/rss3/rss.php?url=htt p%3A%2F%2Ffeeds .feedburner.com %2FUsernomicsWo rkplaceErgonomi csSafetyBiometr ics&newpage=&ch ead=&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=%23 FFFFFF&bc=&tc=B LACK&ts=8&tfont =Verdana,+Arial ,+Sans-serif&rf=".$HTT P_SERVER_VARS['SERVER_NAME'].$HTTP_SERVER_V ARS['PHP_SELF']."&phpout=1" );
?>

</div>
<div class="centerme dium"><a
href="http://feeds.feedburne r.com/UsernomicsWorkp laceErgonomicsS afetyBiometrics "
title="Ergonomi cs 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_VA RS['SERVER_NAME'].$HTTP_SERVER_V ARS['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@soni c[REMOVE].net> wrote in message
news:r7******** **********@typh oon.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="centeral l"><a
href="http://www.usernomics. com/news/user-interface-design-news.html"
title="Usernomi cs In The News">Usability In The News</a></div>
<div class="centerme dium">Latest Headlines
<div class="scroll">
<?php
include
("http://www.rssfeedread er.com/rss3/rss.php?url=htt p%3A%2F%2Ffeeds .feedburne
r.com%2FNewsErg onomicsUserInte rfaceDesignComp uterHumanIntera ctionhci&newpag e
=&chead=&atl=&d esc=1&auth=&dts =&width=128&max =10&tlen=0&rnd= &bt=&bs=None&nm b
=1&ntb=1&naf=1& nst=1&nwd=0&nht =0&dlen=100&bg= %23FFFFFF&bc=&t c=BLACK&ts=8&tf o
nt=Verdana,+Ari al,+Sans-serif&rf=".$HTT P_SERVER_VARS['SERVER_NAME'].$HTTP_SE
RVER_VARS['PHP_SELF']."&phpout=1" ); ?>
</div>
<div class="centerme dium"><a
href="http://feeds.feedburne r.com/NewsErgonomicsU serInterfaceDes ignComputerH
umanInteraction hci" title="Usabilit y 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="centeral l"><a
href="http://www.usernomics. com/news/workplace-ergonomics-news.html"
title="Ergonomi cs In The News">Ergonomic s In The News</a></div>
<div class="centerme dium">Latest Headlines

<div class="scroll">
<?php
include
("http://www.rssfeedread er.com/rss3/rss.php?url=htt p%3A%2F%2Ffeeds .feedburne
r.com%2FUsernom icsWorkplaceErg onomicsSafetyBi ometrics&newpag e=&chead=&atl=& d
esc=1&auth=&dts =&width=128&max =10&tlen=0&rnd= &bt=&bs=None&nm b=1&ntb=1&naf=1 &
nst=1&nwd=0&nht =0&dlen=100&bg= %23FFFFFF&bc=&t c=BLACK&ts=8&tf ont=Verdana,+Ar i
al,+Sans-serif&rf=".$HTT P_SERVER_VARS['SERVER_NAME'].$HTTP_SERVER_V ARS['PHP_
SELF']."&phpout=1" ); ?>

</div>
<div class="centerme dium"><a
href="http://feeds.feedburne r.com/UsernomicsWorkp laceErgonomicsS afetyBiometr
ics" title="Ergonomi cs 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_******** ***********@new s.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_VA RS['SERVER_NAME'].$HTTP_SERVER_V ARS['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@soni c[REMOVE].net> wrote in message
news:r7******** **********@typh oon.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
8823
by: Aardwolf | last post by:
I've had PHP on my Win2K server running IIs 5 for about 2 weeks now. I have an annoying problem in that I can not run the php scripts/pages locally, instead they open up in the browser as a download. By that I mean that If I access them via my lan or the net from another computer on my lan, the webpages that have php on them and end in a .php extension all run fine and work just great. BUT if I open up the browser on the IIs server...
2
4026
by: Patricio Stegmann | last post by:
Hi, I am trying to develop a very basic but portable chat engine with php. I would like to develop it without any database or filesystem stuff, because I want it very portable and easy to install. So I was looking for a way to make scripts communicate, or keep a kind of state . So someone told me to look for shared memory operations... shmop_open and all this things.... but I cant seem to find a script that uses this, or something that...
3
1479
by: Unregistered | last post by:
Hello! I came across two different scripts that I wanted to combine, and I thought I wa successful until I discovered a minor glitch. What was happening was that the page that was linked to came out fine but the page where the link was was linking out to another page . Here's what my code looks like.
12
1674
by: Mary Catherine | last post by:
I have 2 scipts that I am trying to get to run on the same page. One is a time/date script, the other is a countdown script (i.e. countdown days, hours, mins until a given date). They both work independent of each other, however, when both are on the page, the "active clock" does not work. I am assuming it is because some of the variables are the same??? Can anyone help please?!?! Here are the 2 scripts: **Active Clock that displays...
45
4759
by: Pat | last post by:
its seems asp.net validation doesn't fire when using FireFox? Tested a page and it doesn't fire. It seems the javascript doesn't fire Any ideas?
17
4254
by: StevePBurgess | last post by:
A really simple script is driving me up the wall. I have a very simply facility on a website to allow the user to reorder items in a database table as she wishes by clicking a link that (in this case) says "MOVE UP" and links to the script below. This script snippet that does all the work is shown - the database connection is established and after doing its work the script returns the user to the referring page.
5
2214
by: henryrhenryr | last post by:
Appologies for unclear title. I don't really understand the problem I'm facing. My system: PHP 5.2.1, Win2K, Apache 2, MySQL 5 (local - problem is same on my live site running php 4.3.9, Linux, Apache 2). Various browsers. No errors are reported (set to ALL and STRICT) with my problem. To describe the problem a little more: The symptoms - very slow page load. I can see the page reloading simply by observing the 'progress' bar in...
3
1422
by: shapper | last post by:
Hello, I am working on a web site where I have a master page. Most web site pages use this master page as base. Some scripts are used in all pages ... other just in a few pages. Should I load all scripts in master page ... I think they are cached right? Or should I load the common scripts to all pages in my master page and
5
1443
by: webmaster | last post by:
I am using two scripts (menus from milonic.com and a rotating news script we have used successfully for many years) on our website (www.imca-int.com) that independently work fine but together lead to the following error: Line: 20 Error: 'pageX' is null or not an object While I can use scripts, I'm not tech-savvy enough to troubleshoot them - can anyone assist?
0
9846
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9693
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10583
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10280
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9419
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7009
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4481
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3128
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.