kenle Posted September 24, 2005 Posted September 24, 2005 Hi all, I would like to have a scrolling news at the middle column, not on the right or the left of Oscommerce. It should be like the newsdesk module but be able to scrolling. And when the user put the mouse over it, it should stop. You can look at this website and see what I mean: http://www.flying-hobby.com/ Does this module already exists somewhere or can I somehow modify some existing scrolling news on the side and make it to the middle column? Thanks
UnseenMenace Posted September 24, 2005 Posted September 24, 2005 I know that there is a port of oscommerce called osc2nuke which includes the CMS PHPNuke and this has scrolling news modules and other features which may be of use to you. www.osc2nuke.com
mushindo Posted September 24, 2005 Posted September 24, 2005 Is this what you are looking for? http://69.13.169.2/ Notice the scroll box on the bottom. If so, I can guide you on how to create this. STEP 1: Create a table or box to place the scroller into. STEP 2: Copy the following coding and paste it into your box <!-- start scroller --> <script language="JavaScript1.2"> //Specify the marquee's width (in pixels) var marqueewidth="320px" //Specify the marquee's height var marqueeheight="100px" //Specify the marquee's marquee speed (larger is faster 1-10) var marqueespeed=1 //Pause marquee onMousever (0=no. 1=yes)? var pauseit=1 //marquee content var marqueecontent='<?php echo your new query><b><a href=newspage.php?nid=$nid>$title</a></b><br><br>$newsteaser<br><br><hr><?php>' marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1) //slow speed down by 1 for NS var copyspeed=marqueespeed var pausespeed=(pauseit==0)? copyspeed: 0 var iedom=document.all||document.getElementById var actualheight='' var cross_marquee, ns_marquee function populate(){ if (iedom){ cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee cross_marquee.style.top=parseInt(marqueeheight)+8+"px" cross_marquee.innerHTML=marqueecontent actualheight=cross_marquee.offsetHeight } else if (document.layers){ ns_marquee=document.ns_marquee.document.ns_marquee2 ns_marquee.top=parseInt(marqueeheight)+8 ns_marquee.document.write(marqueecontent) ns_marquee.document.close() actualheight=ns_marquee.document.height } lefttime=setInterval("scrollmarquee()",20) } window.onload=populate function scrollmarquee(){ if (iedom){ if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8)) cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px" else cross_marquee.style.top=parseInt(marqueeheight)+8+"px" } else if (document.layers){ if (ns_marquee.top>(actualheight*(-1)+8)) ns_marquee.top-=copyspeed else ns_marquee.top=parseInt(marqueeheight)+8 } } if (iedom||document.layers){ with (document){ if (iedom){ write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') write('<div id="iemarquee" style="position:absolute;left:0px;top:0px;width:100%;">') write('</div></div>') } else if (document.layers){ write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee">') write('<layer name="ns_marquee2" width='+marqueewidth+' height='+marqueeheight+' left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') write('</ilayer>') } } } </script> <!-- end scroller --> STEP 3: In the above code you will look for this: //marquee content var marqueecontent='<?php echo your new query><b><a href=newspage.php?nid=$nid>$title</a></b><br><br>$newsteaser<br><br><hr><?php>' And need to adjust the following items: 1. Add your new query string above where it says <!-- start scroller --> 2. Alter the above code and variables to match the items in the database. 3. Loop the string above so all news ends up between var marqueecontent '' NOTE: This is the one bug I found in this script above. If you have articles which use line breaks like this: "my news article 1, paragraph 1. my news article 1, paragraph 2. " It will toss an error since the browser would see this: var marqueecontent 'my news article 1, paragraph 1. my news article 1, paragraph 2.' and consider that an unclosed script. So you will have to do some legwork and find the equal php statement to automatically filter out any line breaks in your news. Make sense? I know you may have been expecting an existing contribution for this, but with a little work this will work perfectly. I will eventually put this together as a contribution, but this is what I can offer for now. Sincerely, Bruce 19 contributions submitted
Recommended Posts
Archived
This topic is now archived and is closed to further replies.