Looping over a structure into a query

Thanks to CF-talk, have worked out a way to get my posted form structs into queries a little more easily;
It’s the “#testStruct[“UrlText_” & counter]#” syntax which was the key for me.. posted here for my own reference!

<cfset testStruct = structnew() />
<cfset testStruct.LinkText_1 = "Linktest1" />
<cfset testStruct.LinkText_2 = "Linktest2" />
<cfset testStruct.LinkText_3 = "Linktest3" />
<cfset testStruct.UrlText_1 = "Urltest1" />
<cfset testStruct.UrlText_2 = "Urltest2" />
<cfset testStruct.UrlText_3 = "Urltest3" />
<cfset TempLinkQ=QueryNew("linkname,url", "varchar,varchar")>

<cfdump var="#testStruct#" />

<cfset counter =1>
<cfloop list="#structKeyList(testStruct)#" index="key">
<cfif key CONTAINS "linktext" AND len(teststruct[key]) GTE 1>
<cfset QueryAddRow(TempLinkQ, 1)>
<cfset QuerysetCell(TempLinkQ, "linkname", "#testStruct["linkText_" & counter]#")>
<cfset QuerysetCell(TempLinkQ, "url", "#testStruct["UrlText_" & counter]#")>

<cfset counter=(counter+1)>

<cfdump var="#TempLinkQ#">

Drupal 6 – output your primary links as a Site Map

This took me a while to find: In Drupal 6, I wanted to output the main Primary Links menu item, expanded, as a site map:

Simply add the following to a node (with PHP parsing ON!)

$tree = menu_tree_all_data($menu_name = ‘primary-links’, $item = NULL);
print menu_tree_output($tree);