Merge / manipulate an array using speed

I have an array installed inside a speed template that contains some paths.
The idea is to put several default .js / .css files that will use 90% of the pages in this array.
However, other pages should still be able to add / remove values ​​from this array if they don't have related files, 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 / remove values ​​from these default values?
I saw this tool, but it seems that this is not enough for what I need.

+7
velocity
source share
1 answer

If this array is created in Velocity, then it is supported by the ArrayList class, so it supports all the relevant methods.

 $head.scripts.add("new element") $head.scripts.remove(0) 
+12
source share

All Articles