Loading...
 
Skip to main content

Features / Usability


conditional commands in modules / wiki

I found user modules for a menu system, and used the following command in it:

{if $user}
{else}
[ tiki-login.php | login ]
{/if}


This provided a "login" option if the user is not logged in.

Where do I find documentation on this feature? I've found that $group works as well, what other variables are available there?

Secondly, where can this type of structure be used? I've since replaced my menu structure on this site to use the menupage module, to make it easier for my users to edit it and avoid getting them into the "module" section of the site (too easy to mess things up by clicking the wrong thing there .. if it's just editing a wiki page that's something that anyone can do, and if they mess it up, I can restore the functionality pretty easily)

It would be nice to have conditional options using the menupage structure, but if I put that code (if / else / /if), the code shows up on the page rather than being interpreted.


Thanks!

Norm Fisher

This appears to be "smarty" coding, or some such? Anyone know where I find documentation on what's legal here? There's an example of it on look and feel page: "{if $user neq ''}logged as{/tr}: {$user}{/if}" is where I found it, but I can't find documentation on what is legal in it, etc!?

Someone? Anyone? Help!



That appears to help with the structure of the language, but how do I find which variables are available? I'd like to have access to which category the current page is in. Is there a method to do that?

Given the lack of response, perhaps the only solution here is to create two separate wiki's, and have it transferred to the other wiki when you select the other organization. I.e. engineering would have one wiki, marketing another.

This seems like overkill and a management nightmare as both wikis would have to have userlists maintained over time with a lot of the same users having access to editing both of them.

I'm really looking for two completely different left-side menus based on which section of the site the user is currently looking at .. e.g.:

Marketing
Engineering
- Personnel
- Project 1
- Project 2
- Project 3

while you are viewing engineering page, while:

Marketing
- Sales figures
- Upcoming Promotions
- Other marketing topics
Engineering

while you are viewing marketing pages. it would be a simple expanding menu, except for the fact that most users don't access pages through the left-side menu .. they would follow links on various pages. The left-side menu should automatically expand or contact as you follow the website.

Does this make sense? Am I conveying what I'm trying to do?

>
>Does this make sense? Am I conveying what I'm trying to do?
>

You basically want a different menu to appear, depending on which page is currently being viewed, right?

Try creating a module with:

Copy to clipboard
{if $page eq 'Engineering'} {menu id=XXXX} {elseif $page eq 'Marketing'} {menu id=YYYY} {else} {menu id=ZZZZ} {if}


You'll need to create 3 menus:

  • XXXX — The menu to appear when on the Engineering page.
  • YYYY — The menu to appear when on the Marketing page.
  • ZZZZ — The default menu to appear everywhere else.


This, of course, assumes that your page names are Marketing and Engineering.

Not the most elegant, but it should work.

HTH,

-RickQuestion
Need more help? Try TikiWiki for Dummies SmartiesQuestion or read my Tiki Blog or visit my UserPage

Ahhh .. that makes sense. Now, I want to do this with a class of pages, not just one page.

Can I do something where the page START with "eng" — so all engineering pages would start with eng?

I thought initially to create a category "engineering" and "marketing" and base it on that, but I can't figure out how in code to determine which category a page is in. But doing it by name would be perfectly acceptable!

I don't suppose substr($page,0,3) would work?

Of course it does!!!

Thanks, Rick!