Community
Participate
Working Groups
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
in pdt 2.2 we removed the newPHP templates. it was replaced with code templates (under PHP | Editor) to customize your new php content
(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.
fixed in head,now there is a new button only for new php file context.
Additional new php file templates will not be supported at this point. (aligning with JDT)
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)
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!
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)?
Reopening, we need to revise this.
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.
*** Bug 416112 has been marked as a duplicate of this bug. ***
*** Bug 324511 has been marked as a duplicate of this bug. ***
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
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.
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