Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 MOD: Random text or html code!
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

pox
Junior Member

Denmark
110 Posts

Posted - 26 July 2001 :  09:20:34  Show Profile  Visit pox's Homepage
####Who?####################################################
## Random Text MOD for snitz forum by Nikolai Vohnsen ##
## ##
## This is the first MOD i have ever made! and im a ##
## asp newbie, feel free to give me some feedback! ##
## ##
## if you god any problems pleace dont email me ##
## write in in here -> ##
## ##
####What?###################################################
## This script creates a random text or html a the top ##
## of the forum! Simple =) ##
## ##
####How?####################################################

(1) Unzip all the files in your forum dir!


(2) Open Default.asp and put at the top
<!--#INCLUDE FILE="random.asp" -->

Mine looks like this :

'## Snitz Communications
'## C/O: Michael Anderson
'## PO Box 200
'## Harpswell, ME 04079
'############################################################
%>
<!--#INCLUDE FILE="random.asp" -->
<!--#INCLUDE FILE="config.asp" -->
<!--#INCLUDE FILE="inc_functions.asp" -->
<!--#INCLUDE FILE="inc_top.asp" -->
<!--#include file="privatemess.asp"-->


(3) Edit randomtip.txt to the random tips you want!

NOTE: remember you have to edit rendom.asp if you want les or more than 10 tips

edit this line:

intTipNummer = Int(Rnd*10)

you can also edit in random.asp the location to the randomtip.txt

edit this line:

Set objInStream = objFile.OpenTextFile (Server.MapPath("/forum/randomtip.txt"), ForReading, False, False)

Enjoy

Pleace report bugs here


Download http://www.nikolai.subnet.dk/mods/randomtext.zip
e-mail vohnsen@hotmail.com

Pleace send me some feedback! this is my first MOD and im a totalt asp newbie thanks.



NOTE: you can also use it to banners

Edited by - pox on 30 July 2001 05:26:55

Kat
Advanced Member

United Kingdom
3065 Posts

Posted - 26 July 2001 :  09:24:32  Show Profile  Visit Kat's Homepage
Do you have a demo we can look at?

KatsKorner
Go to Top of Page

pox
Junior Member

Denmark
110 Posts

Posted - 26 July 2001 :  09:35:41  Show Profile  Visit pox's Homepage
quote:

Do you have a demo we can look at?

KatsKorner




Nope i dont have a web-host to my community! sorry!

Go to Top of Page

Cyber Paladin
New Member

55 Posts

Posted - 26 July 2001 :  10:00:23  Show Profile  Visit Cyber Paladin's Homepage
It's fairly easy stuff. I've done it a thousand times before. :)

I tried your code and well I found that if you didn't have that exact 10 lines in there the page would get an error. So, if don't mind I altered your random.asp page so that it reads the number of lines from the text file and randomly picks a tip from that number. If it were me i probably would have had the tips in their own table in the database and read from that, but this works just the same. :)

Anyways, here's the altered code from random.asp:

------ Random.asp -------


<center><font face="arial" size="1" color="black" size="+1">
<%
Const ForReading = 1
Dim intCount, strRandomTip, objFile, objInStream, intTipNummer, intLoop

Randomize timer

' Åbner tekstfilen som indeholder 10 tips
Set objFile = Server.CreateObject("Scripting.FileSystemObject")
Set objInStream = objFile.OpenTextFile (Server.MapPath("/forum/randomtip.txt"), ForReading, False, False)


do while not objInStream.AtEndOfStream '## Count number of lines in text file
intCount = intCount + 1
objInStream.SkipLine()
loop

objInStream.Close '## Close File so it can be opened again


intTipNummer = Int((RND * intCount) + 1) '## Randomly pic a line out of those available


Set objInStream = objFile.OpenTextFile (Server.MapPath("/forum/randomtip.txt"), ForReading, False, False)

for intLoop = 1 to intCount '## Skip over lines until the right one is found.
if intLoop = intTipNummer then strRandomTip = objInStream.ReadLine : exit for '## Read the correct line

objInStream.SkipLine()
if objInStream.AtEndOfStream then strRandomTip = "No Tips Available at this time." : exit for
next


objInStream.Close
Set objInStream = Nothing
intCount = 0

Response.Write "Tip #" & intTipNummer & ": <i>" & strRandomTip & "</i>"
%>
</font></center>


Go to Top of Page

pox
Junior Member

Denmark
110 Posts

Posted - 26 July 2001 :  10:04:14  Show Profile  Visit pox's Homepage
quote:

It's fairly easy stuff. I've done it a thousand times before. :)

I tried your code and well I found that if you didn't have that exact 10 lines in there the page would get an error. So, if don't mind I altered your random.asp page so that it reads the number of lines from the text file and randomly picks a tip from that number. If it were me i probably would have had the tips in their own table in the database and read from that, but this works just the same. :)

Anyways, here's the altered code from random.asp:

------ Random.asp -------


<center><font face="arial" size="1" color="black" size="+1">
<%
Const ForReading = 1
Dim intCount, strRandomTip, objFile, objInStream, intTipNummer, intLoop

Randomize timer

' Åbner tekstfilen som indeholder 10 tips
Set objFile = Server.CreateObject("Scripting.FileSystemObject")
Set objInStream = objFile.OpenTextFile (Server.MapPath("/forum/randomtip.txt"), ForReading, False, False)


do while not objInStream.AtEndOfStream '## Count number of lines in text file
intCount = intCount + 1
objInStream.SkipLine()
loop

objInStream.Close '## Close File so it can be opened again


intTipNummer = Int((RND * intCount) + 1) '## Randomly pic a line out of those available


Set objInStream = objFile.OpenTextFile (Server.MapPath("/forum/randomtip.txt"), ForReading, False, False)

for intLoop = 1 to intCount '## Skip over lines until the right one is found.
if intLoop = intTipNummer then strRandomTip = objInStream.ReadLine : exit for '## Read the correct line

objInStream.SkipLine()
if objInStream.AtEndOfStream then strRandomTip = "No Tips Available at this time." : exit for
next


objInStream.Close
Set objInStream = Nothing
intCount = 0

Response.Write "Tip #" & intTipNummer & ": <i>" & strRandomTip & "</i>"
%>
</font></center>







thanks.. well im am a asp newbie ;)

No Signature!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.14 seconds. Powered By: Snitz Forums 2000 Version 3.4.07