What is the best way to use eclipse code templates (PHP)?

One specific issue I ran into was using $ {word_selection} in the Eclipse PDT template.

I recently tried using some code templates with Eclipse PDT 2.1 to speed up some common tasks. We use many getters / setters, so I wrote the following pattern.

function get${word_selection}() {
return $$this->getData('${word_selection}');
}

function set${word_selection}($$${word_selection}) {
$$this->setData('${word_selection}', $$${word_selection});
}

I called the template “getet”, and the only way I know to use Code Assist is to enter: “getet”, then press the help keys with the code (I have it set to Esc, but I think that the default was Ctrl + Space). The problem is that this actually does not allow me to select the word that $ {word_selection} will use.

How can I enter the name of my template, press a key combination and select one word at a time?

I also want to know what patterns people have set up and any other tips on using patterns for programming speed.

+5
source share
1 answer

Have a look at this link: http://2tbsp.com/node/104 It describes two things: pdt code templates and code snippets.

How can I enter the name of my template, press a key combination and select one word at a time?

I think this cannot be achieved with code templates, but with code snippets. I don’t use them at all, but I can start :-)

+3
source

All Articles