CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 Vision.To RSS Feed Generator [PHP]

Print topic Send  topic

Author Message
feha


Posts: 712
Posted: 07/18/2006, 2:49 AM

Here is the complete function
<?  
/*  
<!--  
****************************************************  
*         Website: http://www.vision.to            *  
*         Copyright © by WWW.VISION.TO             *  
*              All Rights Reserved                 *  
*               Author:Femi Hasani                 *  
*            Contact: info @ vision.to               *  
*  This application is protected by international  *  
*                copyright laws.                   *  
****************************************************  
10 LATEST UPDATES  
-->  
*/  
if(!defined("LANG_CODE"))  
{  
define("LANG_CODE","en-us");  
}  
  
if(!defined("XML_ENCODING"))  
{  
define("XML_ENCODING","UTF-8");  
}  
  
if(!defined("XML_LOGO"))  
{  
define("XML_LOGO","http://".$_SERVER['SERVER_NAME']."".dirname(str_replace("\\\\", "/", $_SERVER['SCRIPT_NAME']))."/rsslogo.png");  
}  
  
function create_rss_xml($number_of_pages='10')  
{  
$RSS_XML ="";  
$RSS_XML .="<?xml version=\"1.0\" encoding=\"".XML_ENCODING."\"?>\n";  
$RSS_XML .="<rss version=\"2.0\">\n";  
$RSS_XML .="<channel>\n";  
$RSS_XML .="<title>".htmlspecialchars(COMPANYNAME)."- Homepage RSS Feed</title>\n";  
$RSS_XML .="<link>".URL_PATH."</link>\n";  
$RSS_XML .="<description>".htmlspecialchars(COMPANYNAME)."- Homepage, ".$number_of_pages." Latest Homepage Updates RSS 2.0 Feed</description>\n";  
$RSS_XML .="<generator>www.vision.to v 1.0 Vision.To CMS Enterprise</generator>\n";  
$RSS_XML .="<language>".LANG_CODE."</language>\n";  
$RSS_XML .="<copyright>Copyright ".COMPANY_START_YEAR." - ".date("Y")." by ".htmlspecialchars(COMPANYNAME)."</copyright>\n";  
$RSS_XML .="<webMaster>".htmlspecialchars(CONTACT_E_MAIL)."</webMaster>\n";  
$RSS_XML .="<lastBuildDate>".date("r",CUSTOM_TIME)."</lastBuildDate>\n";  
$RSS_XML .="<image>\n";  
$RSS_XML .="<title>".htmlspecialchars(COMPANYNAME)."</title>\n";  
$RSS_XML .="<url>".XML_LOGO."</url>\n";  
$RSS_XML .="<link>".URL_PATH."</link>\n";  
$RSS_XML .="<description>".htmlspecialchars(COMPANYNAME)."- Homepage, ".$number_of_pages." Latest Homepage Updates RSS 2.0 Feed</description>\n";  
$RSS_XML .="</image>\n";  
// for use in CodeCharge Studio  
$DBddd_rss = new clsDBcms();  
$SQL = "SELECT * FROM ddd_homepage WHERE page_show =1 AND show_on_menu=1 AND group_id=0 ORDER BY page_modified DESC LIMIT ".$number_of_pages;  
$DBddd_rss->query($SQL);  
while ($DBddd_rss->next_record()) {  
$RSS_XML .= "<item>\n";  
$RSS_XML .= "<title>\n";  
$RSS_XML .= htmlspecialchars($DBddd_rss->f("page_title"));  
$RSS_XML .= "</title>\n";  
$RSS_XML .= "<description>\n";  
$RSS_XML .= "<![CDATA[ \n";  
//$RSS_XML .= htmlspecialchars($DBddd_rss->f("short_desc"));  
$RSS_XML .= $DBddd_rss->f("short_desc");  
$RSS_XML .= "\n]]>\n";  
$RSS_XML .= "</description>\n";  
$RSS_XML .= "<link>http://".$_SERVER['SERVER_NAME']."".dirname(str_replace("\\\\", "/", $_SERVER['SCRIPT_NAME']))."/index.php?page_id=".$DBddd_rss->f("page_id")."</link>\n";  
$RSS_XML .= "<pubDate>".date("r",$DBddd_rss->f("page_modified"))."</pubDate>\n";  
$RSS_XML .= "</item>\n\n";  
}  
  
$DBddd_rss->close();  
  
$RSS_XML .="</channel>\n";  
$RSS_XML .="</rss>\n";  
  
//echo $RSS_XML;  
$report="";  
$filename ="rss.xml";  
if (!file_exists($filename)) {  
touch($filename); // Create blank file rss.xml  
}  
  
if (is_writable($filename)) {  
if (!$handle = fopen($filename, 'w+')) {  
$report="Cannot open file ($filename)";  
}  
if (!fwrite($handle, $RSS_XML)) {  
$report="Cannot write to file ($filename)";  
}  
$report="Success, ($filename) has been created, updated ";  
fclose($handle);  
} else {  
$report="The file $filename is not writable";  
}  
  
  
  
return  $report;  
}  
?>

_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.