Mercifull Posted February 4, 2013 Share Posted February 4, 2013 [hide]Hi all, Been a long time posting in this forum but I've come across something that I'm stumped at and could do with some advice. Let me explain some bits... I have running on the server some software called DirCaster which reads the contents of folders to create an RSS feed. e.g. I have a folder on fromefm.co.uk/media/altfactor full of mp3 files. DirCaster created this on the fly when you put the folder in as a variable. See http://fromefm.co.uk...?show=altfactor I am using an RSS parser called MagpieRSSwhich if I hardcode in the rss url works fine but doesn't work If I try to use _GET to change it. <?php require_once 'magpierss/rss_fetch.inc'; $url = 'http://fromefm.co.uk/archive/dircaster2.php?show=altfactor'; $rss = fetch_rss($url); foreach ($rss->items as $item ) { $title = $item[title]; $url = $item[guid]; $description = $item[description]; echo "<li><a href='#' data-src='$url'>$title</a></li> "; } ?> The above code successfully lists all the stuff in the podcast directory by running the magpie script which in turn runs dircaster to get the file listing. The problem arises when trying to make the $url variable dynamic. I thought I could just do this to create my own new dynamic variable $showname = $_GET['show']; But when I put it into the main code it breaks. <?php $showname = $_GET['show']; require_once 'magpierss/rss_fetch.inc'; $url = 'http://fromefm.co.uk/archive/dircaster2.php?show='+$showname; $rss = fetch_rss($url); foreach ($rss->items as $item ) { $title = $item[title]; $url = $item[guid]; $description = $item[description]; echo "<li><a href='#' data-src='$url'>$title</a></li> "; } ?> I hope this makes sense. I've got an example page here which DOES have the variable to get a show name but still has the dircaster url hardcoded. There is an echo of $showname in the description to check it works. e.g http://www.frome.me/....php?show=tipit Any ideas or advice would be helpful. Perhaps it's something MAgpie can't do. If so are there any other similar RSS->PHP parsers around that could do this?[/hide]Solved. Thanks Working (draft) script here: http://www.fromefm.c...er/?show=xxxxxx examples:http://www.fromefm.c...?show=altfactorhttp://www.fromefm.c...=homelyremedieshttp://www.fromefm.c.../?show=ourhouse Thanks for the help guys. Mercifull <3 Suzi "We don't want players to be able to buy their way to success in RuneScape. If we let players start doing this, it devalues RuneScape for others. We feel your status in real-life shouldn't affect your ability to be successful in RuneScape" Jagex 01/04/01 - 02/03/12 Link to comment Share on other sites More sharing options...
Mercifull Posted February 4, 2013 Author Share Posted February 4, 2013 I should probably explain it's to basically parse the contents of the RSS into a playlist that audiojs can read. Mercifull <3 Suzi "We don't want players to be able to buy their way to success in RuneScape. If we let players start doing this, it devalues RuneScape for others. We feel your status in real-life shouldn't affect your ability to be successful in RuneScape" Jagex 01/04/01 - 02/03/12 Link to comment Share on other sites More sharing options...
Hedgehog Posted February 4, 2013 Share Posted February 4, 2013 Does '+' even concatenate in php? Try this: <?php $showname = $_GET['show']; require_once 'magpierss/rss_fetch.inc'; $url = 'http://fromefm.co.uk/archive/dircaster2.php?show='.$showname; $rss = fetch_rss($url); foreach ($rss->items as $item ) { $title = $item[title]; $url = $item[guid]; $description = $item[description]; echo "<li><a href='#' data-src='$url'>$title</a></li> "; } ?> 1 Link to comment Share on other sites More sharing options...
Mercifull Posted February 4, 2013 Author Share Posted February 4, 2013 Awsome! Thanks. I was soooooooooooooooooooo close to being right lol. Schoolboy error :) Thanks very much Mercifull <3 Suzi "We don't want players to be able to buy their way to success in RuneScape. If we let players start doing this, it devalues RuneScape for others. We feel your status in real-life shouldn't affect your ability to be successful in RuneScape" Jagex 01/04/01 - 02/03/12 Link to comment Share on other sites More sharing options...
Xena_Dragon Posted February 4, 2013 Share Posted February 4, 2013 (edited) You are trying to concatenate two strings in the wrong way. In JavaScript you would indeed use a + sign, but in PHP the concatenation operator is a period. Change the line to this and it will work $url = 'http://fromefm.co.uk/archive/dircaster2.php?show='.$showname; ... and I see the answer was already posted during me posting my response :P Edited February 4, 2013 by Xena_Dragon 1 Link to comment Share on other sites More sharing options...
Mercifull Posted February 4, 2013 Author Share Posted February 4, 2013 Now begins the challenge of turning all my experiments into a Wordpress plugin eek Mercifull <3 Suzi "We don't want players to be able to buy their way to success in RuneScape. If we let players start doing this, it devalues RuneScape for others. We feel your status in real-life shouldn't affect your ability to be successful in RuneScape" Jagex 01/04/01 - 02/03/12 Link to comment Share on other sites More sharing options...
Mercifull Posted February 4, 2013 Author Share Posted February 4, 2013 It's because I've been flicking between php and javascript for this blinkin html5 player I used a + instead of . Now I understand how women get so stressful when you have a missing period. 1 Mercifull <3 Suzi "We don't want players to be able to buy their way to success in RuneScape. If we let players start doing this, it devalues RuneScape for others. We feel your status in real-life shouldn't affect your ability to be successful in RuneScape" Jagex 01/04/01 - 02/03/12 Link to comment Share on other sites More sharing options...
Mercifull Posted February 4, 2013 Author Share Posted February 4, 2013 Working (draft) script here: http://www.fromefm.co.uk/popupplayer/?show=xxxxxx examples:http://www.fromefm.co.uk/popupplayer/?show=altfactorhttp://www.fromefm.co.uk/popupplayer/?show=homelyremedieshttp://www.fromefm.co.uk/popupplayer/?show=ourhouse Thanks for the help guys. Mercifull <3 Suzi "We don't want players to be able to buy their way to success in RuneScape. If we let players start doing this, it devalues RuneScape for others. We feel your status in real-life shouldn't affect your ability to be successful in RuneScape" Jagex 01/04/01 - 02/03/12 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now