5 October 2014

Keywords: tree,menu,drag,drop

The users of etc_link_helper often asked for an easy drag-and-drop interface for (sub)menu creation. Transforming Textpattern into a “Word for Web” would be the last of my wishes, but providing a minimal visual helper for non-techy users seemed reasonable. Adapting etc_link_helper (work in progress) has turned out to be a non-trivial task, hence etc_tree was born.

Once installed and activated, etc_tree will add a tab under “Extensions”, where you can easily create and populate an arbitrary number of trees. These trees can be used e.g. as navigation menus on the public side, where you can add any type of node (link, image, txp tag…). That’s how it looks on the admin side:

and it’s up to you to style its output on the public side:

Now for the geeky part. One often lacks the ability to recursively call output forms in Textpattern. Now you can do it with etc_tree. This snippet

<txp:etc_tree circular="3" wraptag="" break="">
	<txp:category_list wraptag="ul" break="li" parent='<txp:category />' exclude='<txp:category />' children="0">
		<txp:category title="1" link="1" />
		<txp:etc_tree />

will produce a nested (up to three levels) list of categories: