NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
How can i customize the php file template.


Joined: 19 Jun 2009
Posts: 4
Location: Chittagong
Reply with quote
I want to create a file template for php file where if i create a new file the file should have the following format:

Code:

/**
 * @author M H Rasel
 * 11-3-2009::2:38
 * @copyright 2009
 */

 


Where the date time and Copyright year will be taken from current date and time.

Could you please anyone tell me how could i do this.

N.B.: I am using PHPED 5.6

Thanks in advance
M H Rasel[/code]
View user's profileFind all posts by mhraselSend private messageYahoo Messenger
Guru master

Joined: 05 Jul 2004
Posts: 659
Location: Belgium
Reply with quote
The templates are stored in the templates/ subdirectory of your PhpED installation. Just modify the "Php File.php" and "Php5 File.php5" and you're all set!
The current date and time is not possible AFAIK however. Perhaps in combination with an integration command?
View user's profileFind all posts by BlizzSend private messageVisit poster's website


Joined: 19 Jun 2009
Posts: 4
Location: Chittagong
Reply with quote
Hi,
Thanks for your reply. I Know that file location. Bu t the problem is that i want to put current file location there. as well as current year. What is the code (i can remember there is dome code but forget what is that) to add that.

Could u pls tell me about that?

Hasan
View user's profileFind all posts by mhraselSend private messageYahoo Messenger
consider running a script


Joined: 21 Jun 2009
Posts: 3
Location: Illinois
Reply with quote
Hi,

here is a method of making a script:

copyright.php

<?php
//output copyright information

$datetime = date('m-d-Y::h:m');
$year = date("Y");

$html = "/**\n";
$html .="/* @author M H Rasel\n";
$html .="/* $datetime\n";
$html .="/* @copyright $year\n";
$html .="*/\n";

echo $html;
?>
____________

save this file in a folder: For example, my scripts are under:
C:\xampp\htdocs\myScripts

Under tools>settings>integration, add a new menu: "copyright"
Execute with: shell
command line: c:\xampp\php\php.exe c:\xampp\htdocs\myScripts\copyright.php

(replace the path to php.exe and copyright.php with path appropriate for your setup)

check mark:
show this command in tools menu
Return results to editor
insert(vs replace)

Start a new file, now run the script from your tools menu:
tools>scripts>copyright

...I get:
/**
/* @author M H Rasel
/* 06-22-2009::04:06
/* @copyright 2009
*/

You can set up a short-cut key to this script.

I haven't looked into perhaps auto-running scripts with new file creation...

good luck, hope this helps
View user's profileFind all posts by zaigtahir2Send private message
opps... here's the correct date string


Joined: 21 Jun 2009
Posts: 3
Location: Illinois
Reply with quote
date('m-d-Y::h:i');
View user's profileFind all posts by zaigtahir2Send private message
How can i customize the php file template.
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic