1
kalamata
Selecting which modules to include in the main menu block
  • 2005/5/7 22:10

  • kalamata

  • Not too shy to talk

  • Posts: 121

  • Since: 2005/3/3 1


Dear All,

I am having problems running an if statement on the number of modules installed to decide whether to include them in the Main Menu block or not. I have modified the template as follows:

<table cellspacing="0">
<tr>
<td id="mainmenu">
<a class="menuTop" href="<{$xoops_url}>/"><{$block.lang_home}></a>
<!-- start module menu loop -->
<{foreach item=module from=$block.modules}>
{if {$module.name} eq "Web Links"}
<a class="menuMain" href="<{$xoops_url}>/modules/<{$module.directory}>/"><{$module.name}></a>
<{foreach item=sublink from=$module.sublinks}>
<a class="menuSub" href="<{$sublink.url}>"><{$sublink.name}></a>
<{/foreach}>
<{/foreach}>
{/if}
<!-- end module menu loop -->
</td>
</tr>
</table>
</tr>
</table>,

the main change been the addition of {if {$module.name} eq "Web Links"}

This, as I look at it, will check the module's name and if it is equal to Web Links it will add it to the menu.

Also, would this logic be true if I want the opposite to happen?

{if ! {$module.name} eq "Web Links"}

However, nothing happens. Could someone please point me to where I am going wrong? I have experience in PHP programming, but am a Smarty newbie.

Thanks,
George

2
jdseymour
Re: Selecting which modules to include in the main menu block

Go to System Admin - Modules. In the list of modules on that page you have a Weight column. You set the order of the modules listed in the main menu by weight, the lower the number the uppermost in the list is the module. If you want to hide a module from the mainmenu give it a weight of 0.

Hope this is what you were asking. Looking at the code I do not fully understand.

HTH.

3
kalamata
Re: Selecting which modules to include in the main menu block
  • 2005/5/7 22:20

  • kalamata

  • Not too shy to talk

  • Posts: 121

  • Since: 2005/3/3 1


It is the code of the template for generating the main menu. I want the modules to appear on the page, but not on that specific block. Could somebody please advice me why the smarty code I inserted (the if statement) is only getting printed without any other effect?

Thanks,
George

4
m0nty
Re: Selecting which modules to include in the main menu block
  • 2005/5/7 22:32

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


try

<{if $module.name == "Web Links"}>

my smarty isn't that great either but i don't think you use a smarty inside a smarty {} just use the name. ie $module.name not {$module.name}

5
kalamata
Re: Selecting which modules to include in the main menu block
  • 2005/5/7 23:31

  • kalamata

  • Not too shy to talk

  • Posts: 121

  • Since: 2005/3/3 1


Excellent advice, solved the problem. Many thanks.

George

Login

Who's Online

68 user(s) are online (40 user(s) are browsing Support Forums)


Members: 0


Guests: 68


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits