Loading...
 
Skip to main content

Features / Usability


How to control Module Visability based on Category

posts: 72 United States

I'm running Tiki9.2. Is it possible to control visibility of a module based on the category of the current object?

I would like to use TrackerList plugin in a User Module on wiki pages that is only visible when that wiki page belongs to a certain set of categories.

I thought about doing this with Smarty IF statement bu modifying a .tpl file:

Copy to clipboard
{if isset($objectCategoryIds) and in_array(257, $objectCategoryIds)} show this {/if}

as shown here, but would rather not make these modification if possible.

Is there an easier way to do this? Something like a "category=1:2:3" parameter for the module?

posts: 1645 Canada

tiki-admin_modules.php -> Edit Module ->

Category
Module displayed depending on category. Multiple category ids or names can be separated by semi-colons.

No Category
Module hidden depending on category. Multiple category ids or names can be separated by semi-colons. This takes precedence over the category parameter above


posts: 2434 Czech Republic

For custom user modules you need to add the params like this to the module "Parameters" text area:

Copy to clipboard
category[0]=1&category[1]=2&category[2]=3


or via MODULE plugin:

Copy to clipboard
category[0]=1 category[1]=2 category[2]=3


In case you do not need to use module, there is CATEGORY plugin iirc which you can wrap around your TRACKERLIST.

luci


posts: 72 United States

Thanks Marc and Luci.

I was able to get both Category and NoCategory to work using Luci's syntax.

I added this info to the Creating User Modules docs.