comment header automatically added to php files

irmtfan
2013-02-11
2013-02-12
  • irmtfan
    irmtfan
    2013-02-11

    i simply want to pre-define a "comment header" for my project php files like this:

    /*
    You may not change or alter any portion of this comment or credits
    of supporting developers from this source code or any supporting source code
    which is considered copyrighted (c) material of the original comment or credit authors.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    */

    /*
    * @copyright

    * @license
    http://www.fsf.org/copyleft/gpl.html GNU public license
    * @author MYNAME <MYEMAIL>
    * @version $Id: FILENAME.php VERSION DATE TIME MYNAME $
    /

    the VERSION and DATE TIME should be changed when i save the file as you know.

    after 3 hours of searching i still cannot find it.
    I wonder that why i cannot do this in notepad++

    please help me.

     
  • Loreia2
    Loreia2
    2013-02-11

    Hi irmtfan ,

    I would do this by writing a small (like three lines) python script.
    Can't you make a small PHP script that does just that?

    BR,
    Loreia

     
  • irmtfan
    irmtfan
    2013-02-12

    actually i need an easy way to do that.
    I dont know how to write that script.
    anyway if npp was capable to add/modify comment header somebody could show me.

    I will use a php IDE.

     
  • Loreia2
    Loreia2
    2013-02-12

    Well, then the simplest way to do it is to install Python plugin for Notepad ++, write a small script, and instruct Notepad++ to execute it on each save.

    If you need help with script writing, just ask here but be specific what do you need. You mentioned you wanted to automatically change version and date information. Can you specify format of version info, how it is incremented, which date-time format is used.

    BR,
    Loreia

     
  • You could also look at the fingertext plugin, which could create you a snippet to fill out most of that information.

    Dave.