Page 1 of 2

Link Manager show category name then links

Posted: Mon Jun 01, 2009 2:18 pm
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.

Re: Link Manager show category name then links

Posted: Mon Jun 01, 2009 3:18 pm
by Nullig
Use:

{$item.link_category}

Nullig

Re: Link Manager show category name then links

Posted: Tue Jul 08, 2014 4:05 am
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.

Re: Link Manager show category name then links

Posted: Thu Jul 10, 2014 10:35 pm
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

Re: Link Manager show category name then links

Posted: Fri Jul 11, 2014 1:14 am
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.

Re: Link Manager show category name then links

Posted: Fri Jul 11, 2014 5:11 am
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>

Re: Link Manager show category name then links

Posted: Fri Jul 11, 2014 1:45 pm
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.

Re: Link Manager show category name then links

Posted: Wed Jul 16, 2014 9:36 pm
by Rolf
Read help text

Re: Link Manager show category name then links

Posted: Thu Jul 17, 2014 12:21 am
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?

Re: Link Manager show category name then links

Posted: Thu Jul 17, 2014 7:58 am
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> 

Re: Link Manager show category name then links

Posted: Thu Jul 17, 2014 2:02 pm
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?

Re: Link Manager show category name then links

Posted: Thu Jul 17, 2014 2:14 pm
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.

Re: Link Manager show category name then links

Posted: Thu Jul 17, 2014 4:08 pm
by KitchM
Because,
(optional) category="" - Specifies the category of links to display. If not specified, all categories are displayed.

Re: Link Manager show category name then links

Posted: Thu Jul 17, 2014 7:48 pm
by Rolf
What LinkMgr release do you use?
Is it an upgraded module, or new install?

Re: Link Manager show category name then links

Posted: Thu Jul 17, 2014 7:53 pm
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.