I think that appraoch will work but you might need to create your own array of locaitons and register it too. Maybe try something like this:
Code:
while ($wp_alist = $vbulletin->db->fetch_array($wp_fulllist))
{
$locations[] = htmlspecialchars($wp_alist['location']);
$wp_list[] = array(
'id' => htmlspecialchars($wp_alist['id']),
'name' => htmlspecialchars($wp_alist['name']),
'locid' => htmlspecialchars($wp_alist['locid']),
'location' => htmlspecialchars($wp_alist['location']),
'url' => htmlspecialchars($wp_alist['url'])
);
}
$locations = array_unique($locations);
$templater->register('wp_list', $wp_list);
$templater->register('wp_locations', $locations);
and then in your template:
Code:
<vb:each from="wp_locations" value="location">
<h1>{vb:raw location}</h1>
<vb:each from="wp_list" value="list">
<vb:if condition="$list['location'] == $location">
<tr>
<td>{vb:raw list.location}</td>
<td><a href="{vb:raw list.url}">{vb:raw list.name}</a></td>
</tr>
</vb:if>
</vb:each>
</vb:each>
I'm not sure of there's any way to use the value from the outer vb:each to specify the inner vb:each array. That would make things a little more efficient.