I want fold php block in php template file.
So, you want to input a P
and it should output something like ? Did I understand your question correctly?
In that case, check out yasnippet (more info on emacswiki). It lets you define your own snippets (the syntax is really easy) like P, let it have placeholders (so you can replace xxx;
and xxx;
with something else when calling the snippet) and such. It's really handy. Just create a new snippet (the name of the file dictates it's shortcut, ie, name it P
it this example) and input something like:
# name: My own P-snippet.
# --
No need to make own font-locks, no need to use regexp. Just create a new snippet. After creating (and loading it, I usually restart emacs since I'm lazy) your snippet, open up a php-mode
buffer, type P and press tab. Magic! :)