Loading...
 
Features / Usability

Features / Usability


Conditional menus? Module syntax info?

posts: 3

Hello to everybody,

I'm a new user of TikiWiki, and first let me tell you that I'm very much impressed by the robustness and quality of the job you (the authors) have been doing. I'm finishing my first Tiki site, and, after I climbed the learning curve middle bump, I've been enjoying it thoroghly. Thanks and keep up the good work.

Now, I have a question: sorry if it's a FAQ, I've looked through the FAQ section first and I _think_ it's not answered anywhere. Anyway, I need to create a kind of a _conditional_ menu. That is, I've created a custom module. I created a custom menu. I embedded the menu in the module using {menu id=x}. But the problem is, the Wiki section of my site is a specific purpose area and it should use its own menu - I'd like to use {menu id=x} for the whole site, but for the Wiki I would need {menu id=y}. Is there a way to use something along the lines of

{if this_is_wiki}
{menu id=y}
{else} /* we are somewhere outside the wiki */
{menu id=x}
{/if}

in the custom module? Also, where can I find information about what exactly I can embed in a custom module? I know from a FAQ I can use raw php in the module, but then I'd need some API info. Could anyone direct me to a document, or do I figure it out form myself from the source? ;)

Thanks,

--
Grzegorz Staniak, gstaniak at wp.pl

posts: 2881 United Kingdom

Hi!

I think your best solution here is to have a look at the tpl template files and join us on the IRC channel #tikiwiki at irc.freenode.net where all the developers hang out.

If you unable to IRC, post back and I'll attempt to give you an overview of the process. However, you have the right idea!

Damian

posts: 3

> Damian:
> Hi!

Hello,

> I think your best solution here is to have a look at the tpl template files and join us on the IRC channel #tikiwiki at irc.freenode.net where all the developers hang out.
>
> If you unable to IRC, post back and I'll attempt to give you an overview of the process. However, you have the right idea!

Nice to hear this ;) Anyway, I'm afraid I cannot use IRC at the moment (company policy, I could convince the admin to proxy me temporarily, but I'd have to wait till tomorrow evening). If you could just push me in the right direction, I'll be very grateful.

> Damian

--
GStaniak

posts: 3

OK, it works. I included the following in the code of the custom module:

Copy to clipboard
{php} if (preg_match("/tiki-index/i",$_SERVER['REQUEST_URI'])) { {/php} {menu id=4} {php} } else { {/php} {menu id=2} {php} } {/php}


Of course, the 'if' may test a lot of various things, but since I needed to distinguish between wiki and the rest of the site, I used a simple regexp on the URI. This means that on wiki admin pages I'll stil get the main menu, but the regexp can be extended if needed, or replaced with any other test. The 'slist' command in the debug console lists a lot of available variables.

Thanks to damian and first of all to sylvieg for help biggrin

--
GStaniak, gstaniak at wp.pl


posts: 3

> Damian:
> Hi!

Hello,

> I think your best solution here is to have a look at the tpl template files and join us on the IRC channel #tikiwiki at irc.freenode.net where all the developers hang out.
>
> If you unable to IRC, post back and I'll attempt to give you an overview of the process. However, you have the right idea!

Nice to hear this ;) Anyway, I'm afraid I cannot use IRC at the moment (company policy, I could convince the admin to proxy me temporarily, but I'd have to wait till tomorrow evening). If you could just push me in the right direction, I'll be very grateful.

> Damian

--
GStaniak

posts: 3

OK, it works. I included the following in the code of the custom module:

Copy to clipboard
{php} if (preg_match("/tiki-index/i",$_SERVER['REQUEST_URI'])) { {/php} {menu id=4} {php} } else { {/php} {menu id=2} {php} } {/php}


Of course, the 'if' may test a lot of various things, but since I needed to distinguish between wiki and the rest of the site, I used a simple regexp on the URI. This means that on wiki admin pages I'll stil get the main menu, but the regexp can be extended if needed, or replaced with any other test. The 'slist' command in the debug console lists a lot of available variables.

Thanks to damian and first of all to sylvieg for help biggrin

--
GStaniak, gstaniak at wp.pl


posts: 53 India

Hello gstaniak,

I am looking for something like this - a conditional module which would be show for specific pages.

Can this be done? help needed :-(

Thanks
hk


Upcoming Events

1)  18 Apr 2024 14:00 GMT-0000
Tiki Roundtable Meeting
2)  16 May 2024 14:00 GMT-0000
Tiki Roundtable Meeting
3)  20 Jun 2024 14:00 GMT-0000
Tiki Roundtable Meeting
4)  18 Jul 2024 14:00 GMT-0000
Tiki Roundtable Meeting
5)  15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting
6)  19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting
7) 
Tiki birthday
8)  17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting
9)  21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting
10)  19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting