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

Kucera, Rich Kucerar at hhmi.org
Tue Jul 1 16:06:48 CDT 2008


Hello,

 

Do an internal search engine query instead of SQL.  Piece it together with
the info you see placed in the URL when you do Advanced Search.

 

-Rich

 

________________________________

From: spt-cwis-users-bounces at scout.wisc.edu
[mailto:spt-cwis-users-bounces at scout.wisc.edu] On Behalf Of Jhonatan Tirado
Sent: Tuesday, July 01, 2008 5:02 PM
To: SPT / CWIS Users Discussion List
Subject: [SPT/CWIS] Datamodel, MySQL query and Custom RSS feed

 

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_de
scripcion.'</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://scout.wisc.edu/pipermail/spt-cwis-users/attachments/20080701/502e8e48/attachment-0002.html 


More information about the SPT-CWIS-Users mailing list