Array merging/manipulation with Velocity
Posted
by Razor
on Stack Overflow
See other posts from Stack Overflow
or by Razor
Published on 2010-03-29T11:57:14Z
Indexed on
2010/03/29
12:03 UTC
Read the original article
Hit count: 316
velocity
Hello,
I have an array set inside a velocity template that contains some paths.
The idea is to put a few "default" .js/.css files that 90% of the pages will use in this array.
However, the other pages will still have to be able to add/delete values from this array, in case there are no linked files at all, or I need to add some.
Given this code:
#set ( $head.scripts = [ "https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js" ] )
#foreach ($URI in $head.scripts)
<script type="text/javascript" src="$URI"></script>
#end
is there any way to add/delete values from these defaults?
I have seen this list tool, but it looks like it's not enough for what I need.
© Stack Overflow or respective owner