You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Francisco Hernandez <xy...@earthlink.net> on 2001/06/01 04:42:30 UTC

how are you guys using Velocity with HTML generation tools?

for example with Adobe GoLive and Macromedia Dreamweaver, how are you guys
hiding the Velocity template directives from the HTML?

Id (well actually the graphic designer/artist) like to be able to open a
Velocity template in one of these tools and not have the directives scew the
look.

in Dreamweaver we were able to hide anything inside <??> <%%> tags.

thanks in advance.


Re: how are you guys using Velocity with HTML generation tools?

Posted by Francisco Hernandez <xy...@earthlink.net>.
wow, thats a pretty neat way to do it! thanks for the tip!

----- Original Message -----
From: "Neil Henderson" <ne...@softtech.co.nz>
To: <ve...@jakarta.apache.org>
Sent: Thursday, May 31, 2001 7:51 PM
Subject: RE: how are you guys using Velocity with HTML generation tools?


> In microsoft interdev i just set up a style sheet so that a span tag with
> class=hidden doesn't get displayed.
>
> The equivlent of setting
>
> <span style="Dislpay : none">
> velocity template directives
> </span>
>
> And i just put the span tags around the velocity template directives. gets
> round the problem nicely but does add span tags around the place. these
can
> be stripped out for a final server version though.
>
> NEIL
>
>
> for example with Adobe GoLive and Macromedia Dreamweaver, how are you guys
> hiding the Velocity template directives from the HTML?
>
> Id (well actually the graphic designer/artist) like to be able to open a
> Velocity template in one of these tools and not have the directives scew
the
> look.
>
> in Dreamweaver we were able to hide anything inside <??> <%%> tags.
>
> thanks in advance.
>
>


Re: how are you guys using Velocity with HTML generation tools?

Posted by "Randall G. Alley" <ir...@bellsouth.net>.
After you create the Third Party Tags file, Dreamweaver automatically
recognizes the Velocity directives, no enclosing comments are needed.

You only need to use the programatic comments  if there's stuff inside
the directives you want to be hide from Dreamweaver but not from
Velocity.

So you don't think that's useful, or is that you don't like DreamWeaver ?
;>)

Jon Stevens wrote:

> on 6/1/01 12:48 PM, "Randall G. Alley" <ir...@bellsouth.net> wrote:
>
> > Sure, you could do that if you like to type.
>
> How is that more typing than what you were proposing?
>
> -jon
>
> --
> Open source is not available to commercial companies.
>             -Steve Balmer, CEO Microsoft
> <http://www.suntimes.com/output/tech/cst-fin-micro01.html>

Re: how are you guys using Velocity with HTML generation tools?

Posted by Jon Stevens <jo...@latchkey.com>.
on 6/1/01 12:48 PM, "Randall G. Alley" <ir...@bellsouth.net> wrote:

> Sure, you could do that if you like to type.

How is that more typing than what you were proposing?

-jon

-- 
Open source is not available to commercial companies.
            -Steve Balmer, CEO Microsoft
<http://www.suntimes.com/output/tech/cst-fin-micro01.html>


Re: how are you guys using Velocity with HTML generation tools?

Posted by "Randall G. Alley" <ir...@bellsouth.net>.
Sure, you could do that if you like to type.

Jon Stevens wrote:

> How about this:
>
> <!-- #if() -->
>
> Alskjdflasdf
>
> <!-- #else -->
>
> Alsjksaldkf
>
> <!-- #end -->
>
> <!-- #foreach() -->
>
> Asdfasdf
>
> <!-- #end -->
>
> <!-- #set() -->
>
> -jon
>
> on 6/1/01 8:35 AM, "Randall G. Alley" <ir...@bellsouth.net> wrote:
>
> > Hi guys !
> >
> > I've been working on using Velocity with Dreamweaver 3.0 a bit since the topic
> > last came up. I've had some success using the Third Party Tags to identify
> > Velocity directives. I discussed this with Geir a while back, and came to the
> > conclusion that there was no easily identifiable end tag other than the right
> > parentheses, and that was problematic because other embedded statements might
> > have right parentheses as well.
> >
> > So needing a readily distinguishable end tag, I chose the convention that the
> > last closing parentheses would have a space in front, ie " )", but no spaces
> > before right parentheses in embedded tags. Another alternative would be to set
> > the <cr><lf> as the end tag, but I couldn't figure out how to do that. The
> > space-parentheses method also allows HTML on the same line after the directive
> > to be seen by Dreamweaver.
> >
> > For directives, like #end and #else, that tend to be displayed on single
> > lines,
> > the end tag is simply a space, ie " ". See the attached VM.xml file. This must
> > be placed in Dreamweaver's Third Party Tag directory.
> >
> > Admittedly this is a bit of a kludge, but it works pretty well for simple
> > Velocity. You have to be careful about remembering to insert the spaces of
> > course. It's easy to forget ! Luckily, you quickly see something's missing in
> > DW, and you can easily fix it.
> >
> > Finally, I usually want to see the contents of either the #if or #else block.
> > This can be accomplished by using a clever references like (thanks to the
> > WebMacro guys for this hint !):
> >
> > #set( $beginHtmlComment = "<!--" )
> > #set( $endHtmlComment = "-->" )
> >
> > Then an example of usage is:
> >
> > #if( $flarg )
> >
> > <!-- $endHtmlComment
> > stuff to hide goes here
> > $beginHtmlComment -->
> >
> > #else
> >
> > stuff to show goes here
> >
> > #end
> >
> > Dreamweaver would show the stuff in the #else block, but not stuff in the #if
> > block.
> >
> > I've attached the Third Party Tags file I use. This is not a complete list,
> > and
> > you'll have to add any macros you use, but you can see how it's done in the
> > file.
> >
> > You also need to add .vm to the list of extensions that don't allow Rewriting
> > HTML.
> > Edit/Preferences/HTML Rewriting/Never Rewrite HTML
> >
> > These methods only work for pretty simple Velocity, and won't display a list
> > of
> > table entries generated by a #for loop,
> > for example. But you can see one example entry, and visualize the rest until
> > you
> > see the result from Velocity itself.
> >
> > I am an HTML simpleton, so I enjoy formatting tables and lists in DW.  I have
> > no
> > idea how well these methods will translate to later versions of DW and
> > UltraDev.
> >
> > Hope this helps,
> > Randy

Re: how are you guys using Velocity with HTML generation tools?

Posted by Jon Stevens <jo...@latchkey.com>.
How about this:

<!-- #if() -->

Alskjdflasdf

<!-- #else -->

Alsjksaldkf

<!-- #end -->

<!-- #foreach() -->

Asdfasdf

<!-- #end -->

<!-- #set() -->

-jon

on 6/1/01 8:35 AM, "Randall G. Alley" <ir...@bellsouth.net> wrote:

> Hi guys !
> 
> I've been working on using Velocity with Dreamweaver 3.0 a bit since the topic
> last came up. I've had some success using the Third Party Tags to identify
> Velocity directives. I discussed this with Geir a while back, and came to the
> conclusion that there was no easily identifiable end tag other than the right
> parentheses, and that was problematic because other embedded statements might
> have right parentheses as well.
> 
> So needing a readily distinguishable end tag, I chose the convention that the
> last closing parentheses would have a space in front, ie " )", but no spaces
> before right parentheses in embedded tags. Another alternative would be to set
> the <cr><lf> as the end tag, but I couldn't figure out how to do that. The
> space-parentheses method also allows HTML on the same line after the directive
> to be seen by Dreamweaver.
> 
> For directives, like #end and #else, that tend to be displayed on single
> lines,
> the end tag is simply a space, ie " ". See the attached VM.xml file. This must
> be placed in Dreamweaver's Third Party Tag directory.
> 
> Admittedly this is a bit of a kludge, but it works pretty well for simple
> Velocity. You have to be careful about remembering to insert the spaces of
> course. It's easy to forget ! Luckily, you quickly see something's missing in
> DW, and you can easily fix it.
> 
> Finally, I usually want to see the contents of either the #if or #else block.
> This can be accomplished by using a clever references like (thanks to the
> WebMacro guys for this hint !):
> 
> #set( $beginHtmlComment = "<!--" )
> #set( $endHtmlComment = "-->" )
> 
> Then an example of usage is:
> 
> #if( $flarg )
> 
> <!-- $endHtmlComment
> stuff to hide goes here
> $beginHtmlComment -->
> 
> #else
> 
> stuff to show goes here
> 
> #end
> 
> Dreamweaver would show the stuff in the #else block, but not stuff in the #if
> block.
> 
> I've attached the Third Party Tags file I use. This is not a complete list,
> and
> you'll have to add any macros you use, but you can see how it's done in the
> file.
> 
> You also need to add .vm to the list of extensions that don't allow Rewriting
> HTML.
> Edit/Preferences/HTML Rewriting/Never Rewrite HTML
> 
> These methods only work for pretty simple Velocity, and won't display a list
> of
> table entries generated by a #for loop,
> for example. But you can see one example entry, and visualize the rest until
> you
> see the result from Velocity itself.
> 
> I am an HTML simpleton, so I enjoy formatting tables and lists in DW.  I have
> no
> idea how well these methods will translate to later versions of DW and
> UltraDev.
> 
> Hope this helps,
> Randy


Re: how are you guys using Velocity with HTML generation tools?

Posted by "Randall G. Alley" <ir...@bellsouth.net>.
Hi guys !

I've been working on using Velocity with Dreamweaver 3.0 a bit since the topic
last came up. I've had some success using the Third Party Tags to identify
Velocity directives. I discussed this with Geir a while back, and came to the
conclusion that there was no easily identifiable end tag other than the right
parentheses, and that was problematic because other embedded statements might
have right parentheses as well.

So needing a readily distinguishable end tag, I chose the convention that the
last closing parentheses would have a space in front, ie " )", but no spaces
before right parentheses in embedded tags. Another alternative would be to set
the <cr><lf> as the end tag, but I couldn't figure out how to do that. The
space-parentheses method also allows HTML on the same line after the directive
to be seen by Dreamweaver.

For directives, like #end and #else, that tend to be displayed on single lines,
the end tag is simply a space, ie " ". See the attached VM.xml file. This must
be placed in Dreamweaver's Third Party Tag directory.

Admittedly this is a bit of a kludge, but it works pretty well for simple
Velocity. You have to be careful about remembering to insert the spaces of
course. It's easy to forget ! Luckily, you quickly see something's missing in
DW, and you can easily fix it.

Finally, I usually want to see the contents of either the #if or #else block.
This can be accomplished by using a clever references like (thanks to the
WebMacro guys for this hint !):

#set( $beginHtmlComment = "<!--" )
#set( $endHtmlComment = "-->" )

Then an example of usage is:

#if( $flarg )

<!-- $endHtmlComment
stuff to hide goes here
$beginHtmlComment -->

#else

stuff to show goes here

#end

Dreamweaver would show the stuff in the #else block, but not stuff in the #if
block.

I've attached the Third Party Tags file I use. This is not a complete list, and
you'll have to add any macros you use, but you can see how it's done in the
file.

You also need to add .vm to the list of extensions that don't allow Rewriting
HTML.
Edit/Preferences/HTML Rewriting/Never Rewrite HTML

These methods only work for pretty simple Velocity, and won't display a list of
table entries generated by a #for loop,
for example. But you can see one example entry, and visualize the rest until you
see the result from Velocity itself.

I am an HTML simpleton, so I enjoy formatting tables and lists in DW.  I have no
idea how well these methods will translate to later versions of DW and UltraDev.

Hope this helps,
Randy

Francisco Hernandez wrote:

> damm its not working exactly as i thought it would in Dreamweaver,
>
> this is my HTML:
>
> <html>
> <head>
> <style type="text/css">
> <!--
> .velocity {
>     Display: none;
> }
> -->
> </style>
> <body>
> <span class="velocity">
> i c u
> </span>
> </body>
> </html>
>
> changing none to inline and vice versa works for great in IE, but IE's not
> the problem, its Dreamweaver, i didnt want the designer to to see any of the
> foreach/if etc and have it mess up his design
>
> ----- Original Message -----
> From: "Neil Henderson" <ne...@softtech.co.nz>
> To: <ve...@jakarta.apache.org>
> Sent: Thursday, May 31, 2001 8:53 PM
> Subject: RE: how are you guys using Velocity with HTML generation tools?
>
> >
> >
> > >Isn't it a *must* to strip them to allow the velocity-generated content
> > >to be displayed?
> >
> > All i use them to strip out is the decision type template commands lie
> > #foreach which doesn't matter as they don't get displayed. I usually want
> to
> > see the others to see how data gets displayed around the page.
> >
> > If you want to strip all the velocity commands out while viewing you can
> > still put the span tags in and just switch the "Display:none" to
> > "Display:inline" in the style sheet.
> >
> > Allowing that the style sheet is likely to be used site wide it's an easy
> > change.
> >
> > NEIL
> >
> >

Re: how are you guys using Velocity with HTML generation tools?

Posted by Francisco Hernandez <xy...@earthlink.net>.
damm its not working exactly as i thought it would in Dreamweaver,

this is my HTML:

<html>
<head>
<style type="text/css">
<!--
.velocity {
    Display: none;
}
-->
</style>
<body>
<span class="velocity">
i c u
</span>
</body>
</html>

changing none to inline and vice versa works for great in IE, but IE's not
the problem, its Dreamweaver, i didnt want the designer to to see any of the
foreach/if etc and have it mess up his design



----- Original Message -----
From: "Neil Henderson" <ne...@softtech.co.nz>
To: <ve...@jakarta.apache.org>
Sent: Thursday, May 31, 2001 8:53 PM
Subject: RE: how are you guys using Velocity with HTML generation tools?


>
>
> >Isn't it a *must* to strip them to allow the velocity-generated content
> >to be displayed?
>
> All i use them to strip out is the decision type template commands lie
> #foreach which doesn't matter as they don't get displayed. I usually want
to
> see the others to see how data gets displayed around the page.
>
> If you want to strip all the velocity commands out while viewing you can
> still put the span tags in and just switch the "Display:none" to
> "Display:inline" in the style sheet.
>
> Allowing that the style sheet is likely to be used site wide it's an easy
> change.
>
> NEIL
>
>


RE: how are you guys using Velocity with HTML generation tools?

Posted by Neil Henderson <ne...@softtech.co.nz>.

>Isn't it a *must* to strip them to allow the velocity-generated content
>to be displayed?

All i use them to strip out is the decision type template commands lie
#foreach which doesn't matter as they don't get displayed. I usually want to
see the others to see how data gets displayed around the page.

If you want to strip all the velocity commands out while viewing you can
still put the span tags in and just switch the "Display:none" to
"Display:inline" in the style sheet.

Allowing that the style sheet is likely to be used site wide it's an easy
change.

NEIL



Re: how are you guys using Velocity with HTML generation tools?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Neil Henderson wrote:
> 
> In microsoft interdev i just set up a style sheet so that a span tag with
> class=hidden doesn't get displayed.
> 
> The equivlent of setting
> 
> <span style="Dislpay : none">
> velocity template directives
> </span>
> 
> And i just put the span tags around the velocity template directives. gets
> round the problem nicely but does add span tags around the place. these can
> be stripped out for a final server version though.
> 

Isn't it a *must* to strip them to allow the velocity-generated content
to be displayed?

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!

RE: how are you guys using Velocity with HTML generation tools?

Posted by Neil Henderson <ne...@softtech.co.nz>.
In microsoft interdev i just set up a style sheet so that a span tag with
class=hidden doesn't get displayed.

The equivlent of setting

<span style="Dislpay : none">
velocity template directives
</span>

And i just put the span tags around the velocity template directives. gets
round the problem nicely but does add span tags around the place. these can
be stripped out for a final server version though.

NEIL


for example with Adobe GoLive and Macromedia Dreamweaver, how are you guys
hiding the Velocity template directives from the HTML?

Id (well actually the graphic designer/artist) like to be able to open a
Velocity template in one of these tools and not have the directives scew the
look.

in Dreamweaver we were able to hide anything inside <??> <%%> tags.

thanks in advance.