
| View previous topic :: View next topic |
| Author |
Message |
Ascenti0n
Joined: 16 Mar 2009 Posts: 3
|
Posted: Thu Oct 08, 2009 4:57 pm Post subject: how do I use HTML/PHP snippets (templates) interchangebly? |
|
|
I use what Netbeans calls "code templates", as my area to store code snippets. Snippets is something in my text editors (Geany, Gedit, Vim) which I use heavily, and increases my productivity no end.
As a web developer, I often have to include PHP code in .html files and vice-versa. How can I use my snippets interchangeably irrespective of file type? |
|
| Back to top |
|
 |
Petr Pisl Posted via mailing list.
|
Posted: Fri Oct 09, 2009 5:00 pm Post subject: how do I use HTML/PHP snippets (templates) interchangebly? |
|
|
The code templates are registered for a language mimetype. The language
mimetype is different from file mimetype and a file can contains more
languages.
For example. When you define a new code template for html language, then
the code templates will work in all file types, which contains the
language with html mimetype. But it works only in the html area (in html
language part). So in .php files there are recognized four languages -
html, php, javascript, css. The code templates that are registered for
html work in html sections, the php code templates works in php sections
and etc. If you need the same code template in html and php sections,
then you have to define it twice - for html and php language.
I don't know whether I have answered your question.
Regards,
Petr
| Quote: | I use what Netbeans calls "code templates", as my area to store code snippets. Snippets is something in my text editors (Geany, Gedit, Vim) which I use heavily, and increases my productivity no end.
As a web developer, I often have to include PHP code in .html files and vice-versa. How can I use my snippets interchangeably irrespective of file type?
|
|
|
| Back to top |
|
 |
Ascenti0n
Joined: 16 Mar 2009 Posts: 3
|
Posted: Sat Oct 10, 2009 3:24 pm Post subject: |
|
|
I appreciate you taking the time to reply, though I am bit confused.
I understand what you say about mimetypes, which is the same how most editors apply snippets.
In other editors, there is usually a 'global' section to tackle the perculiarities of web development, ie interchanging/mixed code between HTML/PHP within .html and .php files, not to mention css & javascript.
I kind of get your drift about 'sections of code', but this didn't work for me when I tried to apply a php snippet or template, within a .html file, despite it being applied between:
tags. |
|
| Back to top |
|
 |
Petr Pisl Posted via mailing list.
|
Posted: Mon Oct 12, 2009 1:46 pm Post subject: how do I use HTML/PHP snippets (templates) interchangebly? |
|
|
There is no global section in NetBeans. Also .html files are not
associated with php by default. You can change it in Tools-> Options,
but by default the php language is recognized in files with extentions
php, inc, php3, php4, php5, phpt and phtml.
You can put a php snippet into a html code templates as well, you can
put there what you want, but if you want to do it in .html files, you
have to treat the files as php files.
Regards,
Petr
| Quote: | I appreciate you taking the time to reply, though I am bit confused.
I understand what you say about mimetypes, which is the same how most editors apply snippets.
In other editors, there is usually a 'global' section to tackle the perculiarities of web development, ie interchanging/mixed code between HTML/PHP within .html and .php files, not to mention css & javascript.
I kind of get your drift about 'sections of code', but this didn't work for me when I tried to apply a php snippet or template, within a .html file, despite it being applied between:
Code:
<?php ?>
tags.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|
|
|
|