Post Reply 
Page contents to <title> tag
Oct. 28, 2010, 03:34 PM
Post: #1
Page contents to <title> tag
is there any way to get some page contents into page title tag?
running Oct 23 config.

reason need it: on some forums the <title> tag contains meaningless stuff like MS apps and etc, so i want to put in contents of the <div class='maintitle'>
i've done something like this
Code:
[Patterns]
Bounds = "<div class='maintitle'>*</div>"
Limit = 254
Match = "\1<b>\2</b>\3$SET(THtit=\2)"
Replace = "\1<b>\2</b>\3"
question is how to get it into <title> Smile!
thanks in advance for help.
Add Thank You Quote this message in a reply
Oct. 28, 2010, 03:56 PM
Post: #2
RE: Page contents to <title> tag
could i have the link to the site-in-question?
Add Thank You Quote this message in a reply
Oct. 28, 2010, 04:47 PM
Post: #3
RE: Page contents to <title> tag
thanks for the reply. sorry those are private boards, but the engine is a regular Invision Power Board.
i guess during engine setup, paranoia ruled Smile!. strangely ruled though i must say.
the skin and structure is similar to this one - http://www.homefitness101.com/forum/inde...howtopic=2
for this example lets say i want to update the <title> with some contents of <div id='navstrip' align='left'>
i am having troubles not with finding and setting contents of THtit but with updating <title> and adding contents of THtit. because content that i need comes after! <title> has been processed.
i hope i'am not confusing and was able to explain what i need.
Add Thank You Quote this message in a reply
Oct. 28, 2010, 07:35 PM
Post: #4
RE: Page contents to <title> tag
ah, i see the dilemma (contents coming after title)...

perhaps a <body> tag 'onload' of some kind?
Add Thank You Quote this message in a reply
Oct. 29, 2010, 01:21 AM
Post: #5
RE: Page contents to <title> tag
I think I'd try using the Proxomitron to empty the Title block, capture the text, and add a javascript that uses document.title to modify the title.

Otherwise, BFMI. Remove the Title block, match from </head> to desired text, place new Title block, and replace matched code.

HTH
Add Thank You Quote this message in a reply
Oct. 29, 2010, 04:17 AM
Post: #6
RE: Page contents to <title> tag
I'd try to generate a javascript that alters document.title after identifying the portion of the target DIV to use for it. I'd generate that script either just before the /DIV or after it, and totally ignore what-ever any previous <title> might have been (if any).

Below illustrates the method. In this example the script is appending (via '+=' construct) the string to the previous title content. Maybe you want to assign your desired text instead of append.
Code:
<html>
<head>
<title>the base title</title>
</head>
<body>
Some Stuff in the body ...

<script language="javascript">
document.title += ' ** And We Added This';
</script>

</body></html>
Add Thank You Quote this message in a reply
Oct. 29, 2010, 06:06 AM (This post was last modified: Oct. 29, 2010 06:08 AM by sh8an.)
Post: #7
RE: Page contents to <title> tag
yay! Smile!
Code:
\1<b>\2</b>\3\r\n
<script language="javascript">\r\n
    pxDt = document.title;\r\n
    re = /Meaningless stuff/g;\r\n
    document.title = pxDt.replace(re, "") + '\2';\r\n
</script>\r\n
saw similar code in proxjs-full.js before but didn't get how to use it in my case. Smile! thanks a lot for the hints.
Add Thank You Quote this message in a reply
Oct. 30, 2010, 01:40 PM
Post: #8
RE: Page contents to <title> tag
so many sites have bad titles, this document.title method could be a general filter, that can be customized from an include-exclude or other list file.
_________
my purpose is only to bookmark and only a few sites worth the trouble, so i have a few site-specific filters. the filter creates link to the same page at location on the page where the usable info appears. simplified fake example, before:
<h1>text that should be good title, bookmark</h1>
after:
<h4><a href="\u">text that should be good title, bookmark_website.com</a></h4>
Add Thank You Quote this message in a reply
Post Reply 


Forum Jump: