Permalinks in Topic.asp part 2 (beta!)

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/67337?pagenum=1
05 November 2025, 18:31

Topic


MarcelG
Permalinks in Topic.asp part 2 (beta!)
24 June 2008, 10:18


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]<

 

Replies ...


leatherlips
09 July 2008, 18:49


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?<
leatherlips
25 July 2008, 20:20


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.<
phy1729
25 July 2008, 21:31


remove the extra parens
if left(posttofind,1) = "r" then<
leatherlips
25 July 2008, 21:59


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")
<
MaD2ko0l
25 July 2008, 22:14


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.<
leatherlips
25 July 2008, 22:20


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.<
Carefree
25 July 2008, 22:34


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")
<
leatherlips
25 July 2008, 22:39


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
<
Carefree
25 July 2008, 22:46


Post a link to a .txt version, there must be another error.<
leatherlips
26 July 2008, 08:11


Here it is. It's the exact same one that is posted at the top of this thread for download.<
Carefree
26 July 2008, 12:09


Try this, Leather:

Code:

Replaced - see below
<
leatherlips
26 July 2008, 14:46


Sorry Carefree, no luck.
I'm now getting this error:

Code:
Microsoft VBScript runtime  error '800a01a8'

Object required: ''

/forumbeta/permalink.asp, line 49
You can go here to see how it behaves:

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

I had to change the ¤ to a * on mine because the ¤ never shows. It just puts a thick vertical line in its place and is unclickable.
<
Carefree
26 July 2008, 22:41


Carefree
26 July 2008, 22:54


For those who want to use their css and/or theme colors, here's how the topic.asp lines need to read:

Find this line (appx 789):

Code:

	Response.Write	"                       " & profileLink(getCurrentIcon(strIconProfile,"Show Profile","align=""absmiddle"" hspace=""6"""),TMember_ID) & vbNewLine
Above it, insert this:
Code:

		Response.Write"<span style=""border:0px solid "& strTableBorderColor & ";height=auto;margin:1px; bgcolor=""" & strForumFirstCellColor & """><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>"

Find these (lines appx 585-586):
Code:

			' DEM --> End of Code added for moderation.
			Response.Write	"                       " & profileLink(getCurrentIcon(strIconProfile,"Show Profile","align=""absmiddle"" hspace=""6"""),Reply_MemberID) & vbNewLine
Between them, insert these:
Code:

				Response.Write	"<span style=""border:0px solid "& strTableBorderColor & ";height=auto;margin:1px; bgcolor=""" & strForumFirstCellColor & """><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:0px solid "& strTableBorderColor & ";height=auto;margin:1px; bgcolor=""" & strForumFirstCellColor & """><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 & """ />"

This should make your icon symbols blend with the existing backgrounds.<
leatherlips
27 July 2008, 08:28


The newer code worked better.
However, when I split the topic (with the split topic mod) and moved one of the replies to its own topic, it's permalink no longer works and I get this error:

Code:
Microsoft VBScript runtime  error '800a01a8'

Object required: ''

/forumbeta/permalink.asp, line 60

Also clicking on its new permalink topic link I get a 404 page not found error.<
Carefree
27 July 2008, 11:23


leatherlips
27 July 2008, 13:16


I'm not getting any errors, but either I don't understand what it is supposed to do or it doesn't work.
For example:

I had a reply that had this URL -
http://www.mangionemagic.com/forumbeta/topic.asp?topic_id=914#5443

In the status bar in the lower left corner of IE when hovering over the permalink it displayed this url -
http://www.mangionemagic.com/forumbeta/permalink.asp?r5443

I then split that reply to its own topic and it became -
http://www.mangionemagic.com/forumbeta/topic.asp?TOPIC_ID=917

Now the original permalink can not find that reply. Does that make sense?
Also, clicking on the topic permalink still goes to a 404 error page.<
MarcelG
28 July 2008, 03:54


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)

The 404 ; your startpost permalink goes to http://www.mangionemagic.com/forumbeta/permalink/asp?t914 instead of http://www.mangionemagic.com/forumbeta/permalink.asp?t914
(So, a / instead of a .)
Replace this:
Code:
permalink/asp?t
with this:
Code:
permalink.asp?t
I've updated the startpost.<
Carefree
28 July 2008, 04:14


Well, I remember the /asp error - but it doesn't exist in the file I posted ...<
leatherlips
28 July 2008, 08:06


Originally posted by Carefree
Well, I remember the /asp error - but it doesn't exist in the file I posted ...
You're right. The /asp error is in MarcelG's code at the top of this topic. I changed the /asp to .asp but now instead of getting the 404 error, the permalink takes me to default.asp.<
MarcelG
28 July 2008, 10:15


all your permalinks take you to default.asp....something wrong in permalink.asp ?<
leatherlips
28 July 2008, 10:24


Only the topic permalink takes me to default.asp. The replies seem to work.<
MarcelG
29 July 2008, 05:08


Sorry, but http://www.mangionemagic.com/forumbeta/permalink.asp?r5433 takes me to default.asp as well, while it should take me to http://www.mangionemagic.com/forumbeta/topic.asp?topic_id=914#5433
<
leatherlips
29 July 2008, 08:33


That's odd. Both links take me to the reply when I clicked on them.<
Carefree
29 July 2008, 11:38


They work properly for me, also.<
Classicmotorcycling
29 July 2008, 16:27


There is an issue where if the reply is is not on the first page of the topic then it will not go to the reply, but just to the topic. As an example using the same topic that is spread over 2 pages:

Main Topic Reply on Page 1 Reply on Page 2 - puts you at the top of the main topic
<
MarcelG
30 July 2008, 04:10


This is getting stranger by the minute...those last two links take me to default.asp, and not to a reply or even to a specific topic. Which version of permalink.asp are you using?<
Classicmotorcycling
30 July 2008, 04:58


Carefree
30 July 2008, 05:50


© 2000-2021 Snitz™ Communications