[SPT/CWIS] Datamodel, MySQL query and Custom RSS feed

Jhonatan Tirado jhonatantiradotiradodeep at gmail.com
Tue Jul 1 16:02:26 CDT 2008


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 
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 
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.


*PHP CODE: File rsstest.php*
$rss_titulo = 'CVSP Peru RSS';
$rss_url = 
$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 
      do {
           echo "<item>";
           echo "<title>".$item['Title']."</title>";
           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://scout.wisc.edu/pipermail/spt-cwis-users/attachments/20080701/e57928c9/attachment-0002.html 

More information about the SPT-CWIS-Users mailing list