I worked with this some this morning again, but the problem with any of the time stamp variables I can pull is that they aren't sending any time over to the XML, so the <pubDate> field remains blank. (Also, I can't find documentation on the BAND_TIME variable at all - is this a song template variable or a band template variable?)
I also tried $songs.SONG_CREATE, with the time stamp conversion, but still no dice. Not quite sure why the variables aren't pulling any information over, even if it ends up in the incorrect format. I also tried the various $SONG_DATE variables and can't get information to pull into the template, either.
Part of this is that I don't actually under stand what the format of $songs.SOME_VARIABLE does within the code. Is the $songs. part there to make a variable available that would not normally be available in the radio playlist template?
I'll hope to pick away at it a little more tonight when I get home from work, but I've got about 43 unanswered emails from bands that I need to take care of, so I'm not sure I'll have time to work on it.
The {$return_email} works great (I knew there was something for that, and was just being lazy not looking it up! BUT, a feed e-mail address can get heavily spammed, so site owners might not want it to be the same address they use for support functions, etc.
Joined: 27 Apr 2006
Posts: 22009
Location: Southern California
Posted: 08/07/07 14:36
I think it's the foreach loop that's confusing you. Basically, the playlist.php file creates an array of songs in the playlist called RADIO_SONGS. Each element of the array in RADIO_SONGS is actually an array itself. Here's a more visual example:
So the foreach loops over each $song in the RADIO_SONGS array, and the elements after the . are just variables particular to each song. Hopefully that makes sense. I'd suggest doing a {debug output="html"} in this template as well to see a full display of the variables, it'll also help you understand it (arrays were WAY over my head until I started learning php, now I can't live without em! )
Joined: 27 Apr 2006
Posts: 22009
Location: Southern California
Posted: 08/07/07 16:49
I tried validating the feed, and it didn't validate. I know how one of the errors (with a template pre-processor), and think I know how to fix the second, but not the third. Try doing this:
create podcast.tpl.php:
Code
<?php
// These header calls are required to get the browser to see this as an RSS Feed
header('Expires: '. gmdate('D, d M Y H:i:s', time()) .' GMT');
header('Last-Modified: '. gmdate('D, d M Y H:i:s') .' GMT');
header('Content-Type: application/xml; charset=utf-8');
?>
So the foreach loops over each $song in the RADIO_SONGS array, and the elements after the . are just variables particular to each song. Hopefully that makes sense. I'd suggest doing a {debug output="html"} in this template as well to see a full display of the variables
Thanks for the explanation, Kyle - now that you explained it's an array, I have a better understanding of that. I know what arrays do, but apparently don't recognize one when I see one! And no way could I write them. I'm pretty thrilled that I can usually get an if/else statement to work.
Quote:
The second thing the feed validator complains about is this line:
{$smarty.foreach.song_val.iteration}
My guess is because it's not in any xml tags.
That won't come through in the parsed code, so it shouldn't be a problem for the validation of the xml.
Quote:
item should contain a guid element
I tried to put the <guid> in, but had difficulties figuring what to use - it should be the link to the item, but that didn't work out (perhaps because it was three in the morning when I was working on it?). However, it doesn't have to be, so I will probably look to put another unique variable in there. Some feed readers will use <guid>, but it is optional because if it isn't there, they will use the item date. However, it's always best to use it when you can.
I didn't have time to work on this tonight, but I should have time tonight. We'll see how the $songs.SONG_TIME works out for the time stamping and I'll let you know.
Well, I'm feeling rather discouraged. The feed finally validates as RSS and works correctly. In FireFox. In IE, it does not access it as a feed.
Brian gets around this with an RSS/XML wrapper which work really great with the other feeds I built which only serve up text. I tried wrapping this one in it, and I can't get it to work.
The final code does not have the numbering provided by{$smarty.foreach.song_val.iteration}. Kyle, you are correct that it won't validate because it isn't inside an element.
If someone can get that to be seen as RSS/XML it will work fine. Like I said, works great in FireFox. I took out the php and put the basics into Brian's wrapper and it goes horribly wrong with an xml parsing error.
I can't really any farther with this with what I know. The RSS is good and is working, but I don't how to get it to be seen as an RSS file. I tried basically taking out the php statements and using Brian's wrapper for it by breaking the heading, items, and footer out into tpls, but it didn't even get close to generating RSS code.
Are you using that on your system Jill? Would you mind if I logged in as your admin and tried some things out with it?
Kyle, I would have no problem with giving you my admin, but the only thing I put on the live site was the parsed code I pulled out of the source on my local test site so that I could see if it validated. My live site is still running on V2 while I'm trying to get the new site done.
You could grab the code and put it on your demo site - if you have a station set up and stick the link somewhere, that would let you mess with it.
And then I used the new template pre-processor functionality in a template called podcast.tpl.php:
create podcast.tpl.php:
Code
<?php
// These header calls are required to get the browser to see this as an RSS Feed
header('Expires: '. gmdate('D, d M Y H:i:s', time()) .' GMT');
header('Last-Modified: '. gmdate('D, d M Y H:i:s') .' GMT');
header('Content-Type: application/xml; charset=utf-8');
?>
Clearly, in all this I missed that original explanation. I was too focused on making the RSS elements validate.
But I am still a bit confused...not sure how that all links up or which one is used for the link to the feed. This is because I have lost all ability to process information and need to get to bed. Hopefully, it will all make perfect sense tomorrow morning.
Joined: 27 Apr 2006
Posts: 22009
Location: Southern California
Posted: 08/08/07 23:36
Jamroom 3.1 has the ability to use template pre-processors, meaning that if jamroom finds a file with the same name as the template being called, but with a .php extension, it will execute the .php file first before the .tpl file.
So in this case, the two files are podcast.tpl, and podcast.tpl.php . Since Jamroom sees the podcast.tpl file has a template pre-processor (podcast.tpl.php), it processes that file first (which must be written in php). I put the raw header functions in their, so they get processed before the podcast.tpl.
Long of the short story is that you just call the podcast.tpl file via the index.php, i.e.