Author |
Topic |
|
rgrund
Junior Member
Austria
206 Posts |
Posted - 29 July 2003 : 04:02:30
|
Hello,
I have seen that many have asked that instead of the drop down menu for the page selection they would like to have the following:
Total Pages (2):[ [1] 2 ]
Here is now the script which you need to put into the forum.asp.
'##############################################
'## New Function which is not a DropDown but
'## we keep the functions name so that it works
'## with Snitz
'###############################################
sub DropDownPaging(fnum)
if maxpages > 1 then
if mypage = "" then
pge = 1
else
pge = mypage
end if
Response.Write " <td><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine
if fnum = 1 then
Response.Write(" <b>Page:</b> [")
else
Response.Write(" <b>Total Pages (" & maxpages &"):</b>[")
end if
for counter = 1 to maxpages
if counter <> cLng(pge) then
Response.Write "<a href=""forum.asp?whichpage=" & counter & "&FORUM_ID=" & Forum_ID &"&sortfield=" & strtopicsortfld & "&sortorder=" & strtopicsortord
If ArchiveView = "true" then
Response.Write "&ARCHIVE=" & ArchiveView
End If
Response.Write """> " & counter & " </a>"
else
Response.Write " <b>[" & counter & "]</b>"
end if
next
Response.Write " ]"
Response.Write("</font></td>" & vbNewLine)
end if
end sub
'#################################################
How to install: 0. Open the file forum.asp 1. Look for the function sub DropDownPaging(fnum) 2. Rename this function to DropDownPaging2(fnum) 3. Copy the new function (it has the same name) below theold one. 4. Save and you are set
Best regards, Bob
|
Internet should be OPENSOURCEd! |
Edited by - rgrund on 29 July 2003 04:12:41 |
|
mortioli
Average Member
United Kingdom
898 Posts |
Posted - 29 July 2003 : 10:20:20
|
Just a quick question...
If you have a topic with, for example, 100 pages, will it stretch the page quite a lot to show the links to every page? |
|
|
AWD_ENVY
Junior Member
103 Posts |
Posted - 29 July 2003 : 10:36:10
|
Works good.... Thanks
Made some minor changes to the astetics of it for my users, and broke up the list of numbers for easier selection/viewing. Figured I'd post it, incase others felt the same.
'##############################################
'## New Function which is not a DropDown but
'## we keep the functions name so that it works
'## with Snitz
'###############################################
sub DropDownPaging(fnum)
if maxpages > 1 then
if mypage = "" then
pge = 1
else
pge = mypage
end if
Response.Write "<td><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine
if fnum = 1 then
Response.Write("<b>Page:</b> ")
else
Response.Write("<b>Total Pages (" & maxpages &"):</b>")
end if
for counter = 1 to maxpages
if counter <> cLng(pge) then
Response.Write " | <a href=""forum.asp?whichpage=" & counter & "&FORUM_ID=" & Forum_ID &"&sortfield=" & strtopicsortfld & "&sortorder=" & strtopicsortord
If ArchiveView = "true" then
Response.Write "&ARCHIVE=" & ArchiveView
End If
Response.Write """>" & counter & "</a>"
else
Response.Write " |<b> [" & counter & "]</b>"
end if
next
Response.Write ""
Response.Write("</font></td>" & vbNewLine)
end if
end sub
'################################################# |
|
|
rgrund
Junior Member
Austria
206 Posts |
Posted - 30 July 2003 : 02:16:26
|
mortioli,
currently all numbers are shown, but I will make still a better MOD on this side, so that it will only show ten numbers (pages) each time.
Bob |
Internet should be OPENSOURCEd! |
|
|
rgrund
Junior Member
Austria
206 Posts |
Posted - 31 July 2003 : 10:51:45
|
Hi,
this is now the function which will only show page number defined within the function. Default is currently set to 10.
Could some one test this out. I do not have so many entries in my database and can therefore not test it out if the "<< First" and the ">> Last" section will show up.
'##############################################
'## New Function which is not a DropDown but
'## we keep the functions name so that it works
'## with Snitz
'###############################################
sub DropDownPaging(fnum)
if maxpages > 1 then
if mypage = "" then
pge = 1
else
pge = mypage
end if
Response.Write " <td><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine
if fnum = 1 then
Response.Write(" <b>Page:</b> [")
else
Response.Write(" <b>Total Pages (" & maxpages &"):</b>[")
end if
'We define the range to show
'we will currently only show 10 pages as the default
PagesToShow = 10
If cLng(pge) > 1 then
MinPageToShow = cLng(pge) - 1
Else
MinPageToShow = 1
End If
If cLng(pge) + PagesToShow > maxpages then
MaxPageToShow = maxpages
Else
MaxPageToShow = cLng(pge) + PagesToShow
End If
If MaxPageToShow < maxpages then
ShowMaxPage = True
Else
ShowMaxPage = False
End If
If MinPageToShow > 1 then
ShowMinPage = True
Else
ShowMinPage = False
End If
If ShowMinPage then
Response.Write "<a href=""forum.asp?whichpage=1&FORUM_ID=" & Forum_ID &"&sortfield=" & strtopicsortfld & "&sortorder=" & strtopicsortord
Response.Write """> << First </a>"
End If
for counter = MinPageToShow to MaxPageToShow
if counter <> cLng(pge) then
Response.Write "<a href=""forum.asp?whichpage=" & counter & "&FORUM_ID=" & Forum_ID &"&sortfield=" & strtopicsortfld & "&sortorder=" & strtopicsortord
If ArchiveView = "true" then
Response.Write "&ARCHIVE=" & ArchiveView
End If
Response.Write """> " & counter & " </a>"
else
Response.Write " <b>[" & counter & "]</b>"
end if
next
If ShowMaxPage then
Response.Write "<a href=""forum.asp?whichpage=" & maxpages & "&FORUM_ID=" & Forum_ID &"&sortfield=" & strtopicsortfld & "&sortorder=" & strtopicsortord
Response.Write """> >> Last </a>"
End If
Response.Write " ]"
Response.Write("</font></td>" & vbNewLine)
end if
end sub
'#################################################
Just follow the same instruction as above, if you want to use this function.
Best regards,
Bob |
Internet should be OPENSOURCEd! |
Edited by - rgrund on 31 July 2003 10:54:22 |
|
|
Uzzio
Starting Member
46 Posts |
Posted - 12 September 2003 : 03:15:12
|
Ok...one more question : how can I have it to display the numbers like this :
Total pages (13): [ « 1 [2] 3 4 5 6 7 8 9 10 11 12 13 » ]
With no understrike for the numbers?also I would like to have also "Total pages" and the number in the brackets to be displayed in the font color like the numbers(id like to use the font color that is used in the text for messages), not in black!How do I modify this?thank you! |
Edited by - Uzzio on 12 September 2003 03:16:50 |
|
|
Uzzio
Starting Member
46 Posts |
Posted - 12 September 2003 : 03:40:21
|
If it can help, here is the code I just tried to arrange to display the nubers instead of the drop down box in TOPIC.ASP (so, inside the topic not in the forum). It works, ok, but I dont know what it may happen with a long thread with many pages (in my forum I have only up to 8..). I go and try to implement something as rgrund did for the topic to...
ps I edit this code and insert the new one it works but it would be nicer if it could be taken out of the discussion table and put on the left, above the table.I tried to do it but made a mess...could you tell me where to move the call to this sub so that it displays the page selection where I told above? thanks!
sub DropDownPaging(fnum)
if maxpages > 1 then
if mypage = "" then
pge = 1
else
pge = mypage
end if
scriptname = request.servervariables("script_name")
'Response.Write(" <form name=""PageNum" & fnum & """ action=""topic.asp"">" & vbNewLine)
Response.Write(" <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """>" & vbNewLine)
if Archiveview = "true" then Response.Write(" <input type=""hidden"" name=""ARCHIVE"" value=""" & ArchiveView & """>" & vbNewLine)
Response.Write(" <input type=""hidden"" name=""TOPIC_ID"" value=""" & Request("TOPIC_ID") & """>" & vbNewLine)
Response.Write(" <b>Pagina: </b> [")
'We define the range to show
'we will currently only show 10 pages as the default
PagesToShow = 4
If cLng(pge) > 1 then
MinPageToShow = cLng(pge) - 1
Else
MinPageToShow = 1
End If
If cLng(pge) + PagesToShow > maxpages then
MaxPageToShow = maxpages
Else
MaxPageToShow = cLng(pge) + PagesToShow
End If
If MaxPageToShow < maxpages then
ShowMaxPage = True
Else
ShowMaxPage = False
End If
If MinPageToShow > 1 then
ShowMinPage = True
Else
ShowMinPage = False
End If
If ShowMinPage then
Response.Write "<a href=""topic.asp?TOPIC_ID=" & TOPIC_ID & "&whichpage=1"
Response.Write """> « </a>"
End If
for counter = MinPageToShow to MaxPageToShow
if counter <> cLng(pge) then
Response.Write "<a href=""topic.asp?TOPIC_ID=" & TOPIC_ID & "&whichpage=" & counter
If ArchiveView = "true" then
Response.Write "&ARCHIVE=" & ArchiveView
End If
Response.Write """> " & counter & " </a>"
else
Response.Write " <b>[" & counter & "]</b>"
end if
next
If ShowMaxPage then
Response.Write "<a href=""topic.asp?TOPIC_ID=" & TOPIC_ID & "&whichpage=" & maxpages
Response.Write """> » </a>"
End If
Response.Write " ]"
Response.Write("</font>" & vbNewLine)
end if
end sub |
Edited by - Uzzio on 12 September 2003 05:06:56 |
|
|
Uzzio
Starting Member
46 Posts |
Posted - 10 October 2003 : 02:28:39
|
anyone? ? |
|
|
rgrund
Junior Member
Austria
206 Posts |
Posted - 11 October 2003 : 15:12:35
|
Hi Uzzio, let me look into it! Should be easy! Bob |
Internet should be OPENSOURCEd! |
|
|
rgrund
Junior Member
Austria
206 Posts |
Posted - 11 October 2003 : 15:34:41
|
Hi Uzzio,
1. open the file forum.asp 2. look for " <table border=""0"" align=""right"">" & vbNewLine & _ " <tr>" & vbNewLine Call DropDownPaging(1)
3. Change the align=""right"" to align =""left""
that should do it.
Bob |
Internet should be OPENSOURCEd! |
|
|
Uzzio
Starting Member
46 Posts |
Posted - 13 October 2003 : 02:31:21
|
quote: Originally posted by rgrund
Hi Uzzio,
1. open the file forum.asp 2. look for " <table border=""0"" align=""right"">" & vbNewLine & _ " <tr>" & vbNewLine Call DropDownPaging(1)
3. Change the align=""right"" to align =""left""
that should do it.
Bob
Thnk you :D I am really idiot with ASP I made a mess with a thousand tries before to givew up, seems I really dont understand the way these tables work :( |
|
|
Uzzio
Starting Member
46 Posts |
Posted - 13 October 2003 : 02:39:03
|
PS did you manage to insert this also in topic.asp e not only in forum.asp? |
|
|
|
Topic |
|