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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

incorporate a scrolling news ticker


Go to End
Reply


9 Posts   3813 Views

Avatar
Nic

Community Member, 2 Posts

13 March 2009 at 1:00am

Hi all!

I'm new to SS and I have a problem. I need to incorporate a scrolling news ticker to a site where the news content is editable from the admin area.

An example of what I've had in mind is something like this.

http://www.mioplanet.com/rsc/newsticker_javascript.htm

What would the best practise be to solve this? Create a new newsticker-module or create a widget? Or is there another way to do this?

Best regards and thanks
Nic

Avatar
Carbon Crayon

Community Member, 598 Posts

13 March 2009 at 1:31pm

Edited: 13/03/2009 1:34pm

hi nic, welcome to Silverstripe

This is pretty straidforward, you just need to output whatever content you want in the ticker into the right markup on your page. Having looked briefly at the ticker code it looks like you would do something like this:

<div id="TICKER" STYLE="overflow:hidden; width:520px">
$TickerContent
</div>

where TickerContent is a field in the $db array.

You could also make it more dynamic and grab content from various pages via a DataObject::get call outputting something like this:

<div id="TICKER" STYLE="overflow:hidden; width:520px">
<% control LatestNews %>
$Title - $Content.FirstSentence
<% end_control %>
</div>

where LatestNews is your function that returns a number of news pages or such like.
Hope that helps :)

Avatar
Sam

Administrator, 685 Posts

13 March 2009 at 2:01pm

Yeah, generally speaking we try to "get out of the designers way" and let people use whatever javascript/css effects they like on the front end, without having to make special modules.

Aram's approach looks good.

Avatar
nostrad

Community Member, 25 Posts

1 May 2009 at 6:08am

Edited: 01/05/2009 6:52am

Please can someone give some tips for me to get started. What is the $db array ? I want to make it as simple as possible for my user to add news items that will display in the scrolling area on the home page. For this I would need to have a page or a form which can be edited to add /delete news items. Even if it is a simple page not a problem. But how do I get the content then from this page into the DIV that displays it? Please urgent help is sought.

This is basically what i want to do:
http://www.devarticles.com/c/a/JavaScript/Creating-a-Scrolling-News-Panel/1/

Only thing is : what approach to take to get the content from a page into the div ?

Thanks in advance for any suggestions/help.

Avatar
Carbon Crayon

Community Member, 598 Posts

1 May 2009 at 8:25am

Hi Nistrad

I suggest you do the tutorials on this page before attempting to make a site in Silverstripe: http://doc.silverstripe.com/doku.php

It will give ayou a good grounding for how SS works.

Avatar
nostrad

Community Member, 25 Posts

3 May 2009 at 3:08am

I went through the docs but I could not find anywhere a specific solution to my problem. I need to get content from a page into a DIV tag on another page. How do I do that?

Avatar
nostrad

Community Member, 25 Posts

4 May 2009 at 12:11am

No response from anyone on this???

Avatar
Carbon Crayon

Community Member, 598 Posts

4 May 2009 at 3:42am

Nostrad,

have a look at tutorial 2 and find the section called 'Showing the latest news on the home page' : http://doc.silverstripe.com/doku.php?id=tutorial:2-extending-a-basic-site

Go to Top