Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jun 2007
    Posts
    34
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Setting Page Title by using headline within page

    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
    Code:
    <b><font size="5" face="Arial">
    and succeeded by
    Code:
    </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.

  • #2
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    Quiet vague. Show us the first 20 lines of the code to which you are wanting to extract the "headline".
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #3
    New Coder
    Join Date
    Jun 2007
    Posts
    34
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Can do:
    Code:
    <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
    Code:
    <title>News -- Commander, U.S. 7th Fleet</title>
    with
    Code:
    <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.

  • #4
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    So, the second "font" element contains the "headline". I suppose this looks identical on all of your pages.

    Might help:
    Code:
    <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. Find time to rectify those and note that table wasn't intended for layouts.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #5
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    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!
    Last edited by abduraooft; 12-02-2008 at 11:52 AM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #6
    New Coder
    Join Date
    Jun 2007
    Posts
    34
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •