Facebook   Twitter    e-mail newsletter    YouTube    RSS Feed    Android App    iPhone and iPad App     BlackBerry App    


Results 1 to 5 of 5

Thread: PHP Code header Editor? any help

  1. #1

    Default PHP Code header Editor? any help

    I am currently manually adding my script details and such as version etc at the top of all my code, like in functions.php etc etc...

    I copy and paste it into the headers of all my code, is there a easier and less time consuming method of doing this?

  2. #2
    Grandmaster
    Join Date
    Mar 2005
    Location
    Johannesburg
    Posts
    1,905

    Default

    What editor do you use? I think some IDE's can do it for you.

  3. #3
    Grandmaster
    Join Date
    May 2004
    Location
    Wimblefontien, UK
    Posts
    2,615

    Default

    The best way is to develop with this in mind and preferably use something like a dispatcher to dispatch all your views.. This way you do not have all this redundant code at the top of each file. If any changes are made you will need to include the changes into every file which is not very good practice at all. If you move into a dispatcher model, you also have the ability to limit the scope of your variables and function for that particular page which is much better in regards to resources and security.

    EDIT: I think I may have misread your post, if you are talking about documenting try phpdoc
    Last edited by James; 15-07-2010 at 04:06 PM.
    Please save trees and think twice before printing this post.

    Looking for a VPN, read my reviews at vpn-reviews.net

  4. #4

    Default

    Thanks, i use PHPedit and sometimes editplus.

  5. #5
    Super Grandmaster Nod's Avatar
    Join Date
    Jul 2005
    Location
    Nürnberg
    Posts
    6,737

    Default

    Code:
    #!/usr/bin/ksh
    DIR=/var/www/html/include
    HEADERFILE=${DIR}/header.txt
    for FILE in ${DIR}/*.php
    do
         cat ${HEADERFILE} ${FILE} > ${FILE}.new
         cp ${FILE} ${FILE}.ori
         mv ${FILE}.new ${FILE}
    done
    Not tested. Best to test first.

Bookmarks

Bookmarks

Posting Permissions

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