Bug 318164 - "newPhp" is absent in Templates
Summary: "newPhp" is absent in Templates
Status: REOPENED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal with 7 votes (vote)
Target Milestone: ---   Edit
Assignee: PHP UI CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 324511 416112 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-06-28 07:30 EDT by Kir CLA
Modified: 2020-05-14 10:16 EDT (History)
14 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kir CLA 2010-06-28 07:30:27 EDT
Build Identifier: I20100608-0911

In PDT 2.2 we can't create template for new php file.

Reproducible: Always

Steps to Reproduce:
1. Open Window->Preferences->PHP->Editor->Templates
2. Try to create new template
3. Try to find "newPhp" in "context" field
Comment 1 Roy Ganor CLA 2010-06-28 11:20:39 EDT
in pdt 2.2 we removed the newPHP templates. it was replaced with code templates (under PHP | Editor) to customize your new php content
Comment 2 Kir CLA 2010-06-28 13:52:15 EDT
(In reply to comment #1)
> in pdt 2.2 we removed the newPHP templates. it was replaced with code templates
> (under PHP | Editor) to customize your new php content

Thx for answer.
Try to add new one. You can't.

We use 10 additional templates.
Comment 3 Zhongwei Zhao CLA 2010-06-29 02:11:32 EDT
fixed in head,now there is a new button only for new php file context.
Comment 4 Sylvia Tancheva CLA 2010-09-07 03:44:27 EDT
Additional new php file templates will not be supported at this point.
(aligning with JDT)
Comment 5 Kir CLA 2010-09-22 08:00:53 EDT
And how can i add my templates?
It's so cool, what i can't add my migration, controller and model template in eclipse ^_^ (sarcazm)
Comment 6 Zhongwei Zhao CLA 2010-09-22 11:05:19 EDT
you could modify eclipse home/plugins/org.eclipse.php.ui/templates/phpdefault-templates.xml to add your templates,this is workaround,because we do not supply this feature any more,thanks!
Comment 7 Nevik Rehnel CLA 2012-10-25 12:26:37 EDT
Seriously?
SERIOUSLY??

You REMOVE support for custom new file templates?? 
That's just-- I mean... 

Wow I don't even have words for this...

I'm not usually one to do useless rants like this, but I hope someone sees this. The fact that you removed this feature [since thie last time I actively used PDT] has just reduced the attractivity of PDT by about 30%.

I mean, it was WORKING before -- using the newPhp Editor templates -- and it is still working in other editors (like the HTML editor). So if you don't want to maintain the New File Templates dialog with add/remove buttons (which, tbh, would just be copy/pasting most of it from either the editor templates page or from another plugin), why don't you just return to the way things were?

Is there any REASON for this (besides "aligning with JDT", which is not a valid reason to justify such a regressive step)?
Comment 8 Jacek Pospychala CLA 2012-10-25 12:35:56 EDT
Reopening, we need to revise this.
Comment 9 Javier Alfonso Bellota de Frutos CLA 2014-04-08 06:34:19 EDT
I think that JDT can be used without templates because it have a diferente new file for each type content they have; for example, for new class or a new enum. But for php, you don't have a new file for a class, for html5 page, etc. and so this isn't a valid aproach.

In my opinion, we need to mantain the posibility to create new file templates, they are very very usefull. For example, I have one for each web proyect so I don't need to rewrite or copy the page structure each time I need to add a new page.
Comment 10 Dawid Pakula CLA 2014-11-26 08:58:02 EST
*** Bug 416112 has been marked as a duplicate of this bug. ***
Comment 11 Dawid Pakula CLA 2015-02-19 13:23:31 EST
*** Bug 324511 has been marked as a duplicate of this bug. ***
Comment 12 Darren Felton CLA 2016-05-11 13:02:14 EDT
Is anyone able to provide information to the location of the file mentioned in comment #6? I suspect that it has been moved/changed since the comment was posted nearly 6 years ago, as I am unable to find said file. Additionally, as mentioned in the linked Bug 324511, importing a template file with a new id-attribute does absolutely nothing.

I feel for PHP this is definitely a beneficial feature that should have never been removed. PHP files can serve very different purposes if that file is intended for a Model Class, Controller Class, View Script, Shell Script, etc.

Until this bug is resolved, I am willing to go through the work suggested in comment #6 but unfortunately I cannot find where these default templates are stored these days.

Thank You,
Darren Felton


Eclipse for PHP Developers
Version: Mars.2 Release (4.5.2)
Build id: 20160218-0600
Comment 13 Michal Niewrzal CLA 2016-05-11 18:09:30 EDT
File you cannot find is in <your_eclipse>/plugins/org.eclipse.php.ui*.jar/templates. Update file and repack zip, new template should be visible in new php file wizard.
Comment 14 Darren Felton CLA 2016-05-16 13:21:45 EDT
Thank you Michal Niewrzal.

This file was located in a slightly different location for me, most likely because I used the Windows installer to get my copy of Eclipse, rather than downloading a copy which runs stand-alone in it's own directory. For those who are in my same situation, on Windows 10, the file is here:
%USERPROFILE%\.p2\pool\plugins\org.eclipse.php.ui_*.jar

Files to edit:
- templates\phpdefault-templates.properties
- templates\phpdefault-templates.xml