« Return to Thread: Issue with $velocityCount in 1.5

Re: Issue with $velocityCount in 1.5

by wglass :: Rate this Message:

Reply to Author | View in Thread

Matt,

I've created issue VELOCITY-532 concerning this:
https://issues.apache.org/jira/browse/VELOCITY-532

Can you please list your Velocity macro-related configuration
settings, particularly
velocimacro.context.localscope

It'd be easiest if you list this in the bug report, although if you
want to just reply to this message I'll add them in.

WILL

On 3/22/07, mraible <matt@...> wrote:

>
> I'm only using it in a macro, so I can't really answer this question.  I can
> send the output from 1.4 vs. 1.5 and out printouts (i.e. count =
> $velocityCount) if you like.
>
> Matt
>
>
> Will Glass-Husain-2 wrote:
> >
> > Does it only fail in macros or does it always fail?
> >
> > I'll take a look at this today.  Thanks for the detailed example.
> >
> > WILL
> >
> > On 3/22/07, mraible <matt@...> wrote:
> >>
> >> I've been using Velocity 1.4 for a couple of years now with great
> >> success.
> >> Today, I tried to use Struts Menu 2.4.2 with Velocity 1.5 and found an
> >> issue
> >> with $velocityCount not being properly processed. My template is below.
> >>
> >> The problem occurs on the following line:
> >>
> >>         #if ($velocityCount == $menu.parent.components.size())
> >>           <li class="last">
> >>         #else
> >>
> >> With 1.4, $velocityCount turns into a number when the displayCssMenu
> >> macro
> >> is called from #foreach. However, in 1.5, it's never turned into a
> >> number.
> >>
> >> Any ideas?
> >>
> >> Thanks,
> >>
> >> Matt
> >>
> >> #macro( displayCssMenu $menu )
> >>   #if ($displayer.isAllowed($menu))
> >>     ## set menu title
> >>     #set ($title = $displayer.getMessage($menu.title))
> >>
> >>     #if (!$menu.url) #set ($url="javascript:void(0)") #else #set
> >> ($url=$menu.url) #end
> >>
> >>     ## create a single menu item
> >>     #if ($menu.components.size() == 0)
> >>         #if ($velocityCount == $menu.parent.components.size())
> >>           <li class="last">
> >>         #else
> >>           <li>
> >>         #end
> >>         #if ($menu.name == $currentMenu)
> >>            $url ${title}
> >>         #else
> >>            $url ${title}
> >>         #end
> >>     #else ## create multiple menu items in a menu
> >>         #if ($menu.components.size() > 0)
> >>             #set ($hasViewableChildren = false)
> >>             #foreach ($menuIt in $menu.components)
> >>                 #if ($displayer.isAllowed($menuIt))
> >>                     #set($hasViewableChildren = true)
> >>                 #end
> >>             #end
> >>         #end
> >>
> >>         <li#if ($hasViewableChildren) class="menubar"#end>
> >>            $url ${title}
> >>     #end
> >>
> >>     #if ($menu.components.size() > 0)
> >>         #if ($hasViewableChildren)
> >>           <ul>
> >>         #end
> >>
> >>         #foreach ($menuIt in $menu.components)
> >>             #displayCssMenu($menuIt)
> >>         #end
> >>
> >>         #if ($hasViewableChildren && ($velocityCount ==
> >> $menu.parent.components.size()))
> >>           </ul>
> >>         #else
> >>           </li>
> >>         #end
> >>     #else
> >>       </li>
> >>       #if ($velocityCount == $menu.parent.components.size())
> >>       </ul>
> >>       #end
> >>     #end
> >>   #end
> >> #end
> >>
> >> #displayCssMenu($menu)
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Issue-with-%24velocityCount-in-1.5-tf3449438.html#a9621118
> >> Sent from the Velocity - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@...
> >> For additional commands, e-mail: user-help@...
> >>
> >>
> >
> >
> > --
> > Forio Business Simulations
> >
> > Will Glass-Husain
> > wglass@...
> > www.forio.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@...
> > For additional commands, e-mail: user-help@...
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Issue-with-%24velocityCount-in-1.5-tf3449438.html#a9621718
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>
>


--
Forio Business Simulations

Will Glass-Husain
wglass@...
www.forio.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...

 « Return to Thread: Issue with $velocityCount in 1.5