Link LISE items to Menu
Link LISE items to Menu
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?
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?
Re: Link LISE items to Menu
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.
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.
Re: Link LISE items to Menu
How could this be done?velden wrote:...
There are ways to 'insert' LISE links into the menu.
..
Re: Link LISE items to Menu
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):
Then in your LISE instance, create a summary template called 'options':
Then in your page template:
I'm going from memory so the above may not be exactly right, but it should be pretty close.
Code: Select all
{cms_module|strip_tags module='LISE[instance]' template_summary='options'}
Code: Select all
{foreach from=$items item=item}
{$item->name}|{$item->alias}
{/foreach}
Code: Select all
{content_module module='CGContentUtils' block='lise_items'}
Not getting the answer you need? CMSMS support options
Re: Link LISE items to Menu
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
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
Re: Link LISE items to Menu
This works great so far!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):
Then in your LISE instance, create a summary template called 'options':Code: Select all
{cms_module|strip_tags module='LISE[instance]' template_summary='options'}
Then in your page template:Code: Select all
{foreach from=$items item=item} {$item->name}|{$item->alias} {/foreach}
I'm going from memory so the above may not be exactly right, but it should be pretty close.Code: Select all
{content_module module='CGContentUtils' block='lise_items'}
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'}
Re: Link LISE items to Menu
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.
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
Re: Link LISE items to Menu
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).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'}
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}
Code: Select all
{content_module module='CGContentUtils' block='lise_items' assign=foo}
Code: Select all
{LISEinstance item=$foo template_detail=empty action=detail assign=dummy}
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