Link Manager show category name then links

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
jhoulston
New Member
New Member
Posts: 8
Joined: Wed May 06, 2009 12:40 pm

Link Manager show category name then links

Post by jhoulston »

Dear All,

I have added Link Manager to my site and it is exactly what I need.  However, I would like to be able to display the title of the category with the links underneath.  Is this possible?  I added {$link_category} to the sample template but that didn't do anything so I assume I'm barking up the wrong tree.

Can anyone help?

Many thanks in anticipation,
James.
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Link Manager show category name then links

Post by Nullig »

Use:

{$item.link_category}

Nullig
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Link Manager show category name then links

Post by KitchM »

This did not work for me. All I got was a messed up page.

I've used {LinkMgr category=""} and got my test link without the associated category.
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm

Re: Link Manager show category name then links

Post by Jos »

use {get_template_vars} and the print_r modifier to learn which variables you can use... check http://docs.cmsmadesimple.org/troubleshooting/tips
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Link Manager show category name then links

Post by KitchM »

Thanks, Jos. That was interesting. Here's most of what I got:
app_name = CMS
cgsimple = Object
feu_smarty = Object
ccuser = Object
tbtools = Object
tbmobile = Object
content_obj = Object
content_id = 82
page = links
page_id = links
page_name = links
page_alias = links
position = 4
friendly_position = 4
lang = en_US
encoding = utf-8
smarty =
actionid = m6713d
actionparams = Array (3)
returnid = 82
actionmodule = LinkMgr
menuparams = Array (3)
count = 7
nodelist = Array (3)
number_of_levels = 10000
node = Array (12)
classes = menuactive
search_actionid = cntnt01
hogan = onfocus="if(this.value==this.defaultValue) this.value='';" onblur="if(this.value=='') this.value=this.defaultValue;"
searchtext = Enter Search...
startform = <form id="cntnt01moduleform_1" method="get"
<div class="hidden">
<input type="hidden" name="mact" value="Search,cntnt01,dosearch,0" />
<input type="hidden" name="cntnt01returnid" value="82" />
</div>
label = <label for="cntnt01searchinput">Search</label>
searchprompt = Search
submittext = Submit
endform = </form>
starttext = You are here
spanclass = crumb
extraspanclass = current
prevpage = <
firstpage = <<
pagenumber = 1
pagecount = 3
oftext = of
pagetext = Page
itemcount = 3
items = Array (3)
category_label = Category:
author_label = Posted by:
param_number = 3
param_detailpage = 73
param_module = News
param_pagenumber = 3
category_name =
cats = Array (5)
entry = Object
target =
href =

What exactly should I see there?

Thanks again.
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm

Re: Link Manager show category name then links

Post by Jos »

that is the result of get_template_vars.
You can see that there is an array called $items, but my wild guess is that that is from the news module.

it makes a lot of difference where you put the get_template_vars tag.Use it at the end of your LinkMngr template, or right after the {LinkMngr} tag.

The content of the arrays can be checked with e.g. <pre>{$items|print_r}</pre>
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Link Manager show category name then links

Post by KitchM »

Thanks.

Yes, I put it right at the end of the template code as the last line. And as I looked at it, I too thought that the other modules had some added information. Therefore I was unable to find anything pertinent to Link Manager itself.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Link Manager show category name then links

Post by Rolf »

Read help text
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Link Manager show category name then links

Post by KitchM »

Thanks, Rolf. But I've read it many times.

I have three categories with a link in each one.

I chose to use
{LinkMgr category=""}
to get all the categories listed.

I put that right on the page as html.

Saved page, and when I displayed it, I got only the three links, but no categories.

Maybe you were thinking of something else that I might have missed?
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Link Manager show category name then links

Post by velden »

Help contains this sample code that displays category name above links:

Code: Select all

<div class="linkmgr">
  {foreach from=$items item='item'}
    {if $item.link_category != $foo|default:''}<h3>{$item.link_category}</h3>{/if}
    <div class="row">
      <div class="column">
        <img src="{$item.link_img|default:'uploads/images/linkmgr/noimage.jpg'}" width="100" height="100" alt="{$item.link_name}" />
      </div>
      <div class="column">
        <a href="{$item.link_url}" target="_blank">{$item.link_name}</a>
      </div>
      <div class="column">
        {$item.link_desc|default:''}
      </div>
    </div>
    <div style="clear: both"></div>
    {$foo = $item.link_category}
  {/foreach}
</div> 
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Link Manager show category name then links

Post by KitchM »

Now I'm confused. Are you pointing out that I should not use the provided code of {LinkMgr category=""}, but instead use that whole section of code you listed? If that is so, what is the point of the smarty shortcut?
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Link Manager show category name then links

Post by velden »

What would be the use of using the 'category' parameter (showing only the links of one specific category) if you want to show all categories?

So, do NOT use the 'category' parameter and try using the template I posted earlier.
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Link Manager show category name then links

Post by KitchM »

Because,
(optional) category="" - Specifies the category of links to display. If not specified, all categories are displayed.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Link Manager show category name then links

Post by Rolf »

What LinkMgr release do you use?
Is it an upgraded module, or new install?
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Link Manager show category name then links

Post by velden »

KitchM wrote:Now I'm confused. Are you pointing out that I should not use the provided code of {LinkMgr category=""}, but instead use that whole section of code you listed? If that is so, what is the point of the smarty shortcut?
Of course you use the Smarty shortcut. The code I posted is to be used in LinkMgr template.
I chose to use
{LinkMgr category=""}
to get all the categories listed.
If you want all categories listed then:
- do NOT use the 'categories' parameter
- change the used LinkMgr template to contain the sample code I posted (and comes from module's help).

It just works for me this way.
Post Reply

Return to “Modules/Add-Ons”