Author |
Topic |
|
DoraMoon
Average Member
Taiwan
661 Posts |
Posted - 16 August 2002 : 04:05:20
|
for those who usually shocked by this message "No Topics Found !" then bawled out - Why The Posts ALL Disappear !!?? (umm... it really happen to me often ~ )
modification of forum.asp: (base on original Snitz 3.3.05 file)
- in line.76 change these section if nDays = "" then nDays = 30 end if
to this if nDays = "" or nDays = 30 then nDays = getnDays(Forum_ID) end if
then move these three lines to place below these <!--#INCLUDE FILE="inc_moderation.asp" --> <%
- in line.100 fine this line defDate = DateToStr(dateadd("d",-(nDays),strForumTimeAdjust))
then also move it to be after above modified section..
so after these change, it should look like these.. <!--#INCLUDE FILE="inc_moderation.asp" --> <% if nDays = "" or nDays = 30 then nDays = getnDays(Forum_ID) end if
defDate = DateToStr(dateadd("d", -(nDays), strForumTimeAdjust))
if strPrivateForums = "1" then
- the last step, add this function to bottom of forum.asp file. (make sure this MUST before the ending %>)
function getnDays(ForumID)
strSql = " SELECT " & strTablePrefix & "FORUM.F_LAST_POST, " & strTablePrefix & "FORUM.F_TOPICS " strSql = strSql & " FROM " & strTablePrefix & "FORUM " strSql = strSql & " WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & ForumID set rsnDays = my_Conn.Execute (strSql)
dim lastdays lastdays = DateDiff("d", StrToDate(rsnDays("F_LAST_POST")), Now)
if rsnDays("F_TOPICS") > 0 and lastdays > 30 then ' change below value to match your select box in <select name="Days".... ' (only the period longer than 30 days need to be added here) if lastdays < 60 then getnDays = 60 elseif lastdays < 120 then getnDays = 120 ' elseif lastdays < 180 then ' getnDays = 180 elseif lastdays < 365 then getnDays = 365 else getnDays = 0 end if else getnDays = 30 end if
rsnDays.Close set rsnDays = nothing
end function %>
- That's All ...
p.s. i did'nt touch the Cookie setting, coz i think the cookie will affect ALL forum.. and i really not sure it's necessary or not to set the cookie after my these modification ?
|
~......~.~~ |
Edited by - DoraMoon on 16 August 2002 04:10:25 |
|
Etymon
Advanced Member
United States
2385 Posts |
Posted - 22 August 2002 : 05:29:53
|
Hi DoraMoon!
Could you please provide a screenshot of what this modification will look like?
Thanks so much,
Etymon
|
|
|
DoraMoon
Average Member
Taiwan
661 Posts |
Posted - 22 August 2002 : 06:51:41
|
quote: Originally posted by Etymon Could you please provide a screenshot of what this modification will look like?
Hi~~ Etymon
i don't know how to "screenshot" this stupid mod... but it really a very small addon and simple function..
when we click into a forum, it will show the last topics [/b]in 30 days[/b] by default. if there are no new posts in this 30 days, then he will show us the message "NO Topics Found"...
and this small modification, it just "automatically" select the period that at least Have posts in this forum for users. for example, if the last post is on 50 days ago, then it'll set the "default" show period to "in last 60 days"...
so you'll never see the "No Topics Found!" again... <edit> except it REALLY no topic in there...</edit>
that's all... i know it really a stupid mod, but coz my forum not work online continuitily.. so it's something useful for me, otherwise i usually shocked and got this old question: "Why my topics disappear ???"...
|
~......~.~~ |
Edited by - DoraMoon on 22 August 2002 07:23:09 |
|
|
Etymon
Advanced Member
United States
2385 Posts |
Posted - 22 August 2002 : 21:58:23
|
No, actually from the way you explained it, this MOD is a very friendly and useful MOD ... not a stupid one at all.
Thanks, I will implement it next chance I get!
Cheers,
Etymon
|
|
|
Schwanke
New Member
77 Posts |
Posted - 23 August 2002 : 03:18:03
|
Any changes for doing the mod for 3.4?
|
<>< |
|
|
DoraMoon
Average Member
Taiwan
661 Posts |
Posted - 23 August 2002 : 09:46:37
|
hi~ i still not ready upgrad to 3.4... it should take me a long time to figure out the new features of 3.4....
and regarding this small mod... see this post http://forum.snitz.com/forum/topic.asp?TOPIC_ID=29345
i found this line in new 3.4 forum.asp nDays = rsCFStatus("F_DEFAULTDAYS")
set the default nDays, now should be a build-in option for Admin or users.... i think u can set a suitable value to fit your need in 3.4, not anymore only default 30 days now ~
so i think this mod should be no longer necessary in 3.4... |
~......~.~~ |
|
|
DoraMoon
Average Member
Taiwan
661 Posts |
Posted - 23 August 2002 : 14:49:28
|
update/fix one line....
this line if nDays = "" or nDays = 30 then
seem should be change to this if nDays = "" or nDays = "30" then
i forgot why i need to add "or nDays = 30" at first time.... i think something cookie stuff still not really understand well for me...
|
~......~.~~ |
|
|
Etymon
Advanced Member
United States
2385 Posts |
Posted - 24 August 2002 : 22:18:03
|
Thanks for the update, DoraMoon!
|
|
|
DoraMoon
Average Member
Taiwan
661 Posts |
Posted - 25 August 2002 : 14:50:46
|
quote: Originally posted by DoraMoon i forgot why i need to add "or nDays = 30" at first time.... i think something cookie stuff still not really understand well for me...
hi~ i'm afraid that i need to update this line again.. (sorry, for Etymon... )
i test this again & again, it seem really No Need to add "or nDays = 30" on my previous code. so this line if nDays = "" or nDays = 30 then should be return to its original code if nDays = "" then
and i try to figure out why i added this before.. i think it's coz when i test it at first time, the "nDays=30" already wrote in cookie... so i just add this section to make it work nomally..
maybe i should remind this point: * if u want to try this mod, make sure u clear the browser cookie first! * and the cookie setting is high priority than this mod. it's mean if you choose a period from select box, than this mod is not work anymore, it will according your select to all forums.
i'm not sure which solution is better~ but for my situation.. i have a small forum and not many posts..(compare with Snitz here, mine really a SUPER MINI forum~~) so for me, maybe i'll consider comma this line to diable cookie working.. 'nDays = Request.Cookies(strCookieURL & "NumDays") then use my "no more" solution...
|
~......~.~~ |
|
|
DoraMoon
Average Member
Taiwan
661 Posts |
Posted - 26 August 2002 : 05:15:55
|
do a little change again~~~~
in getnDays function.. this line lastdays = DateDiff("d", StrToDate(rsnDays("F_LAST_POST")), Now) i modify it to lastdays = DateDiff("d", StrToDate(rsnDays("F_LAST_POST")), Now) + 15
it will prevent from this situation happened.. if the last post date in a forum is 59 days ago, then by previous code it will "auto" set the nDays to 60. but this could be only one or two topics shown on forum page, it's not good.. so i add a time period.. in above case, instead 60, it will set to next option 120. i think it will be more resonable then previous doing.
anyway, i think it's very flexible. if someone try this, u can define different value to make it suitable to your forum.
|
~......~.~~ |
|
|
|
Topic |
|