This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 198807 - Add new file .phtml
Summary: Add new file .phtml
Status: RESOLVED WONTFIX
Alias: None
Product: php
Classification: Unclassified
Component: Zend (show other bugs)
Version: 7.1
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-23 10:49 UTC by monk.e.boy
Modified: 2011-09-19 08:58 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description monk.e.boy 2011-05-23 10:49:03 UTC
Zend Framework uses PHP templates for the View (in MVC), these are PHP files with an extension .phtml.

Can you add an option to the 'right click' -> 'new' menu with .phtml in it?

At the moment choosing any option named 'Php [something]' forces the extension to .php and it is impossible to change this later.

I am uncertain which option I need to choose to get a .phtml file at the moment so I use the file system explorer to create an empty .txt file, then I rename this and switch back to netbeans.
Comment 1 Petr Pisl 2011-05-23 11:54:42 UTC
There is a simple solution. Create your file, Save As Template and use Template manager to fit it to your needs. See for example my blog http://blogs.oracle.com/netbeansphp/entry/how_to_manage_templates_in

It's true that send support could add it as new file template out of the box. Because there is a simple solution -> downgrading to P3.
Comment 2 monk.e.boy 2011-05-23 12:18:38 UTC
Couldn't get this working (abandoned after 5 mins of struggling)

I duplicated the 'php web page' template and renamed it. Great feeling of achievement.

When I right click on a folder in the Projects this new option is NOT shown. (right click -> New -> Menu doesn't show my option -> much confusion and disappointment - great feeling of achievement replaced by feeling of self loathing)

When do toolbar -> ['New File' icon] my new template is in the list, but it has the wrong extension and I couldn't figure out how to change it. I tried all the options in Tools -> Templates (open in editor and settings) but none would let me change it.

Maybe all this needs a little love and attention? I'm sure the functionality is there somewhere but for someone as dim as I am it seems a little tricky :)

I create hundreds of .phtml files over the life of a project and without an easy option to create one it is frustrating. Would love to see this moved to P1 :)
Comment 3 Petr Pisl 2011-05-23 12:52:23 UTC
It's so easy. 
1)Just create a .phtml file in your projet, for example through New->Other->Empty file. Call it newZendTemplate.phtml in the Empty file wizard. Finish the wizard. 
2)Change the content to fit, what you need.
3)Invoke context menu over the file in the project explorer and choose Save as Template. Select a category, where the new template should be placed.
4)Invoke Tools->Template manager and expand the category where, you placed the new template. Probably it will be called "PHP File". When you click on the Rename button, you can see the real file name newZendTemplate.phtml
5)Create new file through New File dialog using new template.


The whole procedure should take less 40 seconds. 

In the context menu over a folder node the New submenu shows only ten last used templates.
Comment 4 Petr Pisl 2011-06-02 14:58:33 UTC
Tomas, I think we can add a new template for phtml files in Zend plugin.
Comment 5 monk.e.boy 2011-06-03 08:13:30 UTC
Can we add 'Manage Templates' to the bottom of the menu : Right click folder icon -> new -> List templates (<<-- add [Manage Templates] to the bottom of this menu)
Comment 6 Tomas Mysik 2011-09-15 06:05:29 UTC
Well, I don't think this is really needed since one can easily create PHTML file. The New File wizard allows to provide not only name for a PHP file, but also extension (so specify "myfile.phtml" as a File Name and you are done).

Feel free to reopen if you disagree but in such case, provide reasons why it should be done and why the current approach does not work.

Thanks for reporting.
Comment 7 monk.e.boy 2011-09-19 08:58:55 UTC
Well obviously I disagree or else this bug would have never been filed in the first place ;)

Zend Framework uses .phtml as the view extension, so we end up with around 7 phtml files for each controller (the controller is a .php file)

ZF uses a ton of .php, .ini and .phtml, so it feels weird that one of them is missing :(

Stats for my current project:

3 x .ini
240 x .php
270 x .phtml

I hope that sprinkles some science behind my request. Sometimes I fire off a bug report without remembering that I'm a minority PHP user :) most other PHP specific IDEs will have .phtml (for Zend Framework) .tpl for Smarty, etc...