NexDog
07-19-2010, 09:37 AM
I followed this:
http://www.vbulletin.com/forum/showthread.php?173937-How-to-Include-a-PHP-or-HTML-File
And created a Plugin with:
ob_start();
include('/path/to/forum/wordpress.php');
$includeVP = ob_get_contents();
ob_end_clean();
wordpress.php is a file that calls SimplePie and pulls a feed from our blog and displays titles of the last 5 blog posts in the footer.
This is the code:
<?php
// Make sure SimplePie is included. You may need to change this to match the location of simplepie.inc.
require_once('/home/httpd/vhosts/domain.com/httpdocs/include/simplepie.inc');
require_once('/home/httpd/vhosts/domain.com/httpdocs/include/shorten.inc');
// We'll process this feed with all of the default options.
$feed = new SimplePie();
$feed->set_feed_url(array('http://www.domain.com/forum/external.php?type=rss'));
//$feed->set_feed_url(array('http://www.domain.com/blog/category/status/feed/'));
$feed->init();
$feed->set_item_limit(5);
// This makes sure that the content is sent to the browser as text/html and the UTF-8 character set (since we didn't change it).
$feed->handle_content_type();
// Let's begin our XHTML webpage code. The DOCTYPE is supposed to be the very first thing, so we'll keep it on the same line as the closing-PHP tag.
/*
Here, we'll loop through all of the items in the feed, and $item represents the current item in the loop.
*/
foreach ($feed->get_items() as $item):
?>
<tr>
<td align="left" width="13"><img src="../../../../images/site/thread.gif"></td>
<td align="left" width="100%"><a class="feeds" href="<?php echo $item->get_permalink(); ?>"><?php echo shorten($item->get_title(), 35); ?></a><br /></td>
</tr>
<?php endforeach; ?>
shorten.inc is some extra code that shortens the char limit of the displayed title to 35 characters.
Problem is when I refresh the page it spawns hundreds of httpd process in a loop that raises loads to 150+.
Anyone have any ideas to what I'm doing wrong?
I use teh same code to pull vbulletin titles to our blog footer and rest of the site, and wordpress titles to its own footer and other areas of the site. On VB it just goes ballistic. :)
--------------- Added 1279536057 at 1279536057 ---------------
Actually it was the vbulletin.php containing code that pulled titles from vBulletin that caused teh loop. I activated teh wordpress.php plugin and the server is fine. However it doesn't display anything.
http://www.vbulletin.com/forum/showthread.php?173937-How-to-Include-a-PHP-or-HTML-File
And created a Plugin with:
ob_start();
include('/path/to/forum/wordpress.php');
$includeVP = ob_get_contents();
ob_end_clean();
wordpress.php is a file that calls SimplePie and pulls a feed from our blog and displays titles of the last 5 blog posts in the footer.
This is the code:
<?php
// Make sure SimplePie is included. You may need to change this to match the location of simplepie.inc.
require_once('/home/httpd/vhosts/domain.com/httpdocs/include/simplepie.inc');
require_once('/home/httpd/vhosts/domain.com/httpdocs/include/shorten.inc');
// We'll process this feed with all of the default options.
$feed = new SimplePie();
$feed->set_feed_url(array('http://www.domain.com/forum/external.php?type=rss'));
//$feed->set_feed_url(array('http://www.domain.com/blog/category/status/feed/'));
$feed->init();
$feed->set_item_limit(5);
// This makes sure that the content is sent to the browser as text/html and the UTF-8 character set (since we didn't change it).
$feed->handle_content_type();
// Let's begin our XHTML webpage code. The DOCTYPE is supposed to be the very first thing, so we'll keep it on the same line as the closing-PHP tag.
/*
Here, we'll loop through all of the items in the feed, and $item represents the current item in the loop.
*/
foreach ($feed->get_items() as $item):
?>
<tr>
<td align="left" width="13"><img src="../../../../images/site/thread.gif"></td>
<td align="left" width="100%"><a class="feeds" href="<?php echo $item->get_permalink(); ?>"><?php echo shorten($item->get_title(), 35); ?></a><br /></td>
</tr>
<?php endforeach; ?>
shorten.inc is some extra code that shortens the char limit of the displayed title to 35 characters.
Problem is when I refresh the page it spawns hundreds of httpd process in a loop that raises loads to 150+.
Anyone have any ideas to what I'm doing wrong?
I use teh same code to pull vbulletin titles to our blog footer and rest of the site, and wordpress titles to its own footer and other areas of the site. On VB it just goes ballistic. :)
--------------- Added 1279536057 at 1279536057 ---------------
Actually it was the vbulletin.php containing code that pulled titles from vBulletin that caused teh loop. I activated teh wordpress.php plugin and the server is fine. However it doesn't display anything.