[pmwiki-users] RSS Modifications

Crisses crisses at ofobscurity.com
Mon Mar 28 19:32:03 CST 2005


I need help.

I am trying to create the RSS mod in the config.php file to make the 
changes to the RSS feed necessary to attach the mp3 to the xml


The problem is that if I point to the HomePage, it looks for 
HomePage.mp3 -- not the name of the subpage in question.  I am pouring 
over the rss.php document but it is not well commented -- figuring out 
what variable will have the subpage's name so I can use it as the 
variable to find the mp3 file is difficult.  Here's what I have as the 
mod I would like to put up for people to use but it needs help:

// To use this, you must name the wikipage in question and the mp3 file 
the same
// Such as Main/PodCast001 and PodCast001.mp3
// Can be modified for audio files other than mp3

// These are defined by the admin in the config file

// URL path to where the mp3 files are on your webserver (must be on 
local server, accessible by public URL)
$PodURLPath = "http://url.path.to/podfolder";

// The absolute file path on the server for the mp3s (can use
// PmWiki path variables like $FarmD in the definition).
$PodRoot = "/filesystem/path/to/podfolder";

// Alteration can be modified to support multiple podcast feeds.  For 
now
// define one group that is authorized for podcasting
// The group should probably be edit-passworded
$PodGroup = "OnlyPodGroup";

// PodFile is the name of the mp3 file
$PodFile = "$pagename.mp3";

// Goal additional RSS 2.0 specification requirement:
// <enclosure url="http://blah.something.tla/path/to/something.mp3" 
length="#####" type="audio/mpeg"/>

// Do not alter this section
if ($action == 'rss' || $action == 'rdf') {
     $PodFilePath = "$PodRoot/$PodFile";
     if ($Group == $PodGroup && fileexists($PodFilePath)) {

         // Define the audio filename
         $PodFile = "$pagename.mp3";
         // grab the file length for the specification requirement
         $PodLength = filesize($PodFilePath);
         // alter the RSS Item format to comply:

         $RssItemFmt='
             <item rdf:about="$PageUrl">
             <title>$WikiTitle | $Group / $Title</title>
             <link>$PageUrl</link>
             <description>$RssItemDesc</description>
             <dc:date>$RssItemPubDate</dc:date>
             <enclosure url="$PodURLPath/$PodFile" length="$PodLength" 
type="audio/mpeg"/>
             </item>'
       }
     include_once("$FarmD/scripts/rss.php");
}

// Resume normal config file

------------
The only other way I can think of to do it is something like:


if ($action == 'rss' || $action == 'rdf') {
     if ($Group == $PodGroup) {
         // alter the RSS Item format to comply:
         $RssItemFmt='
             <item rdf:about="$PageUrl">
             <title>$WikiTitle | $Group / $Title</title>
             <link>$PageUrl</link>
             <description>$RssItemDesc</description>
             <dc:date>$RssItemPubDate</dc:date>
             <? if file_exists($PodRoot/$pagename) { ?><enclosure 
url="$PodURLPath/$pagename.mp3" 
length="<?=filesize("$PodRoot/$pagename")?>" type="audio/mpeg"/><? } ?>
             </item>'
       }
     include_once("$FarmD/scripts/rss.php");
}
------------
But I think the breakouts from php to html won't be saved in the 
variable -- not sure I want to go through testing that.

The other choice is for me to rewrite rss.php.  That doesn't sound like 
fun either.

Anyone like to try helping me out?

Thanks,

Crisses
----
I have issues with anyone who treats faith as a burden instead of a 
blessing. You people don't celebrate your faith; you mourn it.
  - Serendiptiy, Dogma




More information about the pmwiki-users mailing list