...

View Full Version : Setting Page Title by using headline within page



schwarznavy
12-02-2008, 07:33 AM
Hello,

I have a bunch of news pages that I made (1,264 to be exact). All of them are formatted the exact same way, yet have different text.

All of them have a headline that is preceded by


<b><font size="5" face="Arial">

and succeeded by


</font></b>


Problem is I forget to add Page Titles to all of these pages when I created them. Can anyone think of a way to go through and automatically take the headline and copy it as a page title?

Thank you.

rangana
12-02-2008, 08:39 AM
Quiet vague. Show us the first 20 lines of the code to which you are wanting to extract the "headline".

schwarznavy
12-02-2008, 08:43 AM
Can do:


<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>News -- Commander, U.S. 7th Fleet</title>
<link rel="stylesheet" type="text/css" href="../../../sourcefiles/main.css">
</head>

<body id="News">

<div align="center">
<center>
<table id="AutoNumber1" cellSpacing="1" width="850" border="1">
<tr>
<td style="border-left: 1px solid; border-right: medium none; border-top: 1px solid; border-bottom: 1px solid" colSpan="3">
<font face="Arial">
<img src="../../../graphics/banner-top.jpg" border="0" alt="Welcome to the homepage for Commander, U.S. 7th Fleet" width="850" height="149"></font></td>
</tr>
<tr>
<td style="border-left: 1px solid; border-right: 1px solid" vAlign="top" width="200" bgColor="#181C3A">
<!--webbot bot="Include" U-Include="../../../sourcefiles/left-menu.htm" TAG="BODY" --><p>&nbsp;</td>
<td style="border-left: 1px solid; border-right: 1px solid; border-bottom: 1px solid" vAlign="top" width="100" bgcolor="#B3C0CE">
<!--webbot bot="Include" U-Include="../../../sourcefiles/news-menu.htm" TAG="BODY" --><p>&nbsp;</td>
<td style="border-left: 1px solid; border-right: 1px solid; border-bottom: 1px solid" vAlign="top" width="550">
<table border="0" cellpadding="5" cellspacing="5" style="border-left-width:0; border-right-width:0" width="100%" id="AutoNumber5" height="133">
<tr>
<td width="100%" height="29" style="border-bottom-style: solid; border-bottom-width: 1; border-left-style:none; border-left-width:medium; border-right-style:none; border-right-width:medium; border-top-style:solid; border-top-width:1">
<b><font size="5" face="Arial">

Then the "headline" follows.

Basically it would be awesome if could find some sort of batch tool that goes through, finds this "headline," and replaces the page's


<title>News -- Commander, U.S. 7th Fleet</title>

with

<title>HEADLINE GOES HERE</title>

Sounds so easy yet I know it is probably not at all...I guess I need some sort of super-powerful batch text editor.

Thank you.

rangana
12-02-2008, 09:07 AM
So, the second "font" element contains the "headline". I suppose this looks identical on all of your pages.

Might help:


<script type="text/javascript">
window.addEventListener?window.addEventListener('load',function()
{
ray.setTitle(); // Call setTitle func
},false):
window.attachEvent('onload',function()
{
ray.setTitle(); // Call setTitle func
}); // FF : IE

var ray =
{
setTitle:function()
{
var fntHeadline = document.getElementsByTagName('font')[1]; // Get the second font element
document.title = fntHeadline.firstChild.nodeValue; // Set the title to that of the font's value
} // End of setTitle function
} // End of ray object
</script>


You've got lots of deprecated tags and attributes (http://www.w3.org/TR/REC-html40/index/attributes.html). Find time to rectify those and note that table wasn't intended for layouts (http://www.w3.org/TR/REC-html40/index/attributes.html).

abduraooft
12-02-2008, 10:46 AM
I have a bunch of news pages that I made (1,264 to be exact). All of them are formatted the exact same way, yet have different text. I'd strongly recommend you to switch your website to some serverside script(at least from now) to dynamically show the contents from a DB. This would make your life a lot easier!

schwarznavy
12-02-2008, 10:48 AM
Yeah, I'm looking at some "Find and Replace" tools but none are powerful enough.

I'm also playing around with the DOS command FIND.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum