This module allows you to pull information contained in fields from multiple ListIt2 instances into your current ListIt2 instance. The information may be the remote modules' Title, Alias or data from a custom field definition.
In short, it takes the concept of Categories and Hierarchies one step further. Each ListI2 custom module can have as many fields as you like and in the information can be shared, either directly in another module OR assigned to a variable and then used to display a list of items from another module that meet the criteria, eg:
The possibilities are endless. It's up to your imagination and template skills!
Use this field definition type sparingly in your LI2 modules. It will add load to the frontend display with it's extra database calls etc and may become confusing for the admin to manage with lots of cross-linked modules.
Suggest you use no more than two or three XLinks per module.
You must have a working knowledge of ListIt2 and Field Definitions and at least 2 standalone custom ListIt2 instances.
The following standard ListIt2 field type definitions work with ListIt2XLink:
The following standard ListIt2 field type definitions do not work, nor are they likely to. There are other roads up the mountain, eg use the Alias option and assign it to a variable, then make an independent call to the relevant ListIt2 instance and filter by the assigned var.
There is no guarantee that third party field definition types will work with ListIt2XLinks. See above.
Field Definition Tab
In your templates
To ensure that the information displayed (or assigned to a variable) on the front end is current and to avoid database bloat, no data from remote modules is stored in your current XLink field definition - only ids. This means a little bit more processing
is required by your current module to output the correct data. To do this, you need to place the following module call tag in your template:
{ListIt2XLink fielddef_id=$fielddef->GetId() mod=$mod->GetName() item_id=$item->item_id }.
Please note: the previous example accesses the fielddef obj via a loop, eg in the default Summary Template, change if from:
{if !empty($item->fielddefs)}
<!-- field definitions -->
<div class="item-properties">
{foreach from=$item->fielddefs item=fielddef}
{*
Categories were moved to field definitions.
If you need Categories, create new Field definition with alias "category"
and Categories will be available again.
*}
{if $fielddef.type == 'Categories' && ($fielddef.value != '')}
{* use ListIt2Loader plugin if you need Category information in default module action templates *}
{ListIt2Loader item='category' force_array=1 value=$fielddef.value assign='cats'}
<!-- categories -->
<div class="item-category">
Category: {$cats|implode:','}
</div>
<!-- categories //-->
{/if}
{if $fielddef.value && $fielddef.type != 'Categories'}
{if $fielddef.type == 'SelectFile' || $fielddef.type == 'FileUpload'}
{$fielddef.name}: <a href="{$fielddef->GetImagePath(true)}/{$fielddef.value}">{$fielddef.value}</a><br />
{elseif $fielddef.type == 'SelectDateTime'}
{$fielddef.name}: {$fielddef.value|cms_date_format}<br />
{else}
{$fielddef.name}: {$fielddef.value}<br />
{/if}
{/if}
{/foreach}
</div>
<!-- field definitions //-->
to
{if !empty($item->fielddefs)}
<!-- field definitions -->
<div class="item-properties">
{foreach from=$item->fielddefs item=fielddef}
{if $fielddef.type == 'Categories' && ($fielddef.value != '')}
{* use ListIt2Loader plugin if you need Category information in default module action templates *}
{ListIt2Loader item='category' force_array=1 value=$fielddef.value assign='cats'}
<!-- categories -->
<div class="item-category">
Category: {$cats|implode:','}
</div>
<!-- categories //-->
{/if}
{if $fielddef.value && $fielddef.type != 'Categories'}
{if $fielddef.type == 'SelectFile' || $fielddef.type == 'FileUpload'}
{$fielddef.name}: <a href="{$fielddef->GetImagePath(true)}/{$fielddef.value}">{$fielddef.value}</a><br />
{elseif $fielddef.type == 'SelectDateTime'}
{$fielddef.name}: {$fielddef.value|cms_date_format}<br />
{elseif $fielddef.type == 'XLink'}
{$fielddef.name}: {ListIt2XLink fielddef_id=$fielddef->GetId() mod=$mod->GetName() item_id=$item->item_id }
{else}
{$fielddef.name}: {$fielddef.value}<br />
{/if}
{/if}
{/foreach}
</div>
<!-- field definitions //-->
{/if}
When not in a loop for fielddefs, directy access the fielddef as normal, eg:
{ListIt2XLink fielddef_id=$item->fielddefs.myxlinkfield->GetId() mod=$mod->GetName() item_id=$item->item_id }
This module does not include commercial support. However, there are a number of resources available to help you with it:
As per the GPL, this software is provided as-is. Please read the text of the license for the full disclaimer.
Remember to report any issues with this module in the ListIt2XLink forge page. This is an add-on module and not part of the ListIt2 project itself.
Copyright © 2013, Clip Magic <admin@clipmagic.com.au>. All Rights Are Reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
However, as a special exception to the GPL, this software is distributed as an addon module to CMS Made Simple. You may not use this software in any Non GPL version of CMS Made simple, or in any version of CMS Made simple that does not indicate clearly and obviously in its admin section that the site was built with CMS Made simple.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Or read it online