How to add 5 lastest question to other html page?
Moderator: Thorsten
How to add 5 lastest question to other html page?
Hi, I want to add the "The five questions posted most recently" to my home page (a html page) so visitors can see the news when I add new question in faq.
Please assist.
Please assist.
Hi,
you can use the RSS feed for that. Just add a PHP based RSS reader into that page and include the feed.
bye
Thorsten
you can use the RSS feed for that. Just add a PHP based RSS reader into that page and include the feed.
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist
Hi,
you can use the PEAR package PEAR::XML_RSS for that:
More Information about PEAR::XML_RSS: http://pear.php.net/manual/en/package.xml.xml-rss.php
bye
Thorsten
you can use the PEAR package PEAR::XML_RSS for that:
Code: Select all
<?php
require_once "XML/RSS.php";
$rss =& new XML_RSS("http://www.example.org/faq/feed/latest/rss.php");
$rss->parse();
echo "<ul>\n";
foreach ($rss->getItems() as $item) {
echo "<li><a href=\"" . $item['link'] . "\">" . $item['title'] . "</a></li>\n";
}
echo "</ul>\n";
?>
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist
I have been looking for a way to have these on a separate page also.
I used the code to make a php page, changing the path to rss.php to match my site. I gave the file the name newfiles.php and tried to run it under faq/newfiles.php on the server. Nothing but a blank page.
Was I even close to doing the right thing? Would the newfiles.php be OK under the faq/ or should it be in another folder?
I used the code to make a php page, changing the path to rss.php to match my site. I gave the file the name newfiles.php and tried to run it under faq/newfiles.php on the server. Nothing but a blank page.
Was I even close to doing the right thing? Would the newfiles.php be OK under the faq/ or should it be in another folder?
Finde peardavid_de wrote:I have been looking for a way to have these on a separate page also.
I used the code to make a php page, changing the path to rss.php to match my site. I gave the file the name newfiles.php and tried to run it under faq/newfiles.php on the server. Nothing but a blank page.
Was I even close to doing the right thing? Would the newfiles.php be OK under the faq/ or should it be in another folder?
Mein PHP ist unter /opt/csw/...
Help zu pear
# /opt/csw/php5/bin/pear
Installierte Module
/opt/csw/php5/bin/pear list
Update Module
/opt/csw/php5/bin/pear list-upgrades
/opt/csw/php5/bin/pear upgrade-all
Install für RSS
/opt/csw/php5/bin/pear install XML_Tree
/opt/csw/php5/bin/pear install XML_Parser
/opt/csw/php5/bin/pear install XML_RSS
Beispiel der installierten Module
# /opt/csw/php5/bin/pear list
Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.3.1 stable
Console_Getopt 1.2 stable
HTML_Template_IT 1.1.3 stable
Net_UserAgent_Detect 2.1.0 stable
PEAR 1.4.5 stable
XML_Parser 1.2.7 stable
XML_RPC 1.4.4 stable
XML_RSS 0.9.2 stable
XML_Tree 1.1 stable
Beispiel Link
http://www.magichand.ch/faq_last_rss_reed.php
Now code from Torsten work!
by
Merlin
Hi David,
put a
in the first line of the code right after the <?php.
bye
Thorsten
put a
Code: Select all
error_reporting(E_ALL)
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist
I would like to thank Merlin for the help. My German is so bad I can only figure out things close to English
It was helpful and I gained some information from it.
Thorsten thank you for the added code.
Currently I have the file latest.php with the code below in /faq/latest.php I have nothing returned only a blank page when I run it. The server (Apache) is running PHP Version 4.4.1 the only reference to PEAR in the phpinfo was .:/usr/local/share/pear
If I run http://mydomain.org/faq/feed/latest/rss.php I get what apears to be the correct information in xml and a message "
"This XML file does not appear to have any style information associated with it. The document tree is shown below."
This is my current latest.php file
Is there something basic I am missing or am I in way over my head on this? I can usually figure things out but this has me stuck.
Thanks

Thorsten thank you for the added code.
Currently I have the file latest.php with the code below in /faq/latest.php I have nothing returned only a blank page when I run it. The server (Apache) is running PHP Version 4.4.1 the only reference to PEAR in the phpinfo was .:/usr/local/share/pear
If I run http://mydomain.org/faq/feed/latest/rss.php I get what apears to be the correct information in xml and a message "
"This XML file does not appear to have any style information associated with it. The document tree is shown below."
This is my current latest.php file
Code: Select all
<?php error_reporting(E_ALL)require_once "XML/RSS.php"; $rss =& new XML_RSS("http://www.mydomain.org/faq/feed/latest/rss.php"); $rss->parse(); echo "<ul>\n"; foreach ($rss->getItems() as $item) { echo "<li><a href=\"" . $item['link'] . "\">" . $item['title'] . "</a></li>\n"; } echo "</ul>\n"; ?>
Thanks
Hi,
you have to install the PEAR packages XML_Parser and XML_RSS in your web root. Then my script should work.
bye
Thorsten
you have to install the PEAR packages XML_Parser and XML_RSS in your web root. Then my script should work.
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist
Thanks for the reply Thorsten,
I checked and according to the server, these are installed globaly for the server:
pear-Archive_Tar-1.3.1 PEAR tar file management class
pear-Console_Getopt-1.2 PEAR command-line option parser
pear-HTTP_Request-1.2.4 PEAR classes providing an easy way to perform HTTP requests
pear-Log-1.8.7 PEAR logging utilities
pear-Net_Socket-1.0.6 PEAR Network Socket Interface
pear-Net_URL-1.0.14 Easy parsing of URLs
pear-PEAR-1.3.5_1 PEAR Base System
pear-XML_Parser-1.2.6 PEAR XML parsing class based on PHP's bundled expat
pear-XML_RPC-1.4.3 PHP implementation of the XML-RPC protocol pear-XML_Serializer-0.16.0 PEAR Swiss-army knive for reading and writing XML files pear-XML_Util-1.1.0 PEAR XML utility class
php4-pear-4.4.1 PEAR framework for PHP
Every time I think I am starting to understand some of this I get thrown a curve.
I checked and according to the server, these are installed globaly for the server:
pear-Archive_Tar-1.3.1 PEAR tar file management class
pear-Console_Getopt-1.2 PEAR command-line option parser
pear-HTTP_Request-1.2.4 PEAR classes providing an easy way to perform HTTP requests
pear-Log-1.8.7 PEAR logging utilities
pear-Net_Socket-1.0.6 PEAR Network Socket Interface
pear-Net_URL-1.0.14 Easy parsing of URLs
pear-PEAR-1.3.5_1 PEAR Base System
pear-XML_Parser-1.2.6 PEAR XML parsing class based on PHP's bundled expat
pear-XML_RPC-1.4.3 PHP implementation of the XML-RPC protocol pear-XML_Serializer-0.16.0 PEAR Swiss-army knive for reading and writing XML files pear-XML_Util-1.1.0 PEAR XML utility class
php4-pear-4.4.1 PEAR framework for PHP
Every time I think I am starting to understand some of this I get thrown a curve.

Hi,
is it possible to install XML_RSS as well? XML_Parser is already installed!
bye
Thorsten
is it possible to install XML_RSS as well? XML_Parser is already installed!

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist