0

I have this Velocity file, called styles.vm for exemple.

<HTML>
   <HEAD>
       #IF(client == 1)
       <link rel="stylesheet" type="text/css" href="client1.css">
       #ELSE IF (client == 2)
       <link rel="stylesheet" type="text/css" href="client2.css">
       #ELSE IF (client == 3)
       <link rel="stylesheet" type="text/css" href="client3.css">
       #ELSE IF (client == 4)
       <link rel="stylesheet" type="text/css" href="client4.css">
       .
       .
       .
       #END
   <HEAD>
</HTML>

And I have a bunch of .VMs and .JSPs files, that I need to set their CSS without copy all those conditions in each file again. In short, I want to use the CSS settled in other file, is it possible, doing a include or something like that ? If necessary I can use JQuery too, because all these files in this project has Jquery imported.

1
  • You should consider string concatenation. Commented Jun 24, 2015 at 3:40

1 Answer 1

1

If you want to include a template, for example "styles.vm", in another template, you could do:

#parse("/path/to/styles.vm")

The #parse script element allows the template designer to import a local file that contains VTL. Velocity will parse the VTL and render the template specified.

Read more about the #parse script in the Velocity Documentation.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.