Results 1 to 8 of 8

Thread: date Placement: Pausing RSS Scroller

  1. #1
    Join Date
    Mar 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default date Placement: Pausing RSS Scroller

    Script: Pausing RSS Scroller
    http://www.dynamicdrive.com/dynamici...pausescroller/


    hi i was wondering if this possible at all: changing the date placement to appear *next* to the title. currently in the default script, if date is chosen to be displayed, it will display itself *under* the title

    i've been looking at it for a bit, and i have a feeling it's something that i'd have to tweak in lastrss/scrollerbridge.php, ie/


    ---------------------
    function outputRSS_JS($url, $divid) {
    global $rss;
    if ($rs = $rss->get($url)){
    echo "rsscontentdata.$divid=new Array();\n";
    $i=0;
    foreach ($rs['items'] as $item) {
    echo "rsscontentdata.$divid" . "[$i]={link:\"" . sla****($item[link]) . "\", title:\"" . sla****($item[title]) . "\", description:\"" . sla****($item[description]) . "\", date:\"" . sla****($item[pubDate]) . "\"}\n";
    $i++;
    }
    if ($rs['items_count'] <= 0) { echo "rsscontentdata=\"Sorry, no items found in the RSS file\""; }
    }
    else {
    echo "rsscontentdata=\"Sorry: It's not possible to reach RSS file $url\"";
    // All else fails
    }
    }
    ---------------------


    am i close? thanks!

  2. #2
    Join Date
    Mar 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking

    omg, i finally found it! wooooooop

    the layout actually resides in rsspausescroller.js

    and the line
    Code:
    return linktitle+"<br />"+feedate
    obviously contains <br /> and i just removed it

    now, i just need to figure out how to put a really big space between the linktitle and the feeddate

    coz at the moment it looks like this:
    Country radio still uneasy with Dixie Chicks Mar 27, 2006 11:24:10 PM
    ie/the date is RIGHT next to the title

    thanks everyone!

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You could try:

    Code:
    return linktitle+"<span style='margin-left:400px;'>"+feedate+"</span>"
    adjusting 400 as needed. Padding-left might be better than margin-left.

    Or, even get creative and calculate on the fly what remains from the widths taken up by the title and the date when subtracted from the container they reside in's width and use that as the left margin/padding.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Mar 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1
    ...Or, even get creative and calculate on the fly what remains from the widths taken up by the title and the date when subtracted from the container they reside in's width and use that as the left margin/padding...
    woahh that would be cool. how am i gonna do that if the title and date width is obviously not fixed (ie/dependent of the rss feed)?

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Consider this:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    </head>
    <body>
    <div class="floatContainer" style="width:500px;border:1px solid black;padding:2px 4px;font-family:verdana;color:red;font-weight:bold;font-size:80%;"><div style="float:left;width:300px;">Country radio still uneasy with Dixie Chicks. Blah, blah, blah.</div><span style="float:right;font-size:75%;font-weight:normal;">Mar 27, 2006 11:24:10 PM</span></div>
    <script type="text/javascript">
    var floatC=document.getElementsByTagName('div');
    for (var i_tem = 0; i_tem < floatC.length; i_tem++)
    if (floatC[i_tem].className=='floatContainer')
    floatC[i_tem].style.height=floatC[i_tem].firstChild.offsetHeight+'px'
    </script>
    </body>
    </html>
    In the above example, the division with the class of 'floatContainer' represents the container in your script. Hopefully it already has a class name and a fixed width that you can set. If so, we can just replace floatContainer in the script code with its class name. With a bit of luck, we can then do this:

    Code:
    return '<div style="float:left;width:300px;">'+linktitle+'</div><span style="float:right;">'+feedate+'</span>'
    Then find the function where the above line is returning to and have its next lines be:

    Code:
    var floatC=document.getElementsByTagName('div');
    for (var i_tem = 0; i_tem < floatC.length; i_tem++)
    if (floatC[i_tem].className=='floatContainer')
    floatC[i_tem].style.height=floatC[i_tem].firstChild.offsetHeight+'px'
    or this code can be run at another point, as long as it is after each update of the feed(s). The actual widths that you choose to use can be different, the container's width can be what ever it is, makes no difference except the linktitle's division must be narrow enough to fit inside it plus enough width left over for the feedate.
    Last edited by jscheuer1; 03-28-2006 at 11:43 AM. Reason: correct tag closure omission
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Mar 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ahh nice thanks for that. i had to tweak a few things to adapt to the orginal scrolling .js;

    based on your concept, it currently works perfect as just
    Code:
    return "<span style='float:left;'>"+linktitle+"</span><span style='float:right;'>"+feeddate+"</span>"
    and i didnt even have to use the very last bit of code that you suggested! i dunno what's the long-term or cross-browser issues its gonna introduce now that ive simplified the concept to this extent, but for now it's working perfect on ff1.5 and ie6.

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The only two things I would be concerned about are:

    1 ) What if the headline needs to wrap?

    2 ) If there is a container around the floating spans and one of them needs to wrap, how will the container know to increase its height in FF? In IE it will just do so, being filled by the content. However, in FF a float is like position:absolute in many ways so the content may write outside the lines.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Mar 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ahh i see the logic now

    but my page design isnt sposed to accomodate wrapping titles anyway, i dont think. it'll look pretty horrendous if the container was to increase its height.

    at the moment, i'm solely depending on the title to have a maximum length (pretty long now actually, at around 400px just reserved for the title). dunno, this is becoming more and more of a design thing than a technical one.

    i know its a better practice to foolproof everything but the design has gone so deep and the client has been approving all (big and small) stages so far. going back one design step will mean a week or two extra developing time.

    plus, the 'external' rss feed is ultimately going to be from our own servers anyway, which means all titles will be fully under my control! hopefully it works out well!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •