Loading...
 
Themes

Themes


Per Section Side Module Display

United States

Is there an elegant way (doesn't have to be easy/readymade- I can muck in code- just need a method idea) to make this happen:

Only display certain modules per section (not by hiding/showing the L and R side bars completely but by making only certain L or R modules visible on a given page in a section of tiki as defined by the Layout per Section option).

Basically I'm hoping there is a clever way to use the built-in Layout Per Section feature to add something that makes certain modules show/hide based on which section the user is viewing.

Ideas?

-Kelly Rued

United States

On my site, I have certain modules that I want hidden or shown depending on the specific page currently loaded. I couldn't use the Layout Per Section feature, because I wanted different modules displayed for tiki-list_articles, tiki-view_articles, and tiki-read_articles — and they are all grouped under the same section.

So, this is what I did:
TIKI uses the $mid variable to determine what page is being shown. I use a simple if loop in each of my module TPL files to check which page is being shown and then to show/hide the module, as desired.

For example:
I wanted the featured-links module on for all of my article pages except when users are actually reading a full article (tiki-read_articles). So, in the mod_featured-links.tpl file, I did a quick check for the page name:

Image
Copy to clipboard
{if $mid ne 'tiki-read_articles.tpl'} .... show the module as usual {/if}



I don't know about "elegant" but it works!

-Rick


> Is there an elegant way (doesn't have to be easy/readymade- I can muck in code- just need a method idea) to make this happen:
>
> Only display certain modules per section (not by hiding/showing the L and R side bars completely but by making only certain L or R modules visible on a given page in a section of tiki as defined by the Layout per Section option).
>
> Basically I'm hoping there is a clever way to use the built-in Layout Per Section feature to add something that makes certain modules show/hide based on which section the user is viewing.
>
> Ideas?
>
> -Kelly Rued
>


It is done in tiki1.10.Even more a module can use all varaibles set in a page.
You can backport it
http://sourceforge.net/mailarchive/forum.php?thread_id=9276809&forum_id=15900
(need also an 1.9 cvs because a lot of globals have been set...)

An easier solution while waiting for 1.10 is to use the $section variable as you want it only for section. In almost all .php files, you have a line $section=...; at the bottom of the file. Move this line at the top of the php before the include or require of ('tiki-setup.php'); Then apply the change in
http://cvs.sourceforge.net/viewcvs.py/tikiwiki/tiki/tiki-modules.php?r1=1.39.2.23&r2=1.39.2.24
Then in admin->modules add in the box parameters in assign module box
section=blog
or
section[]=blog&section[]=article

Good luck
sylvie


> Is there an elegant way (doesn't have to be easy/readymade- I can muck in code- just need a method idea) to make this happen:
>
> Only display certain modules per section (not by hiding/showing the L and R side bars completely but by making only certain L or R modules visible on a given page in a section of tiki as defined by the Layout per Section option).
>
> Basically I'm hoping there is a clever way to use the built-in Layout Per Section feature to add something that makes certain modules show/hide based on which section the user is viewing.
>
> Ideas?
>
> -Kelly Rued
>

I guess I was asking a similar, but more comprehensive question in an unanswered post:

Customized section and layout

For example, I did not not want to delete the main Menu altogether, but I wanted it to appear only in the separate Admin page — and only when a authorized person logged-in.

cgc0202