RSS-FEED for knowledgebase
Posted: Tue Jan 26, 2010 12:33 pm
It would be nice, to have a RSS-Funktion for the Knowledgebase!
Is that possible in future version?
Greetz
Frank
Is that possible in future version?
Greetz
Frank
I am working on an RSS feed for tickets. But why would you want a feed for the KB?fk59 wrote:It would be nice, to have a RSS-Funktion for the Knowledgebase!
I whipped the following very rough stuff.fk59 wrote:It would be nice, to have a RSS-Funktion for the Knowledgebase!
Code: Select all
<a type="application/rss+xml" href="rss.php"><img src="img/rss.png" alt="RSS feed for this site"></a>
Code: Select all
<?php
header("Content-Type: application/xml; charset=ISO-8859-1");
/*******************************************************************************
* Title: Help Desk Software HESK
* Version: 2.1 from 7th August 2009
* Author: Klemen Stirn
* Website: http://www.hesk.com
********************************************************************************
* COPYRIGHT AND TRADEMARK NOTICE
* Copyright 2005-2009 Klemen Stirn. All Rights Reserved.
* HESK is a trademark of Klemen Stirn.
* The HESK may be used and modified free of charge by anyone
* AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
* By using this code you agree to indemnify Klemen Stirn from any
* liability that might arise from it's use.
* Selling the code for this program, in part or full, without prior
* written consent is expressly forbidden.
* Using this code, in part or full, to create derivate work,
* new scripts or products is expressly forbidden. Obtain permission
* before redistributing this software over the Internet or in
* any other medium. In all cases copyright and header must remain intact.
* This Copyright is in full effect in any country that has International
* Trade Agreements with the United States of America or
* with the European Union.
* Removing any of the copyright notices without purchasing a license
* is expressly forbidden. To remove HESK copyright notice you must purchase
* a license for this script. For more information on how to obtain
* a license please visit the page below:
* https://www.hesk.com/buy.php
*******************************************************************************/
define('IN_SCRIPT',1);
define('HESK_PATH','');
/* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php');
$hesk_settings['debug_mode']=0;
error_reporting('E_ALL');
require(HESK_PATH . 'inc/common.inc.php');
require(HESK_PATH . 'inc/database.inc.php');
/* Is Knowledgebase enabled? */
if (!$hesk_settings['kb_enable'])
{
hesk_error($hesklang['kbdis']);
}
$now = date("D, d M Y H:i:s T");
$output = "<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>" . $hesk_settings['site_title'] . "</title>
<link>" . $hesk_settings['site_url'] . "rss.php" . "</link>
<description>" . $hesk_settings['hesk_title'] . "</description>
<language>en-us</language>
<pubDate>$now</pubDate>
<lastBuildDate>$now</lastBuildDate>
<docs>http://someurl.com</docs>
<managingEditor>" . $hesk_settings['webmaster_mail'] . "</managingEditor>
<webMaster>you@youremail.com</webMaster> ";
print $output;
/* Connect to database */
hesk_dbConnect();
/* Any category ID set? */
$catid = isset($_GET['category']) ? intval($_GET['category']) : 2;
$artid = isset($_GET['article']) ? intval($_GET['article']) : 0;
$hesk_settings['kb_link'] = ($artid || $catid != 1 || $query) ? '<a href="knowledgebase.php" class="smaller">'.$hesklang['kb_text'].'</a>' : $hesklang['kb_text'];
/*** START FUNCTIONS ***/
function hesk_show_kb_article($catid) {
global $hesk_settings, $hesklang;
$sql = 'SELECT `id`,`subject`, content FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'kb_articles` WHERE `type`=\'0\' ORDER BY `views` DESC, `art_order` ASC LIMIT '.hesk_dbEscape($hesk_settings['kb_numshow']+1);
//print $sql;
$result = hesk_dbQuery($sql);
$items = '';
while ($article = hesk_dbFetchAssoc($result))
{
$items .= '<item>
<title>'. $article['subject'] .'</title>
<link>'. $row["link"] .'</link>
<description><![CDATA['. $row["content"] .']]></description>
</item>';
} // while
$items .= '</channel>
</rss>';
print $items;
} // END hesk_show_kb_article()
//hesk_show_kb_article(3);
hesk_show_kb_article(2);
?>
Code: Select all
<?php
Code: Select all
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\html\helpdesk\rss.php:1) in <b>C:\xampp\htdocs\html\helpdesk\rss.php</b> on line <b>2</b><br />
Code: Select all
<?php
Header("Content-Type: application/xml; charset=ISO-8859-1");
/*******************************************************************************
* Title: Help Desk Software HESK
* Version: 2.1 from 7th August 2009
* Author: Klemen Stirn
* Website: http://www.hesk.com
********************************************************************************
* COPYRIGHT AND TRADEMARK NOTICE
* Copyright 2005-2009 Klemen Stirn. All Rights Reserved.
* HESK is a trademark of Klemen Stirn.
* The HESK may be used and modified free of charge by anyone
* AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
* By using this code you agree to indemnify Klemen Stirn from any
* liability that might arise from it's use.
* Selling the code for this program, in part or full, without prior
* written consent is expressly forbidden.
* Using this code, in part or full, to create derivate work,
* new scripts or products is expressly forbidden. Obtain permission
* before redistributing this software over the Internet or in
* any other medium. In all cases copyright and header must remain intact.
* This Copyright is in full effect in any country that has International
* Trade Agreements with the United States of America or
* with the European Union.
* Removing any of the copyright notices without purchasing a license
* is expressly forbidden. To remove HESK copyright notice you must purchase
* a license for this script. For more information on how to obtain
* a license please visit the page below:
* https://www.hesk.com/buy.php
*******************************************************************************/
define('IN_SCRIPT',1);
define('HESK_PATH','');
/* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php');
$hesk_settings['debug_mode']=0;
error_reporting('E_ALL');
require(HESK_PATH . 'inc/common.inc.php');
require(HESK_PATH . 'inc/database.inc.php');
/* Is Knowledgebase enabled? */
if (!$hesk_settings['kb_enable'])
{
hesk_error($hesklang['kbdis']);
}
$now = date("D, d M Y H:i:s T");
$output = "<?xml version=\"1.0\"?>
<rss version=\"2.0\">
<channel>
<title>" . $hesk_settings['site_title'] . "</title>
<link>" . $hesk_settings['http://192.168.70.10/html/helpdesk'] . "rss.php" . "</link>
<description>" . $hesk_settings['hesk_title'] . "</description>
<language>de-de</language>
<pubDate>$now</pubDate>
<lastBuildDate>$now</lastBuildDate>
<docs>http://192.168.70.10/html/helpdesk</docs>
<managingEditor>" . $hesk_settings['webmaster_mail'] . "</managingEditor>
<webMaster>webmaster@wp-rd.de</webMaster> ";
print $output;
/* Connect to database */
hesk_dbConnect();
/* Any category ID set? */
$catid = isset($_GET['category']) ? intval($_GET['category']) : 10;
$artid = isset($_GET['article']) ? intval($_GET['article']) : 0;
$hesk_settings['kb_link'] = ($artid || $catid != 1 || $query) ? '<a href="knowledgebase.php" class="smaller">'.$hesklang['kb_text'].'</a>' : $hesklang['kb_text'];
/*** START FUNCTIONS ***/
function hesk_show_kb_article($catid) {
global $hesk_settings, $hesklang;
$sql = 'SELECT `id`,`subject`, content FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'kb_articles` WHERE `type`=\'0\' ORDER BY `views` DESC, `art_order` ASC LIMIT '.hesk_dbEscape($hesk_settings['kb_numshow']+1);
//print $sql;
$result = hesk_dbQuery($sql);
$items = '';
while ($article = hesk_dbFetchAssoc($result))
{
$items .= '<item>
<title>'. $article['subject'] .'</title>
<link>'. $row["link"] .'</link>
<description><![CDATA['. $row["content"] .']]></description>
</item>';
} // while
$items .= '</channel>
</rss>';
print $items;
} // END hesk_show_kb_article()
//hesk_show_kb_article(3);
hesk_show_kb_article(2);
?>
IE sucks, I won't even go there.fk59 wrote: IE says " Feed got errors" and FF shows only 2 articles in the feed.
Code: Select all
$sql = 'SELECT `id`,`subject`, content FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'kb_articles` WHERE `type`=\'0\' ORDER BY `views` DESC, `art_order` ASC LIMIT '.hesk_dbEscape($hesk_settings['kb_numshow']+1);
Code: Select all
$sql = 'SELECT `id`,`subject`, content FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'kb_articles` WHERE id ORDER BY `views` DESC, `art_order` ASC LIMIT '.hesk_dbEscape($hesk_settings['kb_numshow']+1);