Forum Moderators: coopster

Message Too Old, No Replies

Two PHP scripts on one page not working?

         

hymer

1:59 pm on Jul 26, 2005 (gmt 0)

10+ Year Member



Hello,

I have two small PHP scripts running on a test page

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

[edited by: coopster at 4:40 pm (utc) on July 26, 2005]
[edit reason] removed urls per TOS [webmasterworld.com] [/edit]

jatar_k

5:20 pm on Jul 26, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



there are known bugs with the second include via SSI to a php file not working with apache (2 i think)

Are you using a php parsed page, given your example the page extension should be .html

can you paste the code you are suing for the 2 includes?

hymer

6:28 pm on Jul 26, 2005 (gmt 0)

10+ Year Member



Hello jatar k,

Thanks for the response. The code is below.

Someone said that they thought the two </body> for the includes might be a problem with the script stopping at the first one. I have no idea but just mentioned it.

I'd appreciate any help on this.

Thanks,

Bob

---

<!-- RSS Feed Reader Usability In The News -->
<div class="centerall"><a href="http://www.example.com/news/user-interface-design-news.html">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%2F NewsErgonomicsUserInterfaceDesignComputerHumanInteractionhci&newpage=&chead=&atl=& desc=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=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/NewsErgonomicsUserInterfaceDesignComputerHumanInteractionhci" 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.example.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%2F WorkplaceErgonomicsSafetyBiometrics&newpage=&chead=&atl=&desc=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=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/UWorkplaceErgonomicsSafetyBiometrics" 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>

[edited by: jatar_k at 7:02 pm (utc) on July 26, 2005]
[edit reason] added spaces so it would wrap [/edit]

jatar_k

6:41 pm on Jul 26, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



have you checked the page source to see what's happening?

do you get any php errors?

it may just be an html issue as mentioned

hymer

6:59 pm on Jul 26, 2005 (gmt 0)

10+ Year Member



I don't get any PHP errors at all. I do get some W3C formatting errors that I plan to deal with later.

Note that the first script is showing 10 news articles and then an ad from RSS Feed Burner at the end. But the second script is not showing the news articles - only the ad at the end.

Also, I ran a check on the server and have a table of results at <removed> if that is any help.

Thanks so much,

Bob

[edited by: jatar_k at 7:08 pm (utc) on July 26, 2005]
[edit reason] sorry no urls thanks [/edit]

jatar_k

7:09 pm on Jul 26, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



so is it possible that the second feed is not working then?

try swapping them make the second one first and first one second and see what happens.

hymer

10:11 pm on Jul 26, 2005 (gmt 0)

10+ Year Member



I have swapped them and both work perfectly. The problem is only when there are two on a page.

Also, the scripts come from RSS Feed Burner and they offer the same thing in javascript. Both javascripts do work on the same page.

So it is only the PHP with two on a page.

Bob

hymer

6:06 pm on Jul 28, 2005 (gmt 0)

10+ Year Member



I have the solution in case anyone is interested. You simply place

<?php unset($arnews);?> prior to each Include. Perfect.

Thanks for all the help,

Bob

[edited by: jatar_k at 6:22 pm (utc) on July 28, 2005]
[edit reason] no urls thanks [/edit]

jatar_k

6:23 pm on Jul 28, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



glad you got it sorted