Jump to content

Insert php output into a scrolling marquee


rsxdev

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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)?

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.