Results 1 to 9 of 9

Thread: DD Crawler - Everything is one column

  1. #1
    Join Date
    Oct 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default DD Crawler - Everything is one column

    1) Script Title: DD Text and Image Crawler 1.5

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...wler/index.htm

    3) Describe problem:

    I'm trying to get the crawler to scroll through various world clocks (The time in Washington, Moscow, Sydney, etc), but when I plug in the scripts for each one it just displays them as one long column and repeatedly scrolls through that one column. I tried putting the <span> </span> tags around each element but that didn't help.

    Here's a copy of the script and what it appears as on my site. I'm a novice with this kind of stuff so I apologize if the solution is obvious or if I'm attempting something that can't be done.

    Site: http://diplomunion.com - It's on the left

    Code:
    <script type="text/javascript" src="http://diplomunion.com/crawler.js">
    /* Text and/or Image Crawler Script v1.5 (c)2009-2011 John Davenport Scheuer
       as first seen in http://www.dynamicdrive.com/forums/
       username: jscheuer1 - This Notice Must Remain for Legal Use
       updated: 4/2011 for random order option, more (see below)
    */
    
    </script>
    
    <div class="marquee1" id="mycrawler2">
    <span><!-Local Time Clock widget - HTML code - localtimes.info --><div align="center" style="margin:15px 0px 0px 0px"><div align="center" style="width:140px;border:1px solid #ccc;background:#fff ;color: #fff ;font-weight:bold"><a style="padding:2px 1px;margin:2px 1px;font-size:13px;line-height:16px;font-family:arial;text-decoration:none;color:#000 ;" href="http://localtimes.info/Oceania/New_Zealand/Wellington/"><img src="http://localtimes.info/images/countries/nz.png" border=0 style="border:0;margin:0;padding:0">&nbsp;&nbsp;Wellington Time</a></div><script type="text/javascript" src="http://localtimes.info/clock.php?continent=Oceania&country=New+Zealand&city=Wellington&color=black-white&widget_number=1000"></script></div><!-end of code--></span>
    
    <span><!-Local Time Clock widget - HTML code - localtimes.info --><div align="center" style="margin:15px 0px 0px 0px"><div align="center" style="width:140px;border:1px solid #ccc;background:#fff ;color: #fff ;font-weight:bold"><a style="padding:2px 1px;margin:2px 1px;font-size:13px;line-height:16px;font-family:arial;text-decoration:none;color:#000 ;" href="http://localtimes.info/Oceania/Australia/New_South_Wales/Sydney/"><img src="http://localtimes.info/images/countries/au.png" border=0 style="border:0;margin:0;padding:0">&nbsp;&nbsp;Sydney Time</a></div><script type="text/javascript" src="http://localtimes.info/clock.php?continent=Oceania&country=Australia&city=Sydney&color=black-white&widget_number=1000"></script></div><!-end of code--></span>
    
    *Similar script repeated several times. Removed so could fit in post.*
    
    </div>
    
    <script type="text/javascript">
    marqueeInit({
    	uniqueid: 'mycrawler2',
    	style: {
    		'padding': '2px',
    		'width': '600px',
                    'margin': '0 auto',
    		'height': '75px'
    	},
    	inc: 1, //speed - pixel increment for each iteration of this marquee's movement
    	mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
    	moveatleast: 1,
    	neutral: 150,
    	savedirection: true,
    	random: false
    });
    </script>

  2. #2
    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

    I'd try a table, something more like:

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript" src="http://diplomunion.com/crawler.js">
    /* Text and/or Image Crawler Script v1.5 (c)2009-2011 John Davenport Scheuer
       as first seen in http://www.dynamicdrive.com/forums/
       username: jscheuer1 - This Notice Must Remain for Legal Use
       updated: 4/2011 for random order option, more (see below)
    */
    
    </script>
    <style type="text/css">
    #mycrawler2 table, .marquee0 table{
    	white-space: normal;
    	border-collapse: collapse;
    	border-width: 0
    }
    #mycrawler2 td, .marquee0 td{
    	white-space: normal;
    	width: 142px;
    	margin: 0;
    	padding: 0;
    	border-width: 0
    }
    </style>
    
    </head>
    <body>
    <div id="mycrawler2"><table>
    <tr>
    
    <td><!-Local Time Clock widget - HTML code - localtimes.info --><div align="center" style="margin:15px 0px 0px 0px"><div align="center" style="width:140px;border:1px solid #ccc;background:#fff ;color: #fff ;font-weight:bold"><a style="padding:2px 1px;margin:2px 1px;font-size:13px;line-height:16px;font-family:arial;text-decoration:none;color:#000 ;" href="http://localtimes.info/Oceania/New_Zealand/Wellington/"><img src="http://localtimes.info/images/countries/nz.png" border=0 style="border:0;margin:0;padding:0">&nbsp;&nbsp;Wellington Time</a></div><script type="text/javascript" src="http://localtimes.info/clock.php?continent=Oceania&country=New+Zealand&city=Wellington&color=black-white&widget_number=1000"></script></div><!-end of code--></td>
    
    <td><!-Local Time Clock widget - HTML code - localtimes.info --><div align="center" style="margin:15px 0px 0px 0px"><div align="center" style="width:140px;border:1px solid #ccc;background:#fff ;color: #fff ;font-weight:bold"><a style="padding:2px 1px;margin:2px 1px;font-size:13px;line-height:16px;font-family:arial;text-decoration:none;color:#000 ;" href="http://localtimes.info/Oceania/Australia/New_South_Wales/Sydney/"><img src="http://localtimes.info/images/countries/au.png" border=0 style="border:0;margin:0;padding:0">&nbsp;&nbsp;Sydney Time</a></div><script type="text/javascript" src="http://localtimes.info/clock.php?continent=Oceania&country=Australia&city=Sydney&color=black-white&widget_number=1000"></script></div><!-end of code--></td>
    
    <td><!-Local Time Clock widget - HTML code - localtimes.info --><div align="center" style="margin:15px 0px 0px 0px"><div align="center" style="width:140px;border:1px solid #ccc;background:#fff ;color: #fff ;font-weight:bold"><a style="padding:2px 1px;margin:2px 1px;font-size:13px;line-height:16px;font-family:arial;text-decoration:none;color:#000 ;" href="http://localtimes.info/Oceania/Australia/Queensland/Gold_Coast/"><img src="http://localtimes.info/images/countries/au.png" border=0 style="border:0;margin:0;padding:0">&nbsp;&nbsp;Gold Coast Time</a></div><script type="text/javascript" src="http://localtimes.info/clock.php?continent=Oceania&country=Australia&city=Gold+Coast&color=black-white&widget_number=1000"></script></div><!-end of code--></td>
    
    </tr>
    </table>
    
    </div>
    
    <script type="text/javascript">
    marqueeInit({
    	uniqueid: 'mycrawler2',
    	style: {
    		'padding': '2px',
    		'width': '600px',
                    'margin': '0 auto',
    		'height': '80px'
    	},
    	inc: 1, //speed - pixel increment for each iteration of this marquee's movement
    	mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
    	moveatleast: 1,
    	neutral: 150,
    	savedirection: true,
    	noAddedSpace: true
    });
    </script>
    </body>
    </html>
    Notes: I tried to highlight all the significant changes. The script assigns the class name to the crawler, you should not. Since you have only one, this will be marquee0. I got rid of random: false. That's the default. I added noAddedSpace: true because I think it will work out well with what you're doing.

    Instead of a table, floats could be used. The main point is to avoid line breaks between each widget.

    The browser cache may need to be cleared and/or the page refreshed to see changes.
    Last edited by jscheuer1; 10-06-2011 at 03:10 PM. Reason: better styles for the head - later add more notes
    - John
    ________________________

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

  3. #3
    Join Date
    Oct 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks, but now when I try and save it, it gives me:

    Error

    [object Object]

  4. #4
    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

    When you 'try to save it'?
    - John
    ________________________

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

  5. #5
    Join Date
    Oct 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    As in when I edit the .php file it's contained in on my cPanel.

  6. #6
    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

    Is this a PHP error or a javascript error, or something else?
    - John
    ________________________

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

  7. #7
    Join Date
    Oct 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Not really sure, see attached.

    EDIT: Attached came out smaller than I expected. Here's a better picture.


  8. #8
    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

    Looks like a cPanel error.

    The code I posted is for a standalone page. If you're trying to paste it into an existing page, that might be the problem.

    Just use the highlighted changes, apply them to your existing code. Back everything up first because I have another idea.

    And if that's not the problem, it could be a cPanel problem of another sort. I have no experience with cPanel.


    Edit: Added Later:

    I do have another method now. It involves knowing the number of clocks though, as a width must be set in style for that. You could keep whatever you had, just change the init to:

    Code:
    <script type="text/javascript">
    marqueeInit({
    	uniqueid: 'mycrawler2',
    	style: {
    		'padding': '2px',
    		'width': '600px',
                    'margin': '0 auto',
    		'height': '80px'
    	},
    	inc: 1, //speed - pixel increment for each iteration of this marquee's movement
    	mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
    	moveatleast: 1,
    	neutral: 150,
    	savedirection: true,
    	noAddedSpace: true
    });
    </script>
    and add these styles to the page (or add their rules to an existing stylesheet for the page):

    Code:
    <style type="text/css">
    #mycrawler2 span, .marquee0 span {
    	white-space: normal;
    	display: block;
    	width: 142px;
    	margin: 0 4px 0 0;
    	padding: 0;
    	float: left;
    }
    .marquee0 div div {
    	overflow: hidden;
    	width: 438px;
    }
    .marquee0 div div div {
    	width: auto;
    }
    #clock_widget { /* with below for some browsers that leave ghost widgets around outside the crawler */
    	display: none;
    }
    #mycrawler2 #clock_widget, .marquee0 #clock_widget {
    	display: inline;
    }
    #mycrawler2 object, .marquee0 object, #mycrawler2 embed, .marquee0 embed {
    	width: 142px;
    	height: 35px;
    }
    </style>
    That red number is important. It's the number of clocks times 146 (140 for each clock, 2 for each clock's left and right border of 1 each and 4 for the right margin of each floated span containing a clock).

    You should still get rid of class="marquee1", but it should be changed to class="marquee" instead of being dropped completely. This holds true for the first solution as well.
    Last edited by jscheuer1; 10-07-2011 at 03:18 PM. Reason: add alternate method
    - John
    ________________________

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

  9. #9
    Join Date
    Oct 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Working! Thanks for all your help, love the scroller

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
  •