tag:help-archives.hannonhill.com,2010-02-09:/discussions/velocity-formats/10274-velocity-private-variablesCascade CMS: Discussion 2014-07-22T13:11:22Ztag:help-archives.hannonhill.com,2010-02-09:Comment/338494562014-07-22T12:23:14Z2014-07-22T12:23:14ZVelocity Private Variables<div><p>Hi Justin,</p>
<p>It sounds like this change may be limited to just the
<code>$macro</code> variable within macro definitions, which seems
similar to the <code>$foreach</code> scope variable that is
available within foreach loops. Unfortunately, it may be very
difficult to tell how a change like this would affect Velocity
Formats for existing clients, because every Format can be so
unique.</p>
<p>If you feel this would be a good feature to add to Velocity
Formats, I highly recommend adding a suggestion on our <a href=
"http://ideas.hannonhill.com/">Idea Exchange</a> for others to vote
up and/or comment on. This would help us determine use cases and
overall popularity of the functionality.</p>
<p>For the variables that need to be scoped, you could perhaps try
resetting the value at the end of the macro, or before it is called
recursively.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/338494562014-07-22T12:54:30Z2014-07-22T12:54:30ZVelocity Private Variables<div><p>Thanks for the info Ryan. I didn't realize there was a $foreach
variable scope already.</p>
<p>I created the following idea on the Idea Exchange: <a href=
"http://ideas.hannonhill.com/forums/52559-ideas-for-cascade-server/suggestions/6201761-private-variables-in-velocity">
http://ideas.hannonhill.com/forums/52559-ideas-for-cascade-server/s...</a></p></div>Justin "JET" Turnertag:help-archives.hannonhill.com,2010-02-09:Comment/338494562014-07-22T13:11:17Z2014-07-22T13:11:17ZVelocity Private Variables<div><p>Perfect, thank you for posting to the Idea Exchange, Justin.</p>
<blockquote>
<p>I didn't realize there was a $foreach variable scope
already.</p>
</blockquote>
<p>Yup, definitely useful if you need to know if there are more
items to loop over, or the total count. More information about this
scope variable can be <a href=
"http://www.hannonhill.com/kb/Script-Formats/#engine_improvements">found
here</a>.</p>
<p>I'm going to go ahead and close this discussion, please feel
free to comment or reply to re-open if you have any additional
questions.</p>
<p>Have a great day!</p></div>Ryan Griffith