Gallery MX
MXMANIA Gallery MX FOR DREAMWEAVER
Free Applications
Album MX Basic
Calendar MX Basic
Asp Upload-Resize...
Private Messaging
User Tracking
Mail Multiple Users
Batch Update/ Delete
File Upload Manager
MXMANIA FILE UPLOAD MANAGER FOR DREAMWEAVER
Fading Scroller from Database Field (ASP/Vbscript):
Latest News
In this tutorial we will force the Fading Scroller show the Database Content. Before we start i want you to know that the Fading Scroller Script is originally from DynamicDrive.com and heavily modified beyond recognition by MaximumASP.
We are going to make small modifications to show database content.
I will not write the Script here you can download the .zip file in which the working Files and Access Database Sample is included.

So first of all define your Recordset e.g. rsFscroller

<!--#include file="Connections/ConFscroller.asp" -->
<%
Dim rslatest
Dim rslatest_numRows
Set rslatest = Server.CreateObject("ADODB.Recordset")
rslatest.ActiveConnection = MM_ConFscroller_STRING
rslatest.Source = "SELECT fld_News FROM tbl_News"
rslatest.CursorType = 0
rslatest.CursorLocation = 2
rslatest.LockType = 1
rslatest.Open()
rslatest_numRows = 0
%>

Define your Repeat region:

<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rslatest_numRows = rslatest_numRows + Repeat1__numRows
%>

Now comes the tricky Part, please mind the breaks in the code:

<%
//here we make sure that the Recordset is not empty
If Not rslatest.EOF And Not rslatest.BOF Then

//declaration and initialisation of variable var & i
dim varFscroller, i
varFscroller = ""
i = 0
While ((Repeat1__numRows <> 0) AND (NOT rslatest.EOF))
i=i+0

varFscroller = varFscroller & "fcontent[" & i & " ]=" & "'" & (rslatest.Fields.Item("fld_News").Value) & "'" & vbCrLf

Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
i=i+1
rslatest.MoveNext()
Wend
end if
%>

Now let me explain you what we did in the above code.

In order to work, the Fading Script wants the data input in the Form shown below inside the script:

fcontent[0]='New Tutorial released'
fcontent[1]='i hate scripting'
fcontent[2]..... and so on...

So we collected the data from the database modified them the way Script wants it and stuffed them in the Variable "varFscroller", in my case i have collected the Data from the Field "fld_News". You can replace the Field:

(rsFscroller.Fields.Item("fld_News").Value)
with yours.

I know there are some points which are not clear so what now? It is your turn now!
Download the sample files open the file "fscroller.htm" and follow the instructions.
If you still have problems or question post them in the Mxmania Forum.

 

 

Calendar MX Pro
MXMANIA CALENDAR MX PROFESSIONAL FOR DREAMWEAVER
Useful Tutorials
Bandwidth Redirect
Extra session variables
Insert in2 Multiple Table
Regional Date Format
Form Validation
Update multiple records
Nested repeats
Extending Dreamweaver
Intro to SSI
Database Driven Menu