Board Logo

Dynamic Data Question (Yet Again)
nutsnbolts - 3/26/2008 at 12:44 AM

Not being a PHP guy, having a few problems understanding how to include "Dynamic" data. Here is schema... Have Scroller set up and running as expected using :

Code:
{
'file': '../cont8.html',
'content': '',
'pause_b': 0,
'pause_a':4
},
etc... etc....

in scroll.tpl0.js with 8 small external files. Have read the article
http://www.softcomplex.com/forum/viewthread.php?tid=2988#pid10207
"Solution For Dynamic Dbase Data"
And think I can implement to replace files with "content" from mysql dbase. This will allow a simple form to allow updating the scroller content rather than having to upload new files as content changes.

Question comes from following: Have allowed for max of 8 "files " or content blocks. How-to states
Quote:
One thing I did notice is that you need to make sure you're returning as many results as you have content elements. Meaning that if you have it set up to show five results but you've only got two records in your database it doesn't work -- something in the scroll code and I haven't looked at it yet to see why. If you're worried about that happening you simply move the ITEMS info into the while loop above and have it actually generate as many items as it finds results. If that makes no sense and you have this problem let me know and I'll post the code.

I will have this "problem" as some times dbase records will be as few as 3 or 4 up to max of 8. Since this post was in 2005 not sure the original poster is still around, and if someone could give me a little direction about moving the "Items" info into the while loop as stated I would really appreciate it.

TIA
David


tigra - 3/26/2008 at 03:13 PM

the idea of the posting is that instead of having fixed number of scrolled items

{
'file': '',
'content': ' <? echo (...) ?>',
'pause_b': 0,
'pause_a':4
},
...
{
'file': '',
'content': ' <? echo (...) ?>',
'pause_b': 0,
'pause_a':4
}

you'll need to generate as many as you need
<?
while (...have records...) {
?>
{
'file': '',
'content': ' <? echo (...) ?>',
'pause_b': 0,
'pause_a':4
}
<? } ?>

make sure you have them separated with commas and last one doesn't have comma after it.


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/