Jump to:

22992 Posts in 11842 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » incorporate a scrolling news ticker

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

Page: 1 2
Go to End
Author Topic: 3425 Views
  • Nic
    Avatar
    Community Member
    2 Posts

    incorporate a scrolling news ticker Link to this post

    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

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: incorporate a scrolling news ticker Link to this post

    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

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: incorporate a scrolling news ticker Link to this post

    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.

  • nostrad
    Avatar
    Community Member
    25 Posts

    Re: incorporate a scrolling news ticker Link to this post

    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.

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: incorporate a scrolling news ticker Link to this post

    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.

  • nostrad
    Avatar
    Community Member
    25 Posts

    Re: incorporate a scrolling news ticker Link to this post

    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?

  • nostrad
    Avatar
    Community Member
    25 Posts

    Re: incorporate a scrolling news ticker Link to this post

    No response from anyone on this???

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: incorporate a scrolling news ticker Link to this post

    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

    3425 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.