File Template - File Username Variable
I've created a new file template.
is it possible to use the filename used for the file in the file template?
for example:
filename:
Lib
template
class Foo_${class} extends Foo{
}
would create 2 imput fields while creating the file (filename & class)
But because this both are the same, it would be better to have only 1 input field.
thx
请先登录再写评论。
Hi ragga,
Yes, just use ${NAME} instead:
thx
Didn't know that:)
I checked the help, but there were only:
Maybe you should update this^^
Andriy is just your fellow PhpStorm user, voluntarily offering his much appreciated help on our forums.
We will update the docs, filed as http://youtrack.jetbrains.net/issue/WI-5379
thx, didn't know this.
I thought he's working also for jetbrains, because he's so active here.
thx for the help:)
Currently testing out phpstorm and I am very pleased. It is competing against the two other IDEs - not naming any but you can guess.
How ever: In our company we always start the file with // filename.php
I have tried the ${NAME} variable and that does not work in 2.1.1.
I also wonder if it is possible to do a ${CURSOR} which would tell that the cursor shall be placed here when the new file is generated.
Again: Great IDE! And the $$$ is burning in my pocket.
Hello Trond,
I checked your request and realised that we don't provide the ${NAME} variable in 'PHP File', 'PHP Class' and 'PHP Inteface'. Because 'NAME' might be ambiguous(for example for 'PHP Class' template) I think that 'FILE_NAME' is more proper name for such variable. I created an issue about that(http://youtrack.jetbrains.net/issue/WI-6965) - please vote.
Please create a feature request - http://youtrack.jetbrains.net/issues/WI#newissue=yes
Thank you for feedback!
Hello Trond,
The issue is fixed in PhpStorm 2.1.2(http://blogs.jetbrains.com/webide/2011/07/phpstorm-webstorm-2-1-2-released/). Use ${FILE_NAME} variable.
Thank you for feedback!
Great! I will test it as I believe I have updated the program. Will you also add {CURSOR} so that the cursor will be placed where you have the tag and so you can continue writing the documentation.
Trond,
Please create a feature request - http://youtrack.jetbrains.net/issues/WI#newissue=yes
Thank you for feedback!
Hello Trond,
Do you use 'FILE_NAME' template variable? Do you have any issues?Thank you for feedback!Is there also a way to create the Classname dynamic, depending of the Direction?
e.g.
classname: Ragtek_Foo_Bar_Model_Baz is => library\Ragtek\Foo\Bar\Model\Baz
classname: Gallery_ControllerPublic_Index => library\Gallery\ControllerPublic\Index
So if i create a new File Template with a variable for the name, it should complete the name automatic depending on my folder?