Reply To: Escaping metacommands in templates

Product Compare Forums Multi-Edit Suggestions Escaping metacommands in templates Reply To: Escaping metacommands in templates

#5892
Clay Martin
Keymaster

Hi Greg,
I have run into this before as I use templates for whole pages a lot and they do have html comments <!- for both comments and server side includes. I have been just using “<-0x3c><-0x21>” which I copy from another template and then go thru my new template replacing every <! with the hex constants above. As for dong it in decimal (… old days… in binary…uphill… both ways), <<-033><-045> works also and so does <-040><-033>-.

I admit it would be nice to be able to just use <\! or <\- or <\^ or <\~ or <\% or <\? whenever you wanted to escape the meaning of < followed by !, -, ^, ~, %, or ?. Unfortunately I believe that the basic template code was devised long before HTML or even java-fill-in-the-blank was around and you don’t see <!- much in C, Fortran or Assembly. If V10 is really a rewrite then I guess that would be the time to upgrade the template meta-tags (being 100% backward compatible of course :wink: for those folks with products that include over 350 templates).

Another solution might be to add the below code to all your html/shtml/javascript templates, it requires one extra press of the enter key when you expand a template but that is not much considering the keystrokes saved with a template.
[code:2wcqcuos]
<-PROMPT~comment Just hit enter `<!-> ->
... later in code
<-LASTPROMPT~comment>-#include file="afile.inc"–>
...
<-LASTPROMPT~comment> *************************** ->
<-LASTPROMPT~comment> ******* Content below ******* ->
<-LASTPROMPT~comment> *************************** ->
...
<SCRIPT language="javascript">
<-LASTPROMPT~comment> hide from old browsers (like they still exist)
...
->
</SCRIPT>
[/code:2wcqcuos]

Yea, I know that this solution takes more cutting and pasting than just pasting <-0x3c><-0x21>, but it does explore a real useful technique for getting more out of templates. :)

HTH
Clay