Hi there guys,
I am trying to create an RSS feed and for the life of me I can't get it to create working hyperlinks. Any help would be so massively appreciated.
<?php
session_start();
$connection = mysql_connect("******", "******", "*****") or die (mysql_error());
$db = mysql_select_db("****", $connection) or die (mysql_error());
$q18 = "select * from settings where settingid = '1'";
$r18 = mysql_query($q18) or die(mysql_error(Error5));
$a18 = mysql_fetch_array($r18);
require_once 'rss_class.inc.php';
function stripchars($str)
{
$body = htmlentities("$str");
$body = ereg_replace(128, "€", $body); // Euro symbol
$body = ereg_replace(133, "…", $body); // ellipses
$body = ereg_replace(8226, "″", $body); // double prime
$body = ereg_replace(8216, "'", $body); // left single quote
$body = ereg_replace(145, "'", $body); // left single quote
$body = ereg_replace(8217, "'", $body); // right single quote
$body = ereg_replace(146, "'", $body); // right single quote
$body = ereg_replace(8220, """, $body); // left double quote
$body = ereg_replace(147, """, $body); // left double quote
$body = ereg_replace(8221, """, $body); // right double quote
$body = ereg_replace(148, """, $body); // right double quote
$body = ereg_replace(8226, "•", $body); // bullet
$body = ereg_replace(149, "•", $body); // bullet
$body = ereg_replace(8211, "–", $body); // en dash
$body = ereg_replace(150, "–", $body); // en dash
$body = ereg_replace(8212, "—", $body); // em dash
$body = ereg_replace(151, "—", $body); // em dash
$body = ereg_replace(8482, "™", $body); // trademark
$body = ereg_replace(153, "™", $body); // trademark
$body = ereg_replace(169, "©", $body); // copyright mark
$body = ereg_replace(174, "®", $body); // registration mark
$final = htmlentities("$body");
return $final;
}
$rss_channel = new rssGenerator_channel();
$rss_channel->title = 'Latest Jobs from *******';
$rss_channel->link = 'http://www.******.co.uk/';
$rss_channel->description = 'The latest jobs from ********.co.uk';
$rss_channel->language = 'en-uk';
$selQry = "SELECT * FROM jobs where status = '0' order by jobid desc limit 15";
$a = mysql_query($selQry);
while($b = mysql_fetch_array($a))
{
$itemTitle = strip_tags($b[position]);
$itemTitle = str_replace('"','',$itemTitle);
$itemTitle = str_replace("'",'',$itemTitle);
$itemTitle = str_replace("&",' and ',$itemTitle);
$itemTitle = str_replace('/ /', ' ',$itemTitle);
$itemTitle = str_replace("/'/", "'",$itemTitle);
$itemTitle = str_replace('151', "—",$itemTitle);
$itemDesc = strip_tags($b[description]);
$itemDesc = substr($itemDesc,0,150);
$itemDesc = stripchars($itemDesc) ;
$itemDesc = str_replace("&",' and ',$itemDesc);
$itemDesc = str_replace('/ /', ' ',$itemDesc);
$itemDesc = str_replace("/'/", "'",$itemDesc);
$itemDesc = str_replace('151', "—",$itemDesc);
if(strlen($itemDesc)>150){$dots='...';}
$descTemp = $itemDesc . $dots;
$itemDesc = $descTemp ;
$itemLink = $fullurl.'/info.php?jobid='.$b[jobid].'';
$EXmonth3 = substr("$b[postdate]",0,2);
$EXday3 = substr("$b[postdate]",3,2);
$EXyear3 = substr("$b[postdate]",6,4);
$itemDate = "$EXday3/$EXmonth3/$EXyear3";
$item = new rssGenerator_item();
$item->title = $itemTitle;
$item->description = $itemDesc;
$item->link = $itemLink;
$item->pubDate = $itemDate;
$rss_channel->items[] = $item;
}
$rss_feed = new rssGenerator_rss();
$rss_feed->encoding = 'UTF-8';
$rss_feed->version = '2.0';
header('Content-Type: text/xml');
echo $rss_feed->createFeed($rss_channel);
?>