Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Advice needed


Go to End


5 Posts   2393 Views

Avatar
Tonupbandit

Community Member, 7 Posts

26 January 2009 at 12:36pm

I'm working up a site for an audio producer who would like a few pages that she can offer some audio samples on. Ideally she'd like to be able to display the content like so:

Title of piece
Short Description
Thumbnail image
xspf player

Being more a designer than developer, not sure how I'd achieve this in the CMS so that she can add these herself. At first I thought a widget might work, but I'm not sure. In a perfect world, I'd like to see a widget that she could enter text into the fields that need it, attach a thumbnail, and attach an mp3 that is linked to the player. I say widget because she's going to have to be adding multiple instances of these on individual pages. But maybe I'm missing something.

Any suggestions, advice, anything? Thanks much.

Avatar
Carbon Crayon

Community Member, 598 Posts

26 January 2009 at 1:57pm

Hi Tonupbandit

I think what you are looking for is a complextablefield so that you can add as many audio 'objects' as you want. So it might look something like this:

mysite/code/AudioItem.php

mysite/code/AudioPage.php

Then finally in the template Layout/AudioPage.ss, you would have something like this:

<% control AudioItems %>

$Title
$Description
$Thumbnail
<a href="$AudioFile.URL" >Download Audio File</a>

<% end_control %>

Of course you might e using a player of somesort in which case you can just put the $AudioFile.URL in the appropriate place :)

For more info on the different types of relationships you can have in SS check out tutorial 4.

Avatar
Tonupbandit

Community Member, 7 Posts

27 January 2009 at 4:32am

Thanks Aram! This looks like it should do exactly what we're hoping for. Will play around with it tonight and let you all now how it works out. Thanks again.

Avatar
GustyPolo

Community Member, 9 Posts

8 October 2009 at 2:45pm

Hey Aram,

I recently began using silverstripe, so being a designer I mostly piece together things I need to get stuff done here. I came across your code for adding mp3 files with descriptions and stuff and it seems like the perfect solution for what I need. I'm trying to create sermon download section for my church website. I've prepared the files like you have them but I"m having trouble. The AudioItem.php file is good, I get no errors when I run a dev/build. But once I get to the AudioPage.php and run a dev/build it stops half way. I tried my best to figure out where there could be something wrong but I have no clue. Would you or anyone reading this post be able to help me?

Thanks

Avatar
Taffy

Community Member, 119 Posts

8 October 2009 at 10:11pm

Hi Gusty, you might want to look @ Unclecheese's DataObjectManager module. http://silverstripe.org/dataobjectmanager-module/

Here is a video of him adding adding an mp3 using the module http://www.youtube.com/watch?v=239nAqxizjA