Okay, for anyone who wants to do the same thing, here's the complete story:
You need the ECB and the LinkMgr module. Using the ECB module you create a content block for the backend by placing this in your page template:
Code: Select all
{content_module module="ECB" tab="Links" field="sortablelist" block="testsortablelist" label="Choose the links to display" allowduplicates='false' label_left="Links that will be displayed" label_right="Available links" udt='links' assign='links'}
You see the values come from a UDT. You have to create it by pasting this code:
Code: Select all
$db = cmsms()->GetDb();
$query = 'SELECT l.*, lc.link_category FROM ' . cms_db_prefix() . 'module_linkmgr_links l LEFT JOIN '.cms_db_prefix().'module_linkmgr_categories lc ON l.link_cat = lc.cat_id ORDER BY link_category,link_name ASC';
$dbresult =& $db->Execute($query);
$items = Array();
$rowclass = 'row1';
while ($dbresult && $row = $dbresult->FetchRow()){
$items[$row['link_url']] = $row['link_name'];
}
return $items;
Save it as 'links'. This code retrieves all the available links from the Link Manager from the database.
In the first block of code (that goes in your page template) you see the result will be assigned to a variable names 'links'.
That variable will be passed into an array, by placing this code into your page template, below the first code block:
Code: Select all
{assign var='linkarray' value=','|explode:$links}
Now you have an array available that contains the URL's to the links you selected for this page.
Now edit the default template for the Link Manager, so it looks like this:
Code: Select all
<div class="linkmgr">
<ul>
{foreach from=$items item='item'}
{foreach from=$linkarray item='link'}
{if $link == $item.link_url}
<li><a href="{$item.link_url}" target="_blank">{$item.link_name}</a><br />{$item.link_desc|default:''}</li>
{/if}
{/foreach}
{/foreach}
</ul>
</div>
I added a loop through the previously mentioned 'linkarray' we created in the page template, and created a variable named 'link' for each instance in the array. Now via the {if} statement, we check if the $link variable matched the $item.link_url variable that comes from the module itself. So here basically you filter all links to show only the ones you added to the $linkarray and presto: your output will be only the links you selected. Of course you have to call the {LinkMgr} somewhere in you page or page template to actually display these.
EDIT: to-do, create an escape so that the LinkMgr won't be called when no links are selected. You could create an {if} statement around the {LinkMgr} call that checks if the {$linkarray} is empty