Jump to content

Knowledgebase RSS feed


leemason

Recommended Posts

this is a little script i created to display all knowledgebase articles in an RSS2 feed.

 

Really simple script, just upload the file to the root of your WHMCS install. (knowledgebaserss.php)

 

you could also setup a rewrite rule so the url looks like an rss feed, add this to you .htaccess file after the

 

RewriteEngine On

 

line:

 

RewriteRule ^knowledgebase.rss /knowledgebaserss.php

 

 

below is the code, simply copy it into a file called knowledgebaserss.php, or download the attached zip file, unzip it and upload it.

 

 

<?php
header("Content-Type: application/xml; charset=ISO-8859-1"); 
echo '<?xml version="1.0" encoding="ISO-8859-1"?'.'>'."\n";
echo '<rss version="2.0">'."\n";
echo '<channel>'."\n";
define("CLIENTAREA",true);
//define("FORCESSL",true); # Uncomment to force the page to use https://
require("dbconnect.php");
require("includes/functions.php");
require("includes/clientareafunctions.php");


function k_rss_systemurl(){
$result = mysql_query("SELECT * FROM tblconfiguration WHERE setting='SystemURL'");
while ($data = mysql_fetch_array($result, MYSQL_ASSOC)) {return $data['value'];}
}//function

function k_rss_systemname(){
$result = mysql_query("SELECT * FROM tblconfiguration WHERE setting='CompanyName'");
while ($data = mysql_fetch_array($result, MYSQL_ASSOC)) {return $data['value'];}
}//function

//check for seo friendly urls
$result = mysql_query("SELECT * FROM tblconfiguration WHERE setting='SEOFriendlyUrls'");
while ($data = mysql_fetch_array($result, MYSQL_ASSOC)) {if($data['value'] == 'on'){$seourls = true;}}



echo '<title>'.k_rss_systemname().' Knowledgebase Feed</title>';
echo '<description>'.k_rss_systemname().' Knowledgebase Feed created by WHMCS Knowledgebase RSS addon module.</description>';
echo '<link>'.k_rss_systemurl().'</link>';


$result = mysql_query("SELECT * FROM tblknowledgebase");
while ($data = mysql_fetch_array($result, MYSQL_ASSOC)) {

echo '<item>'."\n";
echo '<title>'.$data['title'].'</title>'."\n";
echo '<description>'.strip_tags(substr($data['article'],0,140)).'</description>'."\n";
echo '<link>'.k_rss_systemurl().'knowledgebase.php?action=displayarticle&id='.$data['id'].'</link>'."\n";


if($seourls){
echo '<link>'.k_rss_systemurl().'knowledgebase/'.$data['id'].'/'.str_replace(' ','-',$data['title']).'.html</link>'."\n";
}else{
echo '<link>'.k_rss_systemurl().'knowledgebase.php?action=displayarticle&id='.$data['id'].'</link>'."\n";
}//if


echo '</item>'."\n";	
}//while


echo '</channel>'."\n";
echo '</rss>'."\n";
?>

knowledgebaserss.php.zip

Link to comment
Share on other sites

  • 4 weeks later...

I have an updated version of this script know which condenses the database calls to on (for speed), cleans up the code a bit as well.

 

see below, or download the new file attached to this post:

 

<?php
header("Content-Type: application/xml; charset=ISO-8859-1"); 
echo '<?xml version="1.0" encoding="ISO-8859-1"?'.'>'."\n";
echo '<rss version="2.0">'."\n";
echo '<channel>'."\n";
define("CLIENTAREA",true);
//define("FORCESSL",true); # Uncomment to force the page to use https://
require("dbconnect.php");
require("includes/functions.php");
require("includes/clientareafunctions.php");


$result = mysql_query("SELECT * FROM tblconfiguration WHERE setting='SystemURL' OR setting='CompanyName' OR setting='SEOFriendlyUrls'");
while ($data = mysql_fetch_array($result, MYSQL_ASSOC)) {$values[$data['setting']] = $data['value'];}


echo '<title>'.$values['CompanyName'].' Knowledgebase Feed</title>';
echo '<description>'.$values['CompanyName'].' Knowledgebase Feed created by WHMCS Knowledgebase RSS addon module.</description>';
echo '<link>'.$values['SystemURL'].'</link>';


$result = mysql_query("SELECT * FROM tblknowledgebase");
while ($data = mysql_fetch_array($result, MYSQL_ASSOC)) {

echo '<item>'."\n";
echo '<title>'.$data['title'].'</title>'."\n";
echo '<description>'.strip_tags(substr($data['article'],0,140)).'</description>'."\n";
echo '<link>'.$values['SystemURL'].'knowledgebase.php?action=displayarticle&id='.$data['id'].'</link>'."\n";


if($seourls){
echo '<link>'.$values['SystemURL'].'knowledgebase/'.$data['id'].'/'.str_replace(' ','-',$data['title']).'.html</link>'."\n";
}else{
echo '<link>'.$values['SystemURL'].'knowledgebase.php?action=displayarticle&id='.$data['id'].'</link>'."\n";
}//if


echo '</item>'."\n";	
}//while


echo '</channel>'."\n";
echo '</rss>'."\n";
?>

knowledgebaserss.php.zip

Link to comment
Share on other sites

  • 3 months later...
Would this work for other parts of WHMCS? Like I want an RSS feed on the network status page so I can pull issues from that page into my forum.

 

Thanks.

 

 

the script as it stands doesnt cater for that, but i could quite easily alter it to replicate the functionality you require.

 

pm me if you would like to discuss it.

Link to comment
Share on other sites

  • 1 month later...

I've updated it to include the option of filtering by category id

Just go to your this file's URL and add the catid from WHMCS:

ie - knowledgebaserss.php?catid=1

<?php 
header("Content-Type: application/xml; charset=ISO-8859-1");  
echo '<?xml version="1.0" encoding="ISO-8859-1"?'.'>'."\n"; 
echo '<rss version="2.0">'."\n"; 
echo '<channel>'."\n"; 
define("CLIENTAREA",true); 
//define("FORCESSL",true); # Uncomment to force the page to use https:// 
require("dbconnect.php"); 
require("includes/functions.php"); 
require("includes/clientareafunctions.php"); 


$result = mysql_query("SELECT * FROM tblconfiguration WHERE setting='SystemURL' OR setting='CompanyName' OR setting='SEOFriendlyUrls'"); 
while ($data = mysql_fetch_array($result, MYSQL_ASSOC)) {$values[$data['setting']] = $data['value'];} 


echo '<title>'.$values['CompanyName'].' Knowledgebase Feed</title>'; 
echo '<description>'.$values['CompanyName'].' Knowledgebase Feed created by WHMCS Knowledgebase RSS addon module.</description>'; 
echo '<link>'.$values['SystemURL'].'</link>'; 


if (isset($_REQUEST['catid'])) {
//Show this category
$query = "SELECT * FROM `tblknowledgebase`,`tblknowledgebaselinks` 
		WHERE `tblknowledgebaselinks`.`articleid` = `tblknowledgebase`.`id`
		AND `tblknowledgebaselinks`.`categoryid`=".(int)$_REQUEST['catid'];;
} else {
//Show all categories
$query = "SELECT * FROM tblknowledgebase";
}
$result = mysql_query($query); 

while ($data = mysql_fetch_array($result, MYSQL_ASSOC)) { 

echo '<item>'."\n"; 
echo '<title>'.$data['title'].'</title>'."\n"; 
echo '<description>'.strip_tags(substr($data['article'],0,140)).'</description>'."\n"; 
echo '<link>'.$values['SystemURL'].'knowledgebase.php?action=displayarticle&id='.$data['id'].'</link>'."\n"; 


if($seourls){ 
   echo '<link>'.$values['SystemURL'].'knowledgebase/'.$data['id'].'/'.str_replace(' ','-',$data['title']).'.html</link>'."\n"; 
}else{ 
   echo '<link>'.$values['SystemURL'].'knowledgebase.php?action=displayarticle&id='.$data['id'].'</link>'."\n"; 
}//if 


echo '</item>'."\n";     
}//while 


echo '</channel>'."\n"; 
echo '</rss>'."\n"; 
?>

Link to comment
Share on other sites

  • 4 months later...
  • 7 months later...

Hello,

 

It might an after war question, but actually i tried to check the validity of the feed and here is what I have

Sorry

 

This feed does not validate.

 

 

line 10, column 0: item contains more than one link (22 occurrences) [help]

<link>domain.com/knowledgebase.php?action=display ...

 

In addition, interoperability with the widest range of feed readers could be improved by implementing the following recommendations.

 

 

line 11, column 0: item should contain a guid element (22 occurrences) [help]

</item>

 

 

line 146, column 0: Missing atom:link with rel="self" [help]

</channel>

 

Here is my genuine feed :

 

 

<item>

<title>My Title</title>

<description>

description of the KB article

</description>

<link>

http://mydomain.com/knowledgebase.php?action=displayarticle&id=14

</link>

<link>

http://mydomain.com/knowledgebase.php?action=displayarticle&id=14

</link>

</item>

 

Also, it seems that the order of the feed isn't in the right order. I mean it should be the newest article first rather than the old one, am i mistaken?

Link to comment
Share on other sites

Hello,

 

It might an after war question, but actually i tried to check the validity of the feed and here is what I have

 

 

Here is my genuine feed :

 

 

 

 

Also, it seems that the order of the feed isn't in the right order. I mean it should be the newest article first rather than the old one, am i mistaken?

 

 

here is an updated version with the link issue fixed, improved sql query functions, and uses the global config array instead of calling the db again for domain info.

 

it also uses a builtin function to set the right url string for titles:

 

<?php  
header("Content-Type: application/xml; charset=ISO-8859-1");   
echo '<?xml version="1.0" encoding="ISO-8859-1"?'.'>'."\n";  
echo '<rss version="2.0">'."\n";  
echo '<channel>'."\n";  
define("CLIENTAREA",true); 
require("dbconnect.php");  
require("includes/functions.php");  
require("includes/clientareafunctions.php");  

global $CONFIG;

echo '<title>'.$CONFIG['CompanyName'].' Knowledgebase Feed</title>';  
echo '<description>'.$CONFIG['CompanyName'].' Knowledgebase Feed created by WHMCS Knowledgebase RSS addon module.</description>';  
echo '<link>'.$CONFIG['SystemURL'].'</link>';  


if (isset($_REQUEST['catid'])) { 
   //Show this category 
   $query = "SELECT * FROM `tblknowledgebase`,`tblknowledgebaselinks`  
           WHERE `tblknowledgebaselinks`.`articleid` = `tblknowledgebase`.`id` 
           AND `tblknowledgebaselinks`.`categoryid`=".(int)$_REQUEST['catid']." ORDER BY `tblknowledgebase`.`id` DESC"; 
} else { 
   //Show all categories 
   $query = "SELECT * FROM tblknowledgebase ORDER BY `id` DESC"; 
} 
$result = full_query($query);  

while ($data = mysql_fetch_assoc($result)) {  

echo '<item>'."\n";  
echo '<title>'.$data['title'].'</title>'."\n";  
echo '<description>'.strip_tags(substr($data['article'],0,140)).'</description>'."\n";   

if($seourls){  
   echo '<link>'.$CONFIG['SystemURL'].'knowledgebase/'.$data['id'].'/'.getmodrewritefriendlystring($data['title']).'.html</link>'."\n";  
}else{  
   echo '<link>'.$CONFIG['SystemURL'].'knowledgebase.php?action=displayarticle&id='.$data['id'].'</link>'."\n";  
}//if  

echo '</item>'."\n";      
}//while  


echo '</channel>'."\n";  
echo '</rss>'."\n";  
?>

Link to comment
Share on other sites

  • 2 weeks later...

Wow,

 

You actually answered the very same day I posted!

 

How amazing it is! I apologize i didn't check the thread earlier to thank you accordingly.

 

Well basically, it is working wonderfully well, here is the Feed Validator Output :

 

Congratulations!

 

This is a valid RSS feed.

 

Recommendations

 

This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.

 

line 8, column 0: item should contain a guid element (24 occurrences) [help]

 

</item>

line 134, column 0: Missing atom:link with rel="self" [help]

 

</channel>

 

For the use, i'll have i believe the errors aren't that critical as I intend to parse the feed here and there and use it for FB uptades.

 

For the users that are going to use this script and happen to have the "Header already sent error", make sure you remove the extra space when copying / pasting at the end and the beginning of the script. (before opening <? and after ?>)

 

 

Dealing the first error, if you really want to be perfect, here is my RSS output :

 

<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0">

<channel>

<title>Company Name Knowledgebase Feed</title><description>Company name Knowledgebase Feed created by WHMCS Knowledgebase RSS addon module.</description><link>http://www.mydomain.Com</link><item>

<title>My RSS TITLE</title>

<description>This is the KB article ever! (written by me ofc)</description>

<link>http://www.mydomain.com/whmcs/knowledgebase.php?action=displayarticle&id=24</link>

</item>

 

The </item> is my 8th line which i believe shouldn't be there.

 

[EDIT] Best Of Luck with your upgrade of WHMCS 5.2.1 ;) was about to take the plunge too, but not now anymore.

Link to comment
Share on other sites

  • 3 months later...
I have an updated version of this script know which condenses the database calls to on (for speed), cleans up the code a bit as well.

 

see below, or download the new file attached to this post:

 

<?php
header("Content-Type: application/xml; charset=ISO-8859-1"); 
echo '<?xml version="1.0" encoding="ISO-8859-1"?'.'>'."\n";
echo '<rss version="2.0">'."\n";
echo '<channel>'."\n";
define("CLIENTAREA",true);
//define("FORCESSL",true); # Uncomment to force the page to use https://
require("dbconnect.php");
require("includes/functions.php");
require("includes/clientareafunctions.php");


$result = mysql_query("SELECT * FROM tblconfiguration WHERE setting='SystemURL' OR setting='CompanyName' OR setting='SEOFriendlyUrls'");
while ($data = mysql_fetch_array($result, MYSQL_ASSOC)) {$values[$data['setting']] = $data['value'];}


echo '<title>'.$values['CompanyName'].' Knowledgebase Feed</title>';
echo '<description>'.$values['CompanyName'].' Knowledgebase Feed created by WHMCS Knowledgebase RSS addon module.</description>';
echo '<link>'.$values['SystemURL'].'</link>';


$result = mysql_query("SELECT * FROM tblknowledgebase");
while ($data = mysql_fetch_array($result, MYSQL_ASSOC)) {

echo '<item>'."\n";
echo '<title>'.$data['title'].'</title>'."\n";
echo '<description>'.strip_tags(substr($data['article'],0,140)).'</description>'."\n";
echo '<link>'.$values['SystemURL'].'knowledgebase.php?action=displayarticle&id='.$data['id'].'</link>'."\n";


if($seourls){
echo '<link>'.$values['SystemURL'].'knowledgebase/'.$data['id'].'/'.str_replace(' ','-',$data['title']).'.html</link>'."\n";
}else{
echo '<link>'.$values['SystemURL'].'knowledgebase.php?action=displayarticle&id='.$data['id'].'</link>'."\n";
}//if


echo '</item>'."\n";	
}//while


echo '</channel>'."\n";
echo '</rss>'."\n";
?>

 

If you have a solution to overcome the Turkish character and tell me how you'd love failure. :D

Link to comment
Share on other sites

  • 1 month later...

I upgraded to the latest php code provided here and I am getting the following error: "error on line 38 at column 78: EntityRef: expecting ';'"

 

Below is the php I am using:

<?php   header("Content-Type: application/xml; charset=ISO-8859-1");    echo '<?xml version="1.0" encoding="ISO-8859-1"?'.'>'."\n";   echo '<rss version="2.0">'."\n";   echo '<channel>'."\n";   define("CLIENTAREA",true);  require("dbconnect.php");   require("includes/functions.php");   require("includes/clientareafunctions.php");   
global $CONFIG; 
echo '<title>'.$CONFIG['CompanyName'].' Knowledgebase Feed</title>';   echo '<description>'.$CONFIG['CompanyName'].' Knowledgebase Feed created by WHMCS Knowledgebase RSS addon module.</description>';   echo '<link>'.$CONFIG['SystemURL'].'</link>';   

if (isset($_REQUEST['catid'])) {      //Show this category      $query = "SELECT * FROM `tblknowledgebase`,`tblknowledgebaselinks`               WHERE `tblknowledgebaselinks`.`articleid` = `tblknowledgebase`.`id`              AND `tblknowledgebaselinks`.`categoryid`=".(int)$_REQUEST['catid']." ORDER BY `tblknowledgebase`.`id` DESC";  } else {      //Show all categories      $query = "SELECT * FROM tblknowledgebase ORDER BY `id` DESC";  }  $result = full_query($query);   
while ($data = mysql_fetch_assoc($result)) {          echo '<item>'."\n";   echo '<title>'.$data['title'].'</title>'."\n";   echo '<description>'.strip_tags(substr($data['article'],0,140)).'</description>'."\n";    
if($seourls){       echo '<link>'.$CONFIG['SystemURL'].'knowledgebase/'.$data['id'].'/'.getmodrewritefriendlystring($data['title']).'.html</link>'."\n";   }else{       echo '<link>'.$CONFIG['SystemURL'].'knowledgebase.php?action=displayarticle&id='.$data['id'].'</link>'."\n";   }//if   
echo '</item>'."\n";       }//while   

echo '</channel>'."\n";   echo '</rss>'."\n";   ?>

Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...
  • 6 months later...
  • 1 month later...

try the following for v6.1.1 :)

 

<?php 
header("Content-Type: application/xml; charset=UTF-8");  
echo '<?xml version="1.0" encoding="UTF-8"?'.'>'."\n"; 
echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">'."\n"; 
echo '<channel>'."\n"; 
define("CLIENTAREA",true); 
//define("FORCESSL",true); # Uncomment to force the page to use https:// 
require("init.php"); 

mysql_set_charset('utf8');

$result = mysql_query("SELECT * FROM tblconfiguration WHERE setting='SystemURL' OR setting='CompanyName' OR setting='SEOFriendlyUrls'"); 
while ($data = mysql_fetch_array($result, MYSQL_ASSOC)) {$values[$data['setting']] = $data['value'];} 

echo '<atom:link href="'.$values['SystemURL'].'knowledgebaserss.php" rel="self" type="application/rss+xml" />';

echo '<title><=!=[=C=D=A=T=A=['.$values['CompanyName'].' Knowledgebase Feed]=]=></title>'; 
echo '<description><=!=[=C=D=A=T=A=['.$values['CompanyName'].' Knowledgebase Feed created by WHMCS Knowledgebase RSS addon module.]=]=></description>'; 
echo '<link><=!=[=C=D=A=T=A=['.$values['SystemURL'].']=]=></link>'; 

if (isset($_REQUEST['catid'])) {
   //Show this category
   $query = "SELECT * FROM `tblknowledgebase`,`tblknowledgebaselinks` 
           WHERE `tblknowledgebaselinks`.`articleid` = `tblknowledgebase`.`id`
           AND `tblknowledgebaselinks`.`categoryid`=".$_REQUEST['catid'];;
} else {
   //Show all categories
   $query = "SELECT * FROM tblknowledgebase";
}
$result = mysql_query($query); 

while ($data = mysql_fetch_array($result, MYSQL_ASSOC)) { 

echo '<item>'."\n"; 
echo '<title><=!=[=C=D=A=T=A=['.$data['title'].']=]=></title>'."\n";
echo '<description><=!=[=C=D=A=T=A=['.$data['article'].']=]=></description>'."\n"; 
echo '<link><=!=[=C=D=A=T=A=['.$values['SystemURL'].'knowledgebase.php?action=displayarticle&id='.$data['id'].']=]=></link>'."\n"; 

if($seourls){ 
   echo '<link><=!=[=C=D=A=T=A=['.$values['SystemURL'].'knowledgebase/'.$data['id'].'/'.str_replace(' ','-',$data['title']).'.html<]=]=>/link>'."\n"; 
}else{ 
   echo '<link><=!=[=C=D=A=T=A=['.$values['SystemURL'].'knowledgebase.php?action=displayarticle&id='.$data['id'].']=]=></link>'."\n"; 
}//if 

echo '</item>'."\n";     
}//while 
?>
</channel>
</rss>

Link to comment
Share on other sites

  • 3 weeks later...
try the following for v6.1.1 :)

 

<?php 
header("Content-Type: application/xml; charset=UTF-8");  
echo '<?xml version="1.0" encoding="UTF-8"?'.'>'."\n"; 
echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">'."\n"; 
echo '<channel>'."\n"; 
define("CLIENTAREA",true); 
//define("FORCESSL",true); # Uncomment to force the page to use https:// 
require("init.php"); 

mysql_set_charset('utf8');

$result = mysql_query("SELECT * FROM tblconfiguration WHERE setting='SystemURL' OR setting='CompanyName' OR setting='SEOFriendlyUrls'"); 
while ($data = mysql_fetch_array($result, MYSQL_ASSOC)) {$values[$data['setting']] = $data['value'];} 

echo '<atom:link href="'.$values['SystemURL'].'knowledgebaserss.php" rel="self" type="application/rss+xml" />';

echo '<title><=!=[=C=D=A=T=A=['.$values['CompanyName'].' Knowledgebase Feed]=]=></title>'; 
echo '<description><=!=[=C=D=A=T=A=['.$values['CompanyName'].' Knowledgebase Feed created by WHMCS Knowledgebase RSS addon module.]=]=></description>'; 
echo '<link><=!=[=C=D=A=T=A=['.$values['SystemURL'].']=]=></link>'; 

if (isset($_REQUEST['catid'])) {
   //Show this category
   $query = "SELECT * FROM `tblknowledgebase`,`tblknowledgebaselinks` 
           WHERE `tblknowledgebaselinks`.`articleid` = `tblknowledgebase`.`id`
           AND `tblknowledgebaselinks`.`categoryid`=".$_REQUEST['catid'];;
} else {
   //Show all categories
   $query = "SELECT * FROM tblknowledgebase";
}
$result = mysql_query($query); 

while ($data = mysql_fetch_array($result, MYSQL_ASSOC)) { 

echo '<item>'."\n"; 
echo '<title><=!=[=C=D=A=T=A=['.$data['title'].']=]=></title>'."\n";
echo '<description><=!=[=C=D=A=T=A=['.$data['article'].']=]=></description>'."\n"; 
echo '<link><=!=[=C=D=A=T=A=['.$values['SystemURL'].'knowledgebase.php?action=displayarticle&id='.$data['id'].']=]=></link>'."\n"; 

if($seourls){ 
   echo '<link><=!=[=C=D=A=T=A=['.$values['SystemURL'].'knowledgebase/'.$data['id'].'/'.str_replace(' ','-',$data['title']).'.html<]=]=>/link>'."\n"; 
}else{ 
   echo '<link><=!=[=C=D=A=T=A=['.$values['SystemURL'].'knowledgebase.php?action=displayarticle&id='.$data['id'].']=]=></link>'."\n"; 
}//if 

echo '</item>'."\n";     
}//while 
?>
</channel>
</rss>

 

hello

not working for me , please check it . thanks

Link to comment
Share on other sites

  • 4 years later...

Here's an updated version with mysqli functions and & replaced with &amp; for sitemap validation :

<?php
header("Content-Type: application/xml; charset=ISO-8859-1");
echo '<?xml version="1.0" encoding="ISO-8859-1"?'.'>'."\n";
echo '<rss version="2.0">'."\n";
echo '<channel>'."\n";
define("CLIENTAREA",true);
define("FORCESSL",true); # Uncomment to force the page to use https://
#require("dbconnect.php");
require("includes/functions.php");
require("includes/clientareafunctions.php");

$con = mysqli_connect("xxx","xxx","xxx","xxx");


$result = mysqli_query($con, "SELECT * FROM tblconfiguration WHERE setting='SystemURL' OR setting='CompanyName' OR setting='SEOFriendlyUrls'");
while ($data = mysqli_fetch_array($result, MYSQLI_ASSOC)) {$values[$data['setting']] = $data['value'];}


echo '<title>'.$values['CompanyName'].' Knowledgebase Feed</title>';
echo '<description>'.$values['CompanyName'].' Knowledgebase Feed created by WHMCS Knowledgebase RSS addon module.</description>';
echo '<link>'.$values['SystemURL'].'</link>';


if (isset($_REQUEST['catid'])) {
//Show this category
	$query = "SELECT * FROM `tblknowledgebase`,`tblknowledgebaselinks`
		WHERE `tblknowledgebaselinks`.`articleid` = `tblknowledgebase`.`id`
		AND `tblknowledgebaselinks`.`categoryid`=".(int)$_REQUEST['catid'];;
} else {
//Show all categories
	$query = "SELECT * FROM tblknowledgebase";
}
$result = mysqli_query($con, $query);

while ($data = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
	
	echo '<item>'."\n";
	echo '<title>'.$data['title'].'</title>'."\n";
	echo '<description>'.strip_tags(substr($data['article'],0,140)).'</description>'."\n";
	echo '<link>'.$values['SystemURL'].'knowledgebase.php?action=displayarticle&amp;id='.$data['id'].'</link>'."\n";
	
	$seourls = 0;
	if($seourls){
		echo '<link>'.$values['SystemURL'].'knowledgebase/'.$data['id'].'/'.str_replace(' ','-',$data['title']).'.html</link>'."\n";
	}else{
		echo '<link>'.$values['SystemURL'].'knowledgebase.php?action=displayarticle&amp;id='.$data['id'].'</link>'."\n";
	}//if
	
	
	echo '</item>'."\n";
}//while


echo '</channel>'."\n";
echo '</rss>'."\n";

mysqli_close($con);
?>

 

Edited by tuga
Link to comment
Share on other sites

On 12/3/2015 at 8:23 AM, impossible said:

 

hello

not working for me , please check it . thanks

For Brian's version to work, you've to change =!=[=C=D=A=T=A= to ![CDATA and ]=]=> to ]]>

WRONG:

echo '<title><=!=[=C=D=A=T=A=['.$data['title'].']=]=></title>'."\n";

CORRECT:

echo '<title><![CDATA['.$data['title'].']]></title>'."\n";

 

Edited by tuga
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated