Board Logo

Tigra Scroll using a DB Table
zak_boost - 10/30/2004 at 12:03 PM

I saw ur product and It's good.
Is it possible to load the html files from SQL Server database.
For example, as you used 2 html files which contains image/logo of Tigra Scroll and Featurs in another html page and called those files in a JavaScript file.

So, is it possible to keep the html file or the file names is SQL Server Database and load any files according to my record selection. Say I want to show 1.html, 2.html for a specific user who logged in my site and 3.html, 4.html for another specific user who logged in to my site.

I'm using your Tigra Scroller in ASP.Net(C#) .

Thanks


rock - 11/18/2004 at 10:14 AM

If you follow the link http://www.softcomplex.com/forum/viewthread_537/ you could find similar sollution for PHP. In your case you should change '.js' to '.asp'.


jevridon - 4/28/2005 at 08:29 PM

Thanks for the example link, rock. The example given, however, fails to actually pull in records from a database. The given file includes some php coding, but it hardly pulls in any records - it merely tags existing content in the "scroll.tpl1.php" with php tags.

How does one dynamically pull in content into the "scroll.tpl1.php" or "scroll.tpl1.asp" file? I've tried it, but if I make any attempts to insert any ASP coding into the .js file, the file breaks.

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.


rock - 4/29/2005 at 12:11 PM

Try sample of "scroll.tpl1.asp" that works good for me:
<%
Dim items(2)
items(0) = "test1"
items(1) = "test2"
%>
var
LOOK = {
// scroller box size: [width, height]
'size' : [300, 225],
// for on-demand mode: path to image for scrolling items backward
// if relative than to Tscroll_path_to_files
'up' : 'alf.gif',
// for on-demand mode: path to image for scrolling items forward
// if relative than to Tscroll_path_to_files
'dn' : 'art.gif'
},

BEHAVE = {
// if scrolling mode is auto (true / false);
'auto' : true,
// if scrolling direction is vertical (true / false, false means horisontal)
'vertical' : true,
// scrolling speed, pixels per 40 miliseconds;
// for auto mode use negative value to reverse scrolling direction
'speed' : 10
},
// 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' : '',
// string to be displayed as item content,
// is RECOMMENDED to be used as an alternative to 'file' property
'content' : '<%Response.write(items(0))%>',
// pause duration when item top gets top of the scroller box, seconds
'pause_b' : 1,
// pause duration when item bottom gets bottom of the scroller box, seconds
'pause_a' : 0
},
{
'file': '',
'content' : '<%Response.write(items(1))%>',
'pause_b': 1,
'pause_a': 0
}
]


jevridon - 4/29/2005 at 03:38 PM

Thank you, rock. Your quick response and your keen insight is quite invaluable. This is getting close to a workable solution. Now how do I put these items into a repeat loop so as to dynamically place items in the scroller without breaking the scroller coding?


jevridon - 4/29/2005 at 06:36 PM

<%
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.


jevridon - 5/27/2005 at 10:08 PM

Actually, here's a version that's far more efficient and effective at conveying the same thing - without the need for a predetermined number of items.

------------------------------------------------------

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

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

cnnSimple.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Inetpubwwwrootwebsitescroller_test.mdb;" _
& "Persist Security Info=False", adOpenStatic
%>
<%
Set rstSimple = cnnSimple.Execute("SELECT * FROM scroller ORDER by id")
%>

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

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': .75
},

// 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

<%
rstSimple.MoveFirst ' Move to the first record
objCounter = 0
%>
<%
Do While Not rstSimple.EOF

title(objCounter) = rstSimple.Fields("title")
body(objCounter) = rstSimple.Fields("body")
img(objCounter) = rstSimple.Fields("img")

Response.Write "{"
Response.Write Chr(10)
Response.Write "'file': '',"
Response.Write Chr(10)
Response.Write "'content': '"
Response.Write img(objCounter)
Response.Write "<b>"
Response.Write title(objCounter)
Response.Write "</b><br />"
Response.Write body(objCounter)
Response.Write "',"
Response.Write Chr(10)
Response.Write "'pause_b': 2,"
Response.Write Chr(10)
Response.Write "'pause_a': 1"
Response.Write Chr(10)
Response.Write "},"
Response.Write Chr(10)

objCounter = objCounter + 1
rstSimple.MoveNext

Loop
%>

]

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


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