SlickEdit Product Discussion > SlickEdit®

How do I modify Syntax Expansion for PHP ?

(1/2) > >>

jcelle:
Hello,
I am trying to understand how to modify Syntax Expansion for PHP.
I can successfully trigger Syntax Expansion for 'if' and 'for' keywords for instance but not for 'foreach'.
I read in some posts here that one way to modify Syntax Expansion is to create (update?) language specific aliases.
For C/C++ language many aliases are already predefined. For PHP there are none.
This puzzles me.
Where are the PHP aliases used for Syntax Epanxansion stored ?
I'd rather build on existing data rather than create a PHP alias from scratch for the missing foreach.
Besides I intend to use 'for' to trigger the foreach loop, so I also need to disable the original 'for' configuration.
Thanks for any advice.

Dan:
The easiest way to do it i so go to Tools>Options, Languages>Web Authoring Languages>PHP>Aliases.  Give the name you want to expand (foreach) and the whole loop that you want to use.

jcelle:
Thanks for your answer Dan.
I would like to understand where PHP 'out of the box' Syntax Expansion comes from.
Do you know why 'local' aliases show for C/C++ and not for PHP ?

Besides, how can I use 'for' (and not 'foreach') and make sure my 'for' takes precedence on the 'out of the box' for ?
Regards.

Dan:
There are some that we ship for C/C++, so that is why they show up.

You should be able to get those to work, you may need to define your own foreach.

jcelle:
Hello Dennis,
I think we have a problem here.
Out of the box if I type "if(" I get an automatic expansion for if.
I don't like it as such and wish I could change it.
I understood it was not possible so I created a PHP alias on this key "if', note I do not include the opening parenthesis.
I have now a perfect "if" + space alias.

However I still have an unwanted "if(" alias remaining: how do I get rid of it ?
There must be a way to update existing templates: I can't believe it is hard coded.

Ideally I wish that typing "if(" would trigger my template - note "if(" not if( + space or any other trigger key.

Thanks for helping me.
Regards.

Navigation

[0] Message Index

[#] Next page

Go to full version