inherit
114253
0
Sept 23, 2024 7:58:54 GMT -8
Teg
Can't Wait for V6
3,157
November 2007
teg
|
Post by Teg on Dec 27, 2017 17:45:35 GMT -8
Okay, so I am trying to set up a navigation menu. When NOT on /page/home, the menu needs to be different. And, when a guest is viewing the forum, the menu is different.
Here is the code piece by piece:
<li class="active"> <a class="page-scroll" href="http://hogexrpg.forums.net/page/home">Home</a> </li>
{if $[current_user.is_member] || $[route.params.page_id] == "home"} <li> <a class="page-scroll" href="#main-menu">Main Menu</a></li>
<li> <a class="page-scroll" href="#site-news">Site News</a> </li>
<li> <a href="#" target="_blank">About</a> </li>
<li> <a class="page-scroll" href="#common-room">Common Room</a> </li>
<li> <a href="/user">My Hogex</a></li>
<li> <a href="/page/shop">Hogex Shop</a></li>
{if $[current_user.is_staff]} <li> <a href="/admin">Mod CP</a></li> {/if}
<li> <a href="/logout">Logout</a></li>
{elseif $[route.params.page_id] != "home"} <li><a href="/members">Members</a></li>
*Note: I've also tried the second part with !==
{else}
<li > <a class="page-scroll" href="page/home#cool-features">Features</a> </li>
<li> <a class="page-scroll" href="page/home#about-review-full">Review</a> </li>
<li> <a class="page-scroll" href="page/home#enroll">Enroll Now</a> </li>
<li> <a href="http://hogexrpg.forums.net/login">Already A Student? Login!</a> </li>
{/if}
For the middle section, there will be more links, but until I can get it to display properly, I'm not adding any. Any help would be appreciated.
Thanks, Teg
|
|
inherit
96289
0
May 17, 2020 9:37:00 GMT -8
elli
1,822
January 2007
ebbymac
|
Post by elli on Dec 27, 2017 18:07:55 GMT -8
You have this in your forum wrapper? This is what worked for me with a custom page with both the name and ID as "home": {if $[route.params.page_id] == "home"} <h1>This is the home page</h1> {elseif $[route.params.page_id] !== "home"} <h1>This is not the home page</h1> {/if} ellitest.proboards.com/page/homeellitest.proboards.com/ellitest.proboards.com/board/9/werecrow
Edit: It's your "or" operator -- it's testing if either the user is a member OR if the current page is "home". Since you're logged in, the first case will always be true, so the menu won't change. Try using "and" instead: {if $[current_user.is_member] && $[route.params.page_id] == "home"} <h1>This is the home page</h1> {elseif $[route.params.page_id] !== "home"} <h1>This is not the home page</h1> {/if}
|
|
inherit
114253
0
Sept 23, 2024 7:58:54 GMT -8
Teg
Can't Wait for V6
3,157
November 2007
teg
|
Post by Teg on Dec 27, 2017 18:36:57 GMT -8
elliThanks for the help, that seemed to work. I'm having a boat load of other issues too haha, but one major thing at a time. I appreciate the looking out. Thanks, Teg
|
|