integrating CMS into Javascript code.

2 posts by 2 authors in: Forums > CMS Builder
Last Post: April 26, 2011   (RSS)

By (Deleted User) - April 25, 2011 - edited: April 25, 2011

I am pulling in quotes using Javascript as below:
===============================
<script type="text/javascript">

var speed=8000;
var c=0;

function showQuote() {

quotes=[

'<p id="text">"Quote Number 1."<\/p>'+
'<p id="name" align="right">- Name,Title<\/p>',

'<p id="text">"Quote 2"<\/p>'+
'<p id="name" align="right">- Steve, Ontario<\/p>',

'<p id="text">"Quote 3."<\/p>'+
'<p id="name" align="right">- Dave, Los Angeles<\/p>'

];

c++;
if(c==quotes.length) {
c=0;
}
document.getElementById('quote').innerHTML=quotes[c];

setTimeout(function(){showQuote()},speed);
}

if(window.addEventListener){
window.addEventListener('load',function(){setTimeout(function(){showQuote()},speed)},false);
}
else {
if(window.attachEvent){
window.attachEvent('onload',function(){setTimeout(function(){showQuote()},speed)});
}
}

</script>
===================================
and in the HTML
===================================

<p id="text">"ATI has a well-earned reputation for providing outstanding T5 fixtures."</p>
<p id="name" align="right">- Reef Tools</p>

====================================

This is working great. I tried to add my CMS code with mixed results, so I am turning to the forums hoping someone can help...
Below is the code for each record... Thanks!

<?php foreach ($quotesRecords as $record): ?>
<?php echo $record['quote'] ?>
<?php echo $record['title'] ?>
<?php endforeach ?>