Announcement

Collapse
No announcement yet.

PHP/Perl Experts Please Look!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP/Perl Experts Please Look!

    I need a script (perfer Perl or php) that can add a few lines of comments to each html file in a folder automatically. I have to over 50 html files in my project, I need a copyright statement on each page. It would be very laborious to add them manually. So If you know where I can find a script like this, or know how to make one, please reply this post.

    Thanks in advance.

  • #2
    I don't think you need a script to do this. Some ASCII editors will perform multi-line search&replace on multiple files.

    For example, EditPad Lite will perform multi-line search&replace on all files currently open. So, you could open 10 files at a time, and perform the search&replace 5 times.

    Comment


    • #3
      I wanna do something like this
      line 1: <html>
      line 2: <head><title>my page</title></head>
      line 3: <body>blah blah blah...

      after i added the copyright lines it should look like this.

      line 1: <!--copyright asdfdsf
      line 2: asdfsdaf ksjflskajfskalfj;
      line 3: aksfjksdjfsalfjl-->
      line 4: <html>
      line 5: <head><title>my page</title></head>
      line 6: <body>blah blah blah...

      there's nothing to search for, how can i replace? it's just the first line of the file.

      Comment


      • #4
        Search for:
        <html>
        <head><title>

        Replace with:
        <!--copyright asdfdsf
        asdfsdaf ksjflskajfskalfj;
        aksfjksdjfsalfjl-->
        <html>
        <head><title>

        Comment


        • #5
          Great Idea! thanks a lot

          Comment


          • #6
            Why not instead of placing the copyright message there, simply use an include statement so that you only have to have the copyright 1 place with an include on all the pages. That way, if you need to change the copyright you only change it once.

            If the concern is for people that will view the page after it is processed by the server this would work, if however you are concerned with people that have direct access to the pages, well, if they have direct access do you think a copyright notice is going to deter them?

            I have a site copyright notice placed as a footer on all of the pages of my site. I also include the code to update the year automatically for when the year changes over new years. As my site is dynamic, this is the easiest way for me to not have to worry about replacing that year on new years day.

            Dale

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...
            X