Collection Path URLs & Trailing Slashes
Permalink 1 user found helpfulI've noticed that the getCollectionPath() returns a path with a trailing slash and Page::getCollectionPathFromID(id) returns a path without a trailing slash.
I figured I'd post here because I don't really know enough about C5 yet to know if that's supposed to happen or if that's a bug.
Seems like they should be the same to me. Anyone with more experience with C5 core want to comment on this?
Thanks!
-john
domain.org/currentpage/?next=1&CurrentMonth=...
However, the following URL would not crash the player, leading me to believe that being able to return the URL without a trailing slash in this one instance could be very useful.
domain.org/currentpage?next=1&CurrentMonth=...
Any ideas on how I could go about doing that? I'm remotely familiar with "extending" helpers, but not entirely sure how to do that or even if it's what I should in fact be doing here. Any advice would help - and either way thanks for the post!
The actual coding on the page that calls the files looks like this:
<div id="flashcontent">this will be replaced with flash </div> <script type="text/javascript"> var so = new SWFObject("audio_player_files/audioPlayer.swf", "player", "270", "100", "6", "#C2B5A1"); so.addVariable("xmlPath", "audio_player_files/data.xml"); so.write("flashcontent"); </script>
And the problem is that adjusting the month on the calendar results in the "flashcontent" div being written instead of the page loading a fresh player.
<song file="<?php echo $this->getBlockURL(); ?>/audio_player_files/music/filename1.zip" etc. etc.
(that's assuming the audio files are in the block's directory)
If it's in your page type template, you could do something like this:
<song file="<?php echo $this->getThemePath(); ?>/audio_player_files/music/filename1.zip" etc. etc
(that's assuming the audio files are in the theme's directory)
Keeping in mind I don't exactly know what I'm talking about here... is there a way for me to ask the Calendar to getPathFromID instead of just getPath?
I think the easiest way to solve this for you is to put your audio files back where they were before (was it public_html/audio_player_files/music/?), then in your XML file you want to put COMPLETE url's to those files -- something like this:
http://yourdomain.com/audio_player_files/music/whatever.mp3...
Ideally you'd actually serve these audio files from the File Manager, but that is a bit more complicated to set up if you're not already familiar with php and C5 and creating your own blocks. So the solution above is a good compromise.
I've built a block (named Beer Player, located in public_html/blocks/beer_player) based on the HTML Block and the Basic Test block. I managed to get it installed, but I can't get the player to show up. There is room made for it, but no image/player appears. The block's folder is attached and this is the code I am entering into the edit.php field created by form_setup_html.php
NOTE: The <?php echo did not appear to be printing when I would view the page source. I tried single quotes and getBlockURL, but neither worked.
<div id="flashcontent">this will be replaced with flash</div> <script type="text/javascript"> var so = new SWFObject("<?php echo $this->getBlockPath(); ?>/audioplayer.swf", "player", "270", "100", "6", "#C2B5A1"); so.addVariable("xmlPath", "<?php echo $this->getBlockPath(); ?>/audio_player_files/data.xml"); so.write("flashcontent"); </script>
On a related note, I could not get it installed at first, because of an XML error (reserved name?), so I moved the data.xml file into the audio_player_files folder, which also contains the music folder. Should it stay there to avoid some kind of a "Two XMLs, One Block" situation, or can they both exist in the same folder after installation. And as mentioned, I went with getBlockPath over getBlockURL like you originally suggested. Are either of those preferred over the other in this situation?
Also, please note that I have excluded the audioplayer.swf file as it's not mine to flaunt - it is normally located in the block's root folder with the bulk of the files. And there's normally mp3s in the music folder, but for the sake of upload... there is not.
It might be worth the $15 for this marketplace addon which lets you embed and flash file and then put in the XML data via the C5 editing interface:
http://www.concrete5.org/marketplace/addons/flash-embed/...
Otherwise, if you have specific questions I can answer quickly I'd be happy to do so but can't really build this whole thing for you.
-Jordan
As of recently, the core system is on github, which makes it a lot easier for other people's changes to be rolled back in, so hopefully things like this will start getting cleaned up by other people outside the core team.
-Jordan