Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: get data from Mysql ??
highlander
Newbie

Posts: 1
Registered: 4/8/2003
Member Is Offline
posted on 4/8/2003 at 06:49 PM Reply With Quote
get data from Mysql ??


Hi, would it be possible to tell scroll.tpl?.js to get its items from an MySql database using php ?

I don't think I am allowed to rename scroll.tpl?.js to *.php and still expect it to work...

any ideas anyone ?

Thanx Highlander..

p.s. great product though..well done
View User's Profile View All Posts By User U2U Member
nik


Posts:
Registered: 1/1/1970
Member Is Offline
posted on 4/9/2003 at 07:54 AM Reply With Quote

Yes, it's possible but you should change code in scroll.html file: insert .php in line 19, position 81.
View User's Profile View All Posts By User U2U Member
montydublin
Junior Member

Posts: 5
Registered: 1/16/2004
Member Is Offline
posted on 1/28/2004 at 06:16 PM Reply With Quote

Higherlander, could you explain a little more about this ..

If you change line 19 position 81 to a .php extention do you need to create a new php file to pull in the data from mysql or should you just edit scroll.html - make it a .php file and enter your code in there.

Many thanks
View User's Profile View All Posts By User U2U Member
alindsay55661
Newbie

Posts: 1
Registered: 9/23/2004
Member Is Offline
posted on 9/23/2004 at 12:42 AM Reply With Quote

This feature is obviously a huge help to anyone looking to use this product. Has anyone accomplished this yet? Please post the results here so we can all benefit from it.
View User's Profile View All Posts By User U2U Member
rock
Moderator

Posts: 687
Registered: 4/15/2003
Member Is Offline
posted on 9/23/2004 at 07:57 AM Reply With Quote

scroll.html changes are:
document.write("<script language='javascript' src='scroll.tpl" + n_id + ".php'><\/script><link rel='stylesheet' href='scroll" + n_id + ".css'>")

instead of

document.write("<script language='javascript' src='scroll.tpl" + n_id + ".js'><\/script><link rel='stylesheet' href='scroll" + n_id + ".css'>")

You could find modified scroll.html (v1.5) and tpl.php sample in the attachment.

Attachment: ts_files.zip (3kb)
This file has been downloaded 1600 times
View User's Profile View All Posts By User U2U Member
jevridon
Member

Posts: 10
Registered: 4/28/2005
Location: Chicago, Illinois
Member Is Offline
posted on 4/28/2005 at 08:24 PM Reply With Quote
Hmm...


This is example is okay, but the example hardly seems to be pulling in content from any kind of server. Is there an example of any rewritten file that actually pulls in data from a database?
View User's Profile View All Posts By User U2U Member
rock
Moderator

Posts: 687
Registered: 4/15/2003
Member Is Offline
posted on 4/29/2005 at 10:44 AM Reply With Quote

Within scroll.tplN.php you could easily write a function to fetch any data from DB or is it an issue?
View User's Profile View All Posts By User U2U Member
jevridon
Member

Posts: 10
Registered: 4/28/2005
Location: Chicago, Illinois
Member Is Offline
posted on 4/29/2005 at 03:42 PM Reply With Quote
Yes


Yes, it is an issue because I need to build a repeat loop into the "scroll.tplN.asp" file. When I've tried a loop before, the code broke. (I did see your other response to my other post - thank you, much! I'm simply responding here so as to cover both bases.)

Example

var LOOK = {
// scroller box size: [width, height]
'size': [150, 100]
},

BEHAVE = {
// autoscroll - true, on-demand - false
'auto': true,
// vertical - true, horizontal - false
'vertical': true,
// scrolling speed, pixels per 40 milliseconds;
// for auto mode use negative value to reverse scrolling direction
'speed': 2
},

// a data to build scroll window content
ITEMS = [
{ // file to get content for item from; if is set 'content' property doesn't matter
// only body of HTML document is taken to become scroller item content
// note: external files require time for loading
// it is RECOMMENDED to use content property to speed loading up
// please, DON'T forget to set ALL IMAGE SIZES
// in either external file or in 'content' string for scroller script
// to be able to estimate item sizes

<%
Do While Not rstSimple.EOF
%>

'file': '',
'content': '<h2>Testing</h2>',
'pause_b': 2,
'pause_a': 1
},
{
'file': '',
'content': 'Second test',
'pause_b': 2,
'pause_a': 1
}
]


Even adding the "<% Do While Not rstSimple.EOF %>" breaks the file.

Is there a solution?

Thank you much.
View User's Profile View All Posts By User U2U Member
rock
Moderator

Posts: 687
Registered: 4/15/2003
Member Is Offline
posted on 4/29/2005 at 04:31 PM Reply With Quote

I don't understand an indtruction "Do While Not rstSimple.EOF" could you post sensible code to analyze
View User's Profile View All Posts By User U2U Member
jevridon
Member

Posts: 10
Registered: 4/28/2005
Location: Chicago, Illinois
Member Is Offline
posted on 4/29/2005 at 06:34 PM Reply With Quote
Got it!


rock,

I apologize about my lack of explanation. After fiddling around with the code, I came up with something that's not entirely dynamic, but will do the trick for as much content as necessary from a database (since it's a scroller, I don't forsee having more than 10 changing items).

<%
Dim cnnSimple ' ADO connection
Dim rstSimple ' ADO recordset
Dim objCounter ' Counter for variable content
Dim title(50)
Dim body(50)

Set cnnSimple = Server.CreateObject("ADODB.Connection")

cnnSimple.Open "Provider=SQLOLEDB;Data Source=xxx.xxx.xxx.xxx;" _
& "Initial Catalog=xxx;User Id=xxx;Password=xxx;" _
& "Connect Timeout=15;Network Library=xxx;", adOpenStatic
%>
<%
Set rstSimple = cnnSimple.Execute("SELECT * FROM announcements ORDER by id")
%>

<%
rstSimple.MoveFirst ' Move to the first record
objCounter = 0

Do While Not rstSimple.EOF

title(objCounter) = rstSimple.Fields("announcement_title")
body(objCounter) = rstSimple.Fields("announcement")

objCounter = objCounter + 1
rstSimple.MoveNext

Loop
%>

<%
rstSimple.Close
Set rstSimple = Nothing
cnnSimple.Close
Set cnnSimple = Nothing
%>

var LOOK = {
// scroller box size: [width, height]
'size': [175, 125]
},

BEHAVE = {
// autoscroll - true, on-demand - false
'auto': true,
// vertical - true, horizontal - false
'vertical': true,
// scrolling speed, pixels per 40 milliseconds;
// for auto mode use negative value to reverse scrolling direction
'speed': 2
},

// a data to build scroll window content
ITEMS = [
{ // file to get content for item from; if is set 'content' property doesn't matter
// only body of HTML document is taken to become scroller item content
// note: external files require time for loading
// it is RECOMMENDED to use content property to speed loading up
// please, DON'T forget to set ALL IMAGE SIZES
// in either external file or in 'content' string for scroller script
// to be able to estimate item sizes
'file': '',
'content': '<b><%Response.Write(title(0))%></b><br /><%Response.Write(body(0))%>',
'pause_b': 2,
'pause_a': 1
},
{

'file': '',
'content': '<b><%Response.Write(title(1))%></b><br /><%Response.Write(body(1))%>',
'pause_b': 2,
'pause_a': 1
},
{
'file': '',
'content': '<b><%Response.Write(title(2))%></b><br /><%Response.Write(body(2))%>',
'pause_b': 2,
'pause_a': 1
},
{
'file': '',
'content': '<b><%Response.Write(title(3))%></b><br /><%Response.Write(body(3))%>',
'pause_b': 2,
'pause_a': 1
}
]


I can keep adding as many scroller items as I need and all will be derived from a database! Yee-haw!

My original intent was to have this very page dynamically generate the 'file': '', 'content':'', etc. items, but I realize that I'm, most likely, barking up the wrong tree. Instead, I decided to settle for a set amount of "content" placement holders (like I said, since it's a scroller, I don't forsee having more than 10 items to scroll) and use those to hold the dynamic database content.
View User's Profile View All Posts By User U2U Member
plucker
Junior Member

Posts: 2
Registered: 4/11/2006
Location: UK
Member Is Offline
posted on 4/11/2006 at 10:27 PM Reply With Quote
Done in ASP


I did this in ASP by writing an ASP script to generate html output driven from a sqlserver 2000 database then referencing the asp file in scroll.tpl0.js. Should be pretty similar in php/mySQL, I think.
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Product Demonstrations Live Demos:
Multiple vertical scrolling
Horizontal scrolling
Free Download Free Download
Product Documentation Documentation:
Documenation Page
Change Log
Support Forum Technical Support
Support Forum
   

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004