rsxdev Posted May 13, 2012 Share Posted May 13, 2012 I have the following code, and want to insert php output into a scrolling marguee to show it on web page. <?php $playlistUrl = 'http://domain.com/playlist.xml'; $xmldata = file_get_contents($playlistUrl); $xml = new SimpleXMLElement($xmldata); foreach( $xml->trackList->track as $track ) { echo $track->title .' - '. $track->annotation .'<br>'; } ?> How to connect php script and javascript together? I checked various javascript scrollers, some of them accepts HTML markup. Quote Link to comment https://forums.phpfreaks.com/topic/262475-insert-php-output-into-a-scrolling-marquee/ Share on other sites More sharing options...
requinix Posted May 13, 2012 Share Posted May 13, 2012 What does the marquee code look like? Quote Link to comment https://forums.phpfreaks.com/topic/262475-insert-php-output-into-a-scrolling-marquee/#findComment-1345186 Share on other sites More sharing options...
Dusaro Posted May 14, 2012 Share Posted May 14, 2012 echo "<marquee>"; foreach( $xml->trackList->track as $track ) { echo $track->title .' - '. $track->annotation .'<br>'; } echo "</marquee>"; is this what you want? Quote Link to comment https://forums.phpfreaks.com/topic/262475-insert-php-output-into-a-scrolling-marquee/#findComment-1345206 Share on other sites More sharing options...
The Letter E Posted May 14, 2012 Share Posted May 14, 2012 echo "<marquee>"; foreach( $xml->trackList->track as $track ) { echo $track->title .' - '. $track->annotation .'<br>'; } echo "</marquee>"; is this what you want? I believe that the <marquee> tag is no longer valid(W3C Compliant) html. FYI. Quote Link to comment https://forums.phpfreaks.com/topic/262475-insert-php-output-into-a-scrolling-marquee/#findComment-1345215 Share on other sites More sharing options...
Dusaro Posted May 14, 2012 Share Posted May 14, 2012 echo "<marquee>"; foreach( $xml->trackList->track as $track ) { echo $track->title .' - '. $track->annotation .'<br>'; } echo "</marquee>"; is this what you want? I believe that the <marquee> tag is no longer valid(W3C Compliant) html. FYI. then why am i still using it xD Quote Link to comment https://forums.phpfreaks.com/topic/262475-insert-php-output-into-a-scrolling-marquee/#findComment-1345223 Share on other sites More sharing options...
The Letter E Posted May 14, 2012 Share Posted May 14, 2012 echo "<marquee>"; foreach( $xml->trackList->track as $track ) { echo $track->title .' - '. $track->annotation .'<br>'; } echo "</marquee>"; is this what you want? I believe that the <marquee> tag is no longer valid(W3C Compliant) html. FYI. then why am i still using it xD LOL Quote Link to comment https://forums.phpfreaks.com/topic/262475-insert-php-output-into-a-scrolling-marquee/#findComment-1345225 Share on other sites More sharing options...
rsxdev Posted May 15, 2012 Author Share Posted May 15, 2012 echo "<marquee>"; foreach( $xml->trackList->track as $track ) { echo $track->title .' - '. $track->annotation .'<br>'; } echo "</marquee>"; is this what you want? Hi, that would be simple way, but marguee tag no longer supported. I'm trying to find some more recent cross-browser javascript, that will do smooth scrolling. There is more recent one at http://www.dynamicdrive.com/dynamicindex2/cmarquee2.htm, but it scrolls the contents upwards. Not sure can it be adopted for scrolling contents horizontally (sideways)? Quote Link to comment https://forums.phpfreaks.com/topic/262475-insert-php-output-into-a-scrolling-marquee/#findComment-1345697 Share on other sites More sharing options...
The Letter E Posted May 15, 2012 Share Posted May 15, 2012 echo "<marquee>"; foreach( $xml->trackList->track as $track ) { echo $track->title .' - '. $track->annotation .'<br>'; } echo "</marquee>"; is this what you want? Hi, that would be simple way, but marguee tag no longer supported. I'm trying to find some more recent cross-browser javascript, that will do smooth scrolling. There is more recent one at http://www.dynamicdrive.com/dynamicindex2/cmarquee2.htm, but it scrolls the contents upwards. Not sure can it be adopted for scrolling contents horizontally (sideways)? http://codecanyon.net/item/jquery-marquee-animation-plugin/236431 Quote Link to comment https://forums.phpfreaks.com/topic/262475-insert-php-output-into-a-scrolling-marquee/#findComment-1345699 Share on other sites More sharing options...
rsxdev Posted May 15, 2012 Author Share Posted May 15, 2012 Just checked this very simple script, but it have input from within script: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <script type="text/javascript"> var tWidth='300px'; // width (in pixels) var tHeight='25px'; // height (in pixels) var tcolour='#ffffcc'; // background colour: var moStop=true; // pause on mouseover (true or false) var fontfamily = 'arial,sans-serif'; // font for content var tSpeed=3; // scroll speed (1 = slow, 5 = fast) // enter your ticker content here (use \/ and \' in place of / and ' respectively) var content='Are you looking for loads of useful information <a href="http:\/\/javascript.about.com\/">About Javascript<\/a>? Well now you\'ve found it.'; var cps=-tSpeed; var aw, mq; var fsz = parseInt(tHeight) - 4; function startticker(){if (document.getElementById) {var tick = '<div style="position:relative;width:'+tWidth+';height:'+tHeight+';overflow:hidden;background-color:'+tcolour+'"'; if (moStop) tick += ' onmouseover="cps=0" onmouseout="cps=-tSpeed"'; tick +='><div id="mq" style="position:absolute;right:0px;top:0px;font-family:'+fontfamily+';font-size:'+fsz+'px;white-space:nowrap;"><\/div><\/div>'; document.getElementById('ticker').innerHTML = tick; mq = document.getElementById("mq"); mq.style.right=(10+parseInt(tWidth))+"px"; mq.innerHTML='<span id="tx">'+content+'<\/span>'; aw = document.getElementById("tx").offsetWidth; lefttime=setInterval("scrollticker()",50);}} function scrollticker(){mq.style.right = (parseInt(mq.style.right)>(-10 - aw)) ? mq.style.right = parseInt(mq.style.right)+cps+"px": parseInt(tWidth)+10+"px";} window.onload=startticker; </script> </head> <body> <div id="ticker"> this is a simple scrolling text! </div> </body> </html> Can the above script be used with following code that print php output into the div? <html> <head> <title></title> <script> setInterval(function () { $('#reload').load('list.php'); }, 10000); </script> </head> <body> <div id="reload"></div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/262475-insert-php-output-into-a-scrolling-marquee/#findComment-1345708 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.