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: Database integration
jevridon
Member

Posts: 10
Registered: 4/28/2005
Location: Chicago, Illinois
Member Is Offline
posted on 4/28/2005 at 08:35 PM Reply With Quote
Database integration


My question:

Can one integrate dynamic database content into the scroller with the scroller pausing between database items?

I saw an earlier reference to this article http://www.softcomplex.com/forum/viewthread_537/ , but, alas, the content is already present within the .js (or renamed .php/.asp) file. This article claims that content can be pulled in from an ASP/PHP file and that's fine, but how does one pull in content from a database and maintain that content as separate scroll items?
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:36 PM Reply With Quote
My own answer...


<%
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
jevridon
Member

Posts: 10
Registered: 4/28/2005
Location: Chicago, Illinois
Member Is Offline
posted on 5/27/2005 at 10:08 PM Reply With Quote
Condensed version


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:\Inetpub\wwwroot\website\scroller_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
%>
View User's Profile View All Posts By User U2U Member
VermontTech
Newbie

Posts: 1
Registered: 12/6/2006
Location: Vermont
Member Is Offline
posted on 12/6/2006 at 02:22 PM Reply With Quote
More explanation requested please...


Quote:
Originally posted by jevridon
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.


I copied the above code and pasted it into the scroll.tpl0.js file and renamed that file to scroll.tpl0.asp then I renamed the instance of scroll.tpl0.js in the scroll.html file but the page still does not work. I browsed to the scroll.tpl0.asp file with a browser and it is displaying the data as follows...

TRUNCATED

{ 'file': '', 'content': 'Outside view rs.JPG2613562
150000', 'pause_b': 2, 'pause_a': 1 }, { 'file': '', 'content': 'kitchen.jpg2602409
149900', 'pause_b': 2, 'pause_a': 1 }, { 'file': '', 'content': 'Inside 1.jpg2609325
199900', 'pause_b': 2, 'pause_a': 1 }, { 'file': '', 'content': 'kitchen(1).jpg2609588
69900', 'pause_b': 2, 'pause_a': 1 },

Which in all appearances looks like it is correct. I get a javascript error saying item[...].height is null or not an object.

I would really appreciate any feedback anyone can give me here, I would love to get this to work on a site. I am using the sample1 files, could that be the issue? Is this code written for a different set of sample files?

Thanks So Much

JW
View User's Profile View All Posts By User U2U Member
nosaosahon
Junior Member

Posts: 2
Registered: 4/2/2012
Location: Lagos Nigeria
Member Is Offline
posted on 4/2/2012 at 05:05 PM Reply With Quote
Page Refresh


Please can you help me out. I have been able to pull data from DB to my scroller, but on my page, it does not refresh except I use the html meta content refresh command before the new information will be seem on the page. I do not like this, I expect that internally, the scroller will be doing the refresh
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Tigra Scroller
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
   
Tigra Scroller PRO
Product Demonstrations Live Demos
Vertical automatic scrolling
Horizontal manual scrolling
Product Documentation Documentation
Documenation Page
Change Log
Support Forum Technical Support
Support Forum
Customer Care System
Order Now ORDER NOW!
Add to Cart
View Cart
 

Go To Top


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