Author |
Topic |
|
Kong
Junior Member
100 Posts |
Posted - 26 March 2002 : 01:10:32
|
Is there any way it may be possible for an ASP script to READ the [b]<TITLE></TITLE> tags of a webpage and display it within the pages?
I'm looking to have that coding within a top.asp and have it display whatever the title is for the page which is being viewed.
Similar to this...
You are viewing, About My Website. or something like that
I need coding that can look into...
<html> <head> <title>About My Website</title> </head>
Can anyone help me out?
_________________________ Come on by and visit Deth Incarnate. Growing slowly, but growing none the less. |
|
Kat
Advanced Member
United Kingdom
3065 Posts |
Posted - 26 March 2002 : 05:09:10
|
Why don't you define your page title in an ASP variable and refer to it in the title and anywhere else in the page that you need to?
e.g.
<% PageTitle = "This is the page title" %>
<title><%=PageTitle%></title> ...
in body somewhere <p>You are viewing <%=PageTitle%></p>
KatsKorner
For Installation help: http://www.aslickpage.com/snitz_help.html For Snitz Mods: http://ls3k.com/snitz/
Edited by - kat on 26 March 2002 05:09:38 |
|
|
Kong
Junior Member
100 Posts |
Posted - 26 March 2002 : 15:17:38
|
Thanks it works great.
However, I was kinda hoping for something that could read the <title> tags... oh well.
If any one knows how to read the title tags without changing it above let me know.
Thanks for the help Kat, it works great.
_________________________ Come on by and visit Deth Incarnate. Growing slowly, but growing none the less. |
|
|
Kat
Advanced Member
United Kingdom
3065 Posts |
|
TerryG
Junior Member
United Kingdom
179 Posts |
Posted - 27 March 2002 : 07:12:51
|
You could do it in javascript if thats any help ie. <BODY> You are viewing <SCRIPT> document.write (document.title) </SCRIPT> </BODY>
I guess you could put that in an ASP file (without the body tags) and <!-- #include --> that file wherever you wanted the title to appear.
|
|
|
Kat
Advanced Member
United Kingdom
3065 Posts |
Posted - 27 March 2002 : 07:23:59
|
Yep TerryG is right. You could do it in JavaScript.
You still can't access the contents of the Title tags that way though. I still haven't found how to do that if you it is possible at all - which I doubt.
KatsKorner
For Installation help: http://www.aslickpage.com/snitz_help.html For Snitz Mods: http://ls3k.com/snitz/
|
|
|
TerryG
Junior Member
United Kingdom
179 Posts |
Posted - 27 March 2002 : 07:36:30
|
Kat I am confused (a not unusual occurance) whats the difference between 'document.title' and 'the contents of the title tags'?
|
|
|
Kat
Advanced Member
United Kingdom
3065 Posts |
Posted - 27 March 2002 : 07:57:42
|
I think Kong was looking for a way to grab the contents of the HTML without using script - unless I read it wrong.
Both our solutions involved script.
That was all. It may be me whos gone nuts...
KatsKorner
For Installation help: http://www.aslickpage.com/snitz_help.html For Snitz Mods: http://ls3k.com/snitz/
|
|
|
TerryG
Junior Member
United Kingdom
179 Posts |
Posted - 27 March 2002 : 08:03:09
|
quote:
I think Kong was looking for a way to grab the contents of the HTML without using script[size=1]KatsKorner
OK, I understand and I can't see how its possible either.
|
|
|
Kat
Advanced Member
United Kingdom
3065 Posts |
|
@tomic
Senior Member
USA
1790 Posts |
Posted - 27 March 2002 : 11:33:43
|
How does the title of the page get into the title tags? Are you hard coding it? Are they the titles from a web page on another web site?
@tomic
http://www.skepticfriends.org |
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 27 March 2002 : 12:42:59
|
I don't get it. If you're viewing an asp page, the title HTML was sent to the browser from the asp page and it should be easy to capture the title and generate some other HTML based on the current page title.
If you want to get the title of some other page other than the one you're viewing, you can use ASPTear or similar components to get the other page source into a variable you can use.
====== Doug G ====== |
|
|
TerryG
Junior Member
United Kingdom
179 Posts |
Posted - 28 March 2002 : 03:44:20
|
Doug G, give us a short example please so we can be sure we are not all talking at cross-purposes, thanks. Kong's original post talks about displaying a documents title within the same document, lets ignore displaying other docs titles in this doc for now.
|
|
|
Kat
Advanced Member
United Kingdom
3065 Posts |
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 29 March 2002 : 00:20:07
|
<% dim sTitle sTitle = "About My Website" %>
<html> <head> <title><%=sTitle%></title> </head>
====== Doug G ====== |
|
|
Kong
Junior Member
100 Posts |
Posted - 30 March 2002 : 05:28:18
|
What i was looking for was exactly what Kat had told me.
I took the coding and put it into the pages and I works great.
The only thing that I was hoping for was to not go into every document and change the title from say...
<title>My Webpage</title>
to...
<%PageTitle = "This is the page title"%> <title><%=PageTitle%></title>
That's it. The coding Kat gave me to use works perfect and I'm very greatful she was able to help.
What I had said in my second post was that if anyone knows away to basically read the <title> tags without having to change it I would appreciate it... but I assume it's not possible.
Like I had already said... Kat solved the problem for me.
Thanks again.
_________________________ Come on by and visit Deth Incarnate. Growing slowly, but growing none the less. |
|
|
|
Topic |
|