Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Velocity: Is a any way to check if variable is defined

I want to include one template nested into others cont1, cont2, cont3. And nested template should be hide one specific control for cont1 only. Before inclusion into cont1 I would like to assign value to some flag variable $hideMyControl.

And inside nested template I would like to check if $hideMyControl is assigned value.

How to perform such check?

like image 220
sergtk Avatar asked Jan 28 '11 06:01

sergtk


People also ask

What is a Velocity variable?

When the displacement of the body is different in equal interval of time then the velocity is variable velocity. or variable velocity can also be defined as. velocity in which the space described varies from instant to instant, either increasing or decreasing is called variable velocity.

What is Apache Velocity used for?

Velocity can be used to generate web pages, SQL, PostScript and other output from templates. It can be used either as a standalone utility for generating source code and reports, or as an integrated component of other systems.

How do I test a Velocity template?

Approach 1: The obvious approach: Run and check. Run Velocity against the template to be checked. Look at the output and see if it is what you desired. This must be the most primitive testing approach, but most people nowadays are too lazy and want this done by the computer.

What is Velocity Engine in Java?

Velocity is a Java-based templating engine. It's an open source web framework designed to be used as a view component in the MVC architecture, and it provides an alternative to some existing technologies such as JSP. Velocity can be used to generate XML files, SQL, PostScript and most other text-based formats.


1 Answers

#if($hideMyControl)     // your code #end 

If $hideMyControl is defined, your code will execute

like image 98
onlinehood Avatar answered Sep 21 '22 15:09

onlinehood