[SPT/CWIS] Datamodel, MySQL query and Custom RSS feed
Jhonatan Tirado
jhonatantiradotiradodeep at gmail.com
Tue Jul 1 16:02:26 CDT 2008
Hi,
I have the following code to generate a RSS feed dinamically, so I can
use it on Drupal CMS.
For example, this link
*http://peru.campusvirtualsp.org/repositorio/rsstest.php* would generate
a RSS feed so I can use on Drupal.
You can see the query I'm using (*"SELECT ResourceId, Title, Url FROM
Resources"*).
However I want to filter results by type (which is a ControlledName).
How my query sholud be?
Maybe something like: *SELECT ResourceId, Title, Url FROM Resources
where type='Course'
*The problem is I still don't understand the database model and its
relationships.
I was looking in order to find the table where Resources and
ControlledNames or MetadataFields get related but nothing.
Any help would be really apreciated.
Jhonatan
*PHP CODE: File rsstest.php*
<?
$rss_titulo = 'CVSP Peru RSS';
$rss_url =
'http://peru.campusvirtualsp.org/repositorio/SPT--FullRecord.php';
$rss_descripcion = 'Noticias de Campus Virtual de Salud Publica';
$rss_email = 'admin at email.com';
$db_server = 'server';
$db_user = 'user';
$db_pass = 'password';
$conexion = mysql_connect($db_server,$db_user,$db_pass);
mysql_select_db("database", $conexion);
*$sql = "SELECT ResourceId, Title, Url FROM Resources";*
$result = mysql_query($sql, $conexion);
$item = mysql_fetch_assoc($result);
header('Content-type: text/xml; charset="iso-8859-1"', true);
echo '<?xml version="1.0" encoding="iso-8859-1"?>';
echo '<rss
version="0.92"><channel><docs>http://peru.campusvirtualsp.org/</docs>
<title>'.$rss_titulo.'</title><link>'.$rss_url.'</link><description>'.$rss_descripcion.'</description><language>es</language><managingEditor>'.$rss_email.'</managingEditor><webMaster>'.$rss_email.'</webMaster>';
do {
echo "<item>";
echo "<title>".$item['Title']."</title>";
echo
"<link>".$rss_url."?ResourceId=".$item['ResourceId']."</link>";
echo "<description>".$item['Title']."</description>";
echo "</item>";
} while ($item = mysql_fetch_assoc($result));
echo "</channel>";
echo "</rss>";
?>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.scout.wisc.edu/pipermail/spt-cwis-users/attachments/20080701/e57928c9/attachment.html
More information about the SPT-CWIS-Users
mailing list