- This topic has 16 replies, 2 voices, and was last updated 20 years, 1 month ago by frantuma.
-
AuthorPosts
-
frantumaMemberI am struggling with HTML templates.
My goal is to have a code assist (called with Ctrl-Space or any other option) to insert personalized pieces of code inside the HTML editor
I have tried creating new templates such as:
<!– @${cursor}:s ${date} ${time} –>
but there is no way I can manage to get it to pop up inside the editor.
When I use Ctrl-Space or type “<” only standard tags appear and no sign of the newly inserted ones.
Another issue is that there seem to be an inconsistency of behaviour between HTML files and JHTML (ATG dynamo) hich I am using often.
Any help on this?
Thanks
Francesco
Riyad KallaMemberWhat are you naming the templates? This is what you type into the HTML editor… for example, the following template ships with MyEclipse:
Name: comment
Pattern: <!– ${cursor} –>So when you are in HTML code you type:
<table>
comment| <– Hit CTRL-Space here
</table>And then from the dropdown you can select the “#comment” template. Is this not what you are seeing?
frantumaMemberI am calling it for example “State”
Thus, my template called State, defined in context “HTML Tags” (I don-t quite understand what is meant by context.) has pattern:
<!– @${cursor}:f ${date} ${time} –>
I try to insert it as the first row of my HTML page.
I place the cursor at the beginning of the first empty row and hit Ctrl-Space.
Only results in drop-down are:?-?<xml version…>
#comment… xml commentSame if I type ‘<‘
I tried even to type the name of the template and then hit Ctrl-Space but same result..
State<– and here I hit Ctrl-Space
Could be a problem of file type not recognized correctly or something?
frantumaMemberBy the way with latest eclipse 3.1 and MyEclipse 3.8.2..
Riyad KallaMemberHmmm… we don’t support Eclipse 3.1 (its not comming out until atleast may of next year)… can you please downgrade to Eclipse 3.0.1
On a side note, I just tried exactly your example and it seemed to work fine:
Riyad KallaMemberBTW “Context” means where this template will be available to you, in the case of “HTML Tags” it means in your HTML source. For example, the Javadoc Templates have Contexts like “Code” and “Javadoc” meaning some templates are only available while editing Javadoc.
frantumaMemberActually I meant eclipse 3.0.1. I was wondering if actually context could be the problem, I see two proposed contexts “HTML tags” and “All HTML” and I was thinking that maybe no template is showing because of lackness of DOCTTYPE decalration, .jhtml extension, not recognized html tag (DROPLET, etc.) or something like that.
Or it there could be some kind of conflict with other plug-ins (I am complete ignorant about plugin development in eclipse).
I think I understand that templates or at least HTML code-assist show up differently depending on position inside HTML tags, to say that assist showed inside a <TABLE> is different from the one inside <BODY> or other tags. Thus there is a “context” representing the cursor tag position. Is that right?
Thanks
Riyad KallaMemberYes I believe you are right. Try changing it to all and see if it helps.
frantumaMemberSeems actually not to be the context but the type of file. For some strange reason my Jhtml files are interpreted as XML, seems like.
I tried same template in XML templates and it works fine.
Still Jhtml is actually extended HTML and not XML, thus I would need to have access to HTML templates. Is there a way to map jhtml files to a “HTML context” or do you know how XML/HTML is chosen inside the editor?
Thanks
Riyad KallaMemberAre the JHTML files being opened with the XML editor? (right click > open with > MyEclipse HTML Editor) you can also make that association via the Window > Preferneces > Workbench > File Association page, add “*.jhtml” and map it to the HTML Editor.
frantumaMemberThe JHTML are actually associated with HTML editor, that seems weird to me. I have removed any other association from Window > Preferneces > Workbench > File Association page for the *.jhtml and MyEclipse HTML Editor is the only choice in right click > open with >.
But it’s like the editor believes to be handling a XML file (I guess same engine for both is used..).
Riyad KallaMemberBefore I check with the devs, please close the JHTML page, right click > Open With > MyEclipse HTML Editor… does the shortcut still not work?
frantumaMemberI’ve done what you said but still the same. I have closed all editors and reopened a jhtml with right click > Open With > MyEclipse HTML Editor. Still I get XML templates instead of HTML.
Eclipse 3.0.1, MyEclipse 3.8.2 (200408201200-3.8.2), Windows 2000 pro.
Pls advise if you need configuration spec or logs, etc.
Thanks
Riyad KallaMemberDo me a favor, try and open that file with the JSP editor and see if your template works… I filed a bug on this and found that the HTML templates only seem to be available in the JSP editor (strange).
frantumaMemberWith JSP editors they don’t work.
But I tried to open an HTML (NOT JHTML) file with HTML editor and I got all my HTML templates there no problem.
It’s only when I open a JHTML file that the HTML Editor doesn’t seem to recognize them as HTML..
I guess you can try it yourself by creating a new file test.jhtml and open it in the HTML editor.
-
AuthorPosts