Link LISE items to Menu

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
brentnl
Power Poster
Power Poster
Posts: 493
Joined: Mon May 11, 2009 4:35 pm

Link LISE items to Menu

Post by brentnl »

Hi,

I've a LISE-module and want to link every item to its own content-page.

It's for a medical-website where every treatment has it's own page and where every treatment also has a certain specialist (a person). Those specialists are listed in a LICE-instance.

I know it's possible to add a 'content page field definition', but a want to do it the other way arround. So I want to achieve a dropdown or somekind while editing a contentpage were I could select a LISEitem (the person/specialist).

What is the easiest way to achieve this?
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Link LISE items to Menu

Post by velden »

Just an idea: wouldn't it be possible to use LISE as a replacement for the specific content pages?

There are ways to 'insert' LISE links into the menu.

If not I would have a look at http://dev.cmsmadesimple.org/projects/ecb2 and create a UDT to fill the dropdown_from_udt content block.

The LISE api allows for creating such an UDT or it could be a rather simple database query too. I don't have a working example though.
brentnl
Power Poster
Power Poster
Posts: 493
Joined: Mon May 11, 2009 4:35 pm

Re: Link LISE items to Menu

Post by brentnl »

velden wrote:...
There are ways to 'insert' LISE links into the menu.
..
How could this be done? ;D
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1619
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Link LISE items to Menu

Post by DIGI3 »

You can use CGContentUtilties to create a dropdown that displays a list of your LISE items. In CGCU create a dropdown block called 'lise_items' and put this in the 'options' field (replace [instance] with your instance name):

Code: Select all

{cms_module|strip_tags module='LISE[instance]' template_summary='options'}
Then in your LISE instance, create a summary template called 'options':

Code: Select all

{foreach from=$items item=item}
{$item->name}|{$item->alias}
{/foreach}
Then in your page template:

Code: Select all

{content_module module='CGContentUtils' block='lise_items'}
I'm going from memory so the above may not be exactly right, but it should be pretty close.
Not getting the answer you need? CMSMS support options
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Link LISE items to Menu

Post by velden »

Create a LISE summary template that outputs the html like you need it for your menu.

Inside the Navigator template create some logic to find the right place in the menu and insert a LISE tag with the specific template there.

Challenge will be to give a specific LISE item a 'current' or 'active' class when it's the selected 'page'. But not impossible.


Another option would be http://dev.cmsmadesimple.org/projects/cgsmartnav
brentnl
Power Poster
Power Poster
Posts: 493
Joined: Mon May 11, 2009 4:35 pm

Re: Link LISE items to Menu

Post by brentnl »

DIGI3 wrote:You can use CGContentUtilties to create a dropdown that displays a list of your LISE items. In CGCU create a dropdown block called 'lise_items' and put this in the 'options' field (replace [instance] with your instance name):

Code: Select all

{cms_module|strip_tags module='LISE[instance]' template_summary='options'}
Then in your LISE instance, create a summary template called 'options':

Code: Select all

{foreach from=$items item=item}
{$item->name}|{$item->alias}
{/foreach}
Then in your page template:

Code: Select all

{content_module module='CGContentUtils' block='lise_items'}
I'm going from memory so the above may not be exactly right, but it should be pretty close.
This works great so far!
And how can I access the other fields of the lise-item? I could do something like this;

Code: Select all

{capture assign="foo"}{content_module module='CGContentUtils' block='lise_items'}{capture}
 {LISE[instance] item='$foo' template_detail='page-view'}
But I rather have the fields available in the page-template itself, instead of making a detail-template in the LISE instance.
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1619
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Link LISE items to Menu

Post by DIGI3 »

You could create a detail template that assigns all of the fields to variables, which you can then call from within your page template anywhere after the lise call.

Also, try to avoid {capture}, it's more efficient to assign variables.

Code: Select all

{$foo="{content_module module='CGContentUtils' block='lise_items'}"}
Not getting the answer you need? CMSMS support options
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Link LISE items to Menu

Post by velden »

And how can I access the other fields of the lise-item? I could do something like this;
Code:
{capture assign="foo"}{content_module module='CGContentUtils' block='lise_items'}{capture}
{LISE[instance] item='$foo' template_detail='page-view'}
You could but it wouldn't work :-) Don't use variables inside single quotes, they won't be evaluated. Preferably don't use quotes at all around variables (and tags).

So, about this 'variables' being accessible in the page template. Consider this:

Create a LISE detail template (name 'empty') with only this code:

Code: Select all

{$LISEitem=$item scope=global}
Then in your page template, AFTER the

Code: Select all

{content_module module='CGContentUtils' block='lise_items' assign=foo}
(note the assign parameter, obviously the best and easiest way to assign the output to a variable in this case)

Code: Select all

{LISEinstance item=$foo template_detail=empty action=detail assign=dummy}
assign=dummy is optional because the 'empty' template should not output anything anyway.

Now you can use in your page template the $LISEitem OBJECT like you would inside the LISE detail template itself (but use $LISEitem instead of $item).

E.g.:

Code: Select all

$LISEitem->title
$LISEitem->fielddefs['<FIELDDEF_ALIAS>']->value
Locked

Return to “Modules/Add-Ons”