Big Mistake Kinda

Discussion in 'HTML & Website Design' started by geekazoid, Jul 18, 2006.

  1. #1
    ok i have linked about 300 pages to page.html and i realised the thing that i want on the page is php and i cant be assed to go back and relink it all can i not just put some script on the page.html to make it automatically go strait to page.php or a way to make page.html turn into page.php ? or even a way of putting php into a .html file which i dont know if is possible ? any ideas ?
     
    geekazoid, Jul 18, 2006 IP
  2. busin3ss

    busin3ss Banned

    Messages:
    83
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Yes, it's very easy actually
    If you have it as a dreamweaver site you could do a search and replace in whole site and replace "<a href="page.html"..." for "<a href="page.php"...." and that would do it.
    Or, a javascript redirect with 0 sec delay
    Or, in the .htaccess do a 301 redirect from page.html to page.php
     
    busin3ss, Jul 18, 2006 IP
  3. geekazoid

    geekazoid Peon

    Messages:
    208
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    the dreamweaver thing sounds good. how do i do that and would it still work if all the pages are in differant folders ?
     
    geekazoid, Jul 18, 2006 IP
  4. geekazoid

    geekazoid Peon

    Messages:
    208
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    can anyone explain how to do the dreamweaver site search edit thing ?
     
    geekazoid, Jul 26, 2006 IP
  5. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #5
    RTFM. Do some study on your own. Doesn't DW have help or documentation?

    gary
     
    kk5st, Jul 26, 2006 IP
  6. Gordaen

    Gordaen Peon

    Messages:
    277
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Doing something wild like a Google search reveals that you can click FIND, ENTIRE CURRENT LOCAL SITE. Type in what to find in the find box. Type in what to replace in the replace box... you get the picture. I'm not sure how much of a resource hog DW is (I use basic text editors with syntax highlighting along with vim), but it also has an option to do the same in all OPEN DOCUMENTS (under the find menu as well).

    If your files are on a linux server, you can do this:

    for fl in *.html do
    mv $fl $fl.old
    sed 's/FINDSTRING/REPLACESTRING/g' $fl.old > $fl
    rm -f $fl.old
    done
    Code (markup):
    Change the extension as necessary. Comment out ("#") the remove command if you want to keep the old copies just in case.

    You can also do some tweaking to make php commands work in a .html file, but I recommend keeping the extensions separate.

    I'm just wondering how you managed to do this in 300 files and why your username is geekazoid...
     
    Gordaen, Jul 27, 2006 IP
  7. geekazoid

    geekazoid Peon

    Messages:
    208
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    My username is geekazoid because thats what my website is called and it was a mistake i didnt see untill all pages where complete which took only a few hours.
     
    geekazoid, Jul 28, 2006 IP
  8. projectw3

    projectw3 Banned

    Messages:
    713
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I use ultraedit to do a replace all. I think the better text editors out there have this function.
     
    projectw3, Jul 29, 2006 IP
  9. phlint

    phlint Peon

    Messages:
    58
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Yea, if you do it manually you are going to have to edit all 300 pages. Eek!
     
    phlint, Jul 29, 2006 IP
  10. roEinstein

    roEinstein Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Add this line to your .htaccess and PHP will work in HTML files...

    AddType application/x-httpd-php .php .htm .html
     
    roEinstein, Jul 29, 2006 IP
  11. MattUK

    MattUK Notable Member

    Messages:
    6,950
    Likes Received:
    377
    Best Answers:
    0
    Trophy Points:
    275
    #11
    Hightlight the folders/pages that you want to make the changes on. Go to find/replace, enter the current URL in the find box and the new in the replace - simple :)
     
    MattUK, Jul 29, 2006 IP