forked from jayallen/melody
-
Notifications
You must be signed in to change notification settings - Fork 36
Melody Cookbook: Create a blogroll with ConfigAssistant
mikert edited this page Feb 26, 2011
·
2 revisions
The first step is to define a configuration option which creates a link group. This is an example of such a configuration option. It creates one named Blogroll, which exposes a new template tag called Blogroll.
widgets_blogroll:
label: Blogroll
type: link-group
fieldset: fs_widgets
tag: Blogroll
hint: This manages the blogroll widget
The second step is to create a widget. This is an example of how to lay it out.
<div>
<h3>My Blogroll</h3>
<mt:BlogrollLinks>
<mt:If name="__first__">
<ul>
</mt:If>
<li>
<a href="<$mt:var name="link_url"$>">
<$mt:var name="link_label"$>
</a>
</li>
<mt:If name="__last__">
</ul>
</mt:If>
</mt:BlogrollLinks>
</div>
The reason that mt:Blogroll is actually accessed as mt:BlogrollLinks is because ConfigAssistant generates two template tags based on that one configuration option. mt:Blogroll is just a function tag that returns the raw value specified by the user in Theme Options. mt:BlogrollLinks is a block tag that sets up a special "links context" where certain variables are set for you to use. These are:
link_label
link_url
__first__
__last__