Author |
Topic |
Da_Stimulator
DEV Team Forum Moderator
USA
3373 Posts |
Posted - 25 October 2001 : 01:49:47
|
Subject says it, show page that your on in the title bar when loaded... a few simple changes marked below.
Inc functions.asp - top of file after comments
Function GetNewTitle(strTempScriptName) Dim StrTempScript Dim strNewTitle arrTempScript = Split(strTempScriptName, "/") strTempScript = arrTempScript(Ubound(arrTempScript)) strTempScript = lcase(strTempScript) Select Case strTempScript Case "topic.asp"
strTempTopic = request.querystring("TOPIC_ID")
if not(strTempTopic = "") then if request.querystring("archive") = "true" then strsql = "SELECT T_SUBJECT, FORUM_ID FROM " & strActivePrefix & "TOPICS WHERE TOPIC_ID=" & strTempTopic set ttopics = my_conn.execute(strsql) strTempTopicTitle = ttopics("T_SUBJECT") strTempForum = ttopics("FORUM_ID") set ttopics = nothing strsql = "SELECT F_SUBJECT FROM " & strActivePrefix & "FORUM WHERE FORUM_ID=" & strTempForum set tforums = my_conn.execute(strsql) strTempForumTitle = tforums("F_SUBJECT") set tforums = nothing strNewTitle = strTempTopicTitle & " - " & strTempForumTitle & " - " & strForumTitle else strsql = "SELECT T_SUBJECT, FORUM_ID FROM " & strTablePrefix & "TOPICS WHERE TOPIC_ID=" & strTempTopic set ttopics = my_conn.execute(strsql) strTempTopicTitle = ttopics("T_SUBJECT") strTempForum = ttopics("FORUM_ID") set ttopics = nothing strsql = "SELECT F_SUBJECT FROM " & strTablePrefix & "FORUM WHERE FORUM_ID=" & strTempForum set tforums = my_conn.execute(strsql) strTempForumTitle = tforums("F_SUBJECT") set tforums = nothing strNewTitle = strTempTopicTitle & " - " & strTempForumTitle & " - " & strForumTitle end if else strNewTitle = strForumTitle end if
Case "forum.asp" strTempForum = request.querystring("FORUM_ID")
if not(strTempForum = "") then strsql = "SELECT F_SUBJECT FROM " & strTablePrefix & "FORUM WHERE FORUM_ID=" & strTempForum set tforums = my_conn.execute(strsql) strTempForumTitle = tforums("F_SUBJECT") set tforums = nothing strNewTitle = strTempForumTitle & " - " & strForumTitle else strNewTitle = strForumTitle end if Case "members.asp" strNewTitle = "Members - " & strForumTitle Case "active.asp" strNewTitle = "Active Topics - " & strForumTitle Case "faq.asp" strNewTitle = "Frequently Asked Questions - " & strForumTitle Case "search.asp" strNewTitle = "Search - " & strForumTitle Case "pop_profile.asp" if request.querystring("mode") = "display" then strNewTitle = "View Profile - " & strForumTitle elseif request.querystring("mode") = "edit" then strNewTitle = "Edit Profile - " & strForumTitle else strNewTitle = "Profile - " & strForumTitle end if Case "policy.asp" strNewTitle = "User Agreement - " & strForumTitle Case "register.asp" strNewTitle = "Register - " & strForumTitle Case "active_users.asp" strNewTitle = "Active users - " & strForumTitle Case else strNewTitle = strForumTitle End Select GetNewTitle = strNewTitle End Function
Inc_Top.asp Replace below...
Response.Write "<html>" & vbNewline & vbNewline & _ "<head>" & vbNewline & _ "<title>" & strForumTitle & "</title>" & vbNewline
With the following
strScriptName = request.servervariables("script_name") Response.Write "<html>" & vbNewline & vbNewline & _ "<head>" & vbNewline & _ "<title>" & GetNewTitle(strScriptName) & "</title>" & vbNewline
---------------- Da_Stimulator Need a Mod? My Snitz Test Center
Edited by - da_stimulator on 25 October 2001 01:50:36
Edited by - da_stimulator on 26 October 2001 12:49:26
Edited by - da_stimulator on 01 November 2001 08:24:12
Edited by - da_stimulator on 01 November 2001 08:25:05
Edited by - da_stimulator on 01 November 2001 10:18:49
Edited by - da_stimulator on 01 November 2001 10:40:02
Edited by - da_stimulator on 01 November 2001 12:22:47
Edited by - da_stimulator on 01 November 2001 12:43:16
Edited by - da_stimulator on 01 November 2001 12:50:49
Edited by - da_stimulator on 15 November 2001 03:53:14 |
|
Azaniah
Senior Member
United Kingdom
1004 Posts |
Posted - 26 October 2001 : 10:45:27
|
This did nothing for me.
No error's no change no nothing.
*wonders if it's due to Huwr Modded Forum*
------- Eagles fly!, but weasels don't get sucked into jet engines. |
|
|
Da_Stimulator
DEV Team Forum Moderator
USA
3373 Posts |
Posted - 26 October 2001 : 10:51:18
|
whoops, sorry try changing this line: strTempScript = sTempScriptName
to this
strTempScript = Right(sTempScriptName, 9)
--------------- Da_Stimulator has spoken Ongoing Project that uses Snitz forums as a backbone for entire website |
|
|
Azaniah
Senior Member
United Kingdom
1004 Posts |
Posted - 26 October 2001 : 11:42:38
|
ok!
Now we are cooking.
Cheers Mate
------- Eagles fly!, but weasels don't get sucked into jet engines. |
|
|
Roland
Advanced Member
Netherlands
9335 Posts |
Posted - 27 October 2001 : 12:04:58
|
Really cool! I was planning on asking for something like this but I won't have to anymore.
One thing though: the forum or topic title shows up before the standard title. I think it makes more sense to have the standard title appear first and then the additional title. I changed it and made it fit in with the rest of my site's titles so you won't have to explain how that's done
Anyway, thanks!
|
|
|
Bassman
Junior Member
Netherlands
256 Posts |
Posted - 28 October 2001 : 07:35:28
|
Thanks Da_Stimulator, works great
Edited by - bassman on 28 October 2001 07:36:10 |
|
|
Classicmotorcycling
Development Team Leader
Australia
2084 Posts |
|
jcfmachado
Starting Member
7 Posts |
Posted - 31 October 2001 : 21:36:16
|
hyall,
Another solution that i didn't test it, but i think it will work is to use the javascript document.title property...
In forum.asp and in topic.asp after fetching the forum name and/or topic just use something similiar to this:
<script language="javascript"> document.title='<%response.write ForumTitle & " " & TopicTitle%>'; </script>
Just replace forumtitle & topictitle with the correct variable name. The only drawback of this approach is that the title is the default in inc_top.asp for a split second while reaching that line in code. A great advantage is that we save another roundtrip to the server in a much needed enviroment.
Cheers & Sagres, Machado
|
|
|
GauravBhabu
Advanced Member
4288 Posts |
Posted - 31 October 2001 : 22:03:08
|
However, I used Active Users Mod for getting the Title. I moved the include statement for inc_activeusers.asp in inc_top.asp above the title tag and inserted the statements in red in inc_activeusers.asp as below
Case "active.asp" strOnlineLocation = strOnlineLocation & "Active Topics" strForumTitle = strForumTitle & " - Active Topics" Case "members.asp" strOnlineLocation = strOnlineLocation & "Members" strForumTitle = strForumTitle & " - Members" Case "search.asp" strOnlineLocation = strOnlineLocation & "Search" strForumTitle = strForumTitle & " - Search" Case "events.asp" strOnlineLocation = strOnlineLocation & "Events Calendar" strForumTitle = strForumTitle & " - Events Calendar"
Check out at my site.
GauravBhabu There is only one miracle...That is LIFE! | It is difficult to IMPROVE on Perfection, There is no harm in Keep Trying. |
|
|
Roland
Advanced Member
Netherlands
9335 Posts |
Posted - 01 November 2001 : 04:05:33
|
Okay, so you basically say that if the page is members.asp it has to add - Members to the title, right? Can this be used in combination with Stim's codes?
Roland
http://www.frutzle.com |
|
|
GauravBhabu
Advanced Member
4288 Posts |
Posted - 01 November 2001 : 08:25:07
|
Exactly!There is no need of calling the function since Online script already determines the Page which is being hit. This is how i did for forum.asp and topic.asp
Case "forum.asp" If Request.QueryString("FORUM_ID") <> "" Then set rst = my_conn.execute("SELECT FORUM_ID, F_SUBJECT FROM " & strTablePrefix & "FORUM WHERE FORUM_ID = " & Request.QueryString("FORUM_ID")) Forum_Subject = rst("F_SUBJECT") rst.close set rst = nothing end if strOnlineLocation = strOnlineLocation & Forum_Subject strForumTitle = strForumTitle & " - " & Forum_Subject Case "topic.asp" if Request.QueryString("ARCHIVE") = "true" Then strOnlineLocation = strOnlineLocation & "Viewing Archived Message" else if Request.Querystring("TOPIC_ID") <> "" Then set rst = my_conn.execute("SELECT TOPIC_ID, T_SUBJECT FROM " & strTablePrefix & "TOPICS WHERE TOPIC_ID = " & Request.Querystring("TOPIC_ID")) Topic_Subject = rst("T_SUBJECT") rst.close set rst = nothing strOnlineLocation = strOnlineLocation & Topic_Subject strForumTitle = strForumTitle & " - " & Topic_Subject end if end if
GauravBhabu There is only one miracle...That is LIFE! | It is difficult to IMPROVE on Perfection, There is no harm in Keep Trying. |
|
|
Da_Stimulator
DEV Team Forum Moderator
USA
3373 Posts |
Posted - 01 November 2001 : 08:27:38
|
Changed so it works no matter what page your on - Simple to add other pages, just follow the format :)
--------------- -Da_Stimulator |
|
|
samyot
Junior Member
Canada
242 Posts |
Posted - 01 November 2001 : 10:01:26
|
Got error, fixed by adding " at end of line Case "pop_profile.asp
Now getting:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'Unbound'
/forum/inc_functions.asp, line 43
Sylvain Amyot FORUM:http://support.mytechsupport.ca HOME:http://mytechsupport.ca
|
|
|
Da_Stimulator
DEV Team Forum Moderator
USA
3373 Posts |
Posted - 01 November 2001 : 10:20:40
|
Change it to 'Ubound' - nowhere did I type 'Unbound' - you may have inadvertantly changed it...
--------------- -Da_Stimulator |
|
|
samyot
Junior Member
Canada
242 Posts |
Posted - 01 November 2001 : 10:35:43
|
quote:
Change it to 'Ubound' - nowhere did I type 'Unbound' - you may have inadvertantly changed it...
--------------- -Da_Stimulator
Sorry, I was playing around with the code and posted the wrong error message.
This is what I get:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'Ubound'
/forum/inc_functions.asp, line 43
Sylvain Amyot FORUM:http://support.mytechsupport.ca HOME:http://mytechsupport.ca
Edited by - samyot on 01 November 2001 10:37:28 |
|
|
Da_Stimulator
DEV Team Forum Moderator
USA
3373 Posts |
Posted - 01 November 2001 : 10:41:35
|
oh ok, fix:
change this: strTempScript = Ubound(strTempScriptName)
to this: strTempScript = Ubound(strTempScript)
--------------- -Da_Stimulator |
|
|
Topic |
|