PodcastGenerator
PodcastGenerator copied to clipboard
Navigation from an episode to others sharing one of its categories
I'm trying to allow users of my podcast site to click on an episode and, from that single-episode view, then click on one of that episode's categories to see others in the same category. The current theme doesn't event list the categories for an episode, so the first step would be to display those at all. But ideally, we show them with their human-readable category name ("Things That Go Bump In the Night") while still using the category ID ("things_that_go_bump_in_the_night") in a link back to the episode listing.
I was able to hack up my custom theme to show episode categories via their IDs (which are readily available in the episode XML data), but haven't yet worked out a way to maps those IDs to category human-readable names for display purposes. I'll show here the singleepisode.php tweaks I made. There are corresponding CSS tweaks, too, but those are immaterial.
--- themes/pbcharrisburg/singleepisode.php (revision 1241)
+++ themes/pbcharrisburg/singleepisode.php (revision 1242)
@@ -30,6 +30,16 @@
echo '<h1>' . htmlspecialchars($correctepisode["episode"]["titlePG"]) . '</h1>';
echo ' <div class="episode-date">' . htmlspecialchars($correctepisode["episode"]["moddate"]) . '</div>';
echo ' <div class="episode-desc">' . $correctepisode["episode"]["longdescPG"] . '</div>';
+$episode_cats = [$correctepisode["episode"]["categoriesPG"]["category1PG"],
+ $correctepisode["episode"]["categoriesPG"]["category2PG"],
+ $correctepisode["episode"]["categoriesPG"]["category3PG"]];
+echo ' <div class="episode-categories">Categories: <ul>';
+foreach ($episode_cats as $episode_cat) {
+ if ($episode_cat != "") {
+ echo '<li><a href="categories.php?cat=' . htmlspecialchars($episode_cat) . '">' . htmlspecialchars($episode_cat) . '</a></li>';
+ }
+}
+echo ' </ul></div>';
if (strtolower($config["enablestreaming"]) == "yes") {
if ($type == 'audio') {
echo ' <audio controls>';
Hmmm the categories alreadydid some problems in the past. Will work on it later.