Permalinks in Topic.asp part 2 (beta!) - نوشته شده در (4056 Views)
Retired Support Moderator
MarcelG
مطلب: 2625
2625
This is a new version of this mod. Warning! : this mod is written in half an hour, and has NOT been tested!
Permalink.asp is made from scratch by heart, and not executed at all...(I don't have FTP access to my site to test it). So, it may work right away if I paid attention, but it may just as well fail....bigsmile
What this mod will do is this:
  • it will add a small box with a number in it to the header of each reply. This number is the position of this reply in that topic.
  • it will add a small box with a link showing a permalink (¤) to the header of each post (topic and replies). The permalink will take you to the topic, or to the reply regardless of the pagenumber it's on (for replies) and regardless if it's archived or not (for topics and replies). For people who've implemented the split topic mod, moved replies will also be found using the permalink (except for the startpost, which is in fact a deleted reply that's inserted as a topic)
How to implement it ?
When coming from the previous version of this mod:
Code:
	' DEM --> End of Code added for moderation.	
Response.Write "<font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """> <b><a href=""#" & Reply_ReplyID & """ title=""permalink to this post"">#</a></b> </font>"
with this:
Code:
' DEM --> End of Code added for moderation.	
Response.Write "<span style=""border:1px solid "& strTableBorderColor & ";background-color:white;height=auto;margin:1px;""><font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """> <a href=""#" & Reply_ReplyID & """ title=""jump to this post"">#" & (((mypage-1) * strPageSize) + iForum + 1)& "</a> </font></span>"
Response.Write "<span style=""border:1px solid "& strTableBorderColor & ";background-color:white;height=auto;margin:1px;""><font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """> <a href=""permalink.asp?r" & Reply_ReplyID & """ title=""permalink to this post"">¤</a> </font></span><link rel=""permalink"" href=""permalink.asp?r" & Reply_ReplyID & """ />"

Then, replace this:
Code:
	Response.Write	"<font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """> <b><a href=""#"" title=""permalink to this post"">#</a></b> </font>"	
Response.Write " " & profileLink(getCurrentIcon(strIconProfile,"Show Profile","align=""absmiddle"" hspace=""6"""),TMember_ID) & vbNewLine
by this:
Code:
response.write"<span style=""border:1px solid "& strTableBorderColor & ";background-color:white;height=auto;margin:1px;""><font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """> <a href=""permalink/asp?t" & Topic_ID & """ title=""permalink to this topic"">¤</a> </span><link rel=""permalink"" href=""permalink.asp?t" & Topic_ID & """ /></font></span>"
Response.Write " " & profileLink(getCurrentIcon(strIconProfile,"Show Profile","align=""absmiddle"" hspace=""6"""),TMember_ID) & vbNewLine

Then, finally, download this file, and save it as permalink.asp (remove the .txt extension):

Text File: read permalink.asp.txt 7638 bytes
Again a warning: it has NEVER been tested! At oxle I use a custom 404 to handle the permalinks, so I migrated the code I used there to this code, without the ability to test it.
[edit:first theoretical bugfix cool] [edit 28-7-2008 :bugfix in startpost permalink (permalink/asp?t replaced by permalink.asp?t) cool]<
 پیش‌فرض مرتب‌سازی برای تاریخ DESC به معنی جدیدترین است  
 تعداد در صفحه 
نوشته شده در
Senior Member
leatherlips
مطلب: 1838
1838
I've tried this and there are a few issues.
  • In Firefox if you click the last couple of permalinks they go back up near the top.
  • The ¤ does not show. Instead it is a thick vertical line.
  • The address bar does not show the permalink. The URL shows the original topic thread.
Here is my test forum:

http://www.mangionemagic.com/forumbeta/topic.asp?TOPIC_ID=914

I would like to be able to instead of the number appear for the permalink to instead use an image instead. Also, instead of clicking the link to go to that post, I would like it to bring up a box with the link in it so users could easily copy and paste it. I saw that in this forum:

http://maynardfergusonboard.yuku.com/topic/1785

Just click on the permalinks and you'll see what I mean.
Would these be possible with your permalink?<
نوشته شده در
Senior Member
leatherlips
مطلب: 1838
1838
When I click on the reply permalink link I get this error:

Microsoft VBScript compilation error '800a03f9'

Code:
Expected 'Then'

/forumbeta/permalink.asp, line 40

if left(posttofind),1) = "r" then
It's pointing to after the red comma.
Also, when I click on the topic permalink it takes me to my 404 error page saying the link doesn't exist.<
نوشته شده در
Average Member
phy1729
مطلب: 589
589
remove the extra parens
if left(posttofind,1) = "r" then<
نوشته شده در
Senior Member
leatherlips
مطلب: 1838
1838
Originally posted by phy1729
remove the extra parens
if left(posttofind,1) = "r" then
I did that, but now am getting this error:

Code:
Microsoft VBScript compilation  error '800a0411'

Name redefined

/forumbeta/permalink.asp, line 66

dim topicnumber = linkRec("TOPIC_ID")
<
نوشته شده در
Senior Member
MaD2ko0l
مطلب: 1053
1053
that means that there is 2 instances of dim topicnumber = linkRec("TOPIC_ID") you need to find them both and determine which 1 to get rid of and where they are used on the site.<
© 1999-2010 MaD2ko0l
نوشته شده در
Senior Member
leatherlips
مطلب: 1838
1838
That line is used only once in the permalink.asp file. I have no idea where else it is. I'm only testing this mod. So far, I can't get it to work.<
نوشته شده در
Advanced Member
Carefree
مطلب: 4224
4224
Originally posted by phy1729
remove the extra parens
if left(posttofind,1) = "r" then
I did that, but now am getting this error:

Code:
Microsoft VBScript compilation  error '800a0411'

Name redefined

/forumbeta/permalink.asp, line 66

dim topicnumber = linkRec("TOPIC_ID")

Strip the dim from that line, it should say only:
Code:

					topicnumber = linkRec("TOPIC_ID")
<
نوشته شده در
Senior Member
leatherlips
مطلب: 1838
1838
After stripping out the dim I get this error:

Code:
Microsoft VBScript compilation  error '800a03f9'

Expected 'Then'

/forumbeta/permalink.asp, line 119

elseif left(posttofind),1) = "t" then
I took out the part in red because I thought it might be like the other error above but then got this error:

Code:
ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/forumbeta/permalink.asp, line 48
Line 48 is:

Code:
linkRec.open strSql, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText
<
نوشته شده در
Advanced Member
Carefree
مطلب: 4224
4224
Post a link to a .txt version, there must be another error.<
نوشته شده در
Senior Member
leatherlips
مطلب: 1838
1838
شما باید یک متن وارد کنید