Hide "Home" link on navigation when user is on the home page
Hide "Home" link on navigation when user is on the home page
This may be a simple answer, but I cant find it and I am a newbie!
How do I not show the "Home" link in the navigation on the home page, but it appears when I am navigating other pages?
JC
How do I not show the "Home" link in the navigation on the home page, but it appears when I am navigating other pages?
JC
Re: Hide "Home" link on navigation when user is on the home page
I would like to do the same thing, please!
Re: Hide "Home" link on navigation when user is on the home page
Do you mean in the regular menu, or in a link?
SHould other pages that are being shown at the time, not be shown in the menu while showing?
Ronny
SHould other pages that are being shown at the time, not be shown in the menu while showing?
Ronny
Re: Hide "Home" link on navigation when user is on the home page
You could modify your menu template.
You just need to check for the contents alias or the contents id.
In the backend in "Layout->MenuManager" select the template you use for your page.
(If it is not imported to the database do so and modify your template by using this template instead. Or just browse with an FTP programm to the folder modules/MenuManager/templates and modify the file directly.)
Within your template should be something like this (in this case the example code is taken from the original simple_navigation.tpl):
This is where the template styles the current pages link. (in this case it is a headline ...)
There you just need to insert below the {if $node->current == true} an additional if-loop to check the contents alias (or the contents id - whatever makes you happy):
You also could give the an id with the pages alias and hide the menu link via stylesheets:
You just need to check for the contents alias or the contents id.
In the backend in "Layout->MenuManager" select the template you use for your page.
(If it is not imported to the database do so and modify your template by using this template instead. Or just browse with an FTP programm to the folder modules/MenuManager/templates and modify the file directly.)
Within your template should be something like this (in this case the example code is taken from the original simple_navigation.tpl):
Code: Select all
{if $node->current == true}
<li class="currentpage"><h3><dfn>Current page is {$node->hierarchy}: </dfn>{$node->menutext}</h3>
There you just need to insert below the {if $node->current == true} an additional if-loop to check the contents alias (or the contents id - whatever makes you happy):
So whenever the current content is "home" it wont be displayed in the menu.
{if $node->current == true}
{if ($node->alias=='home'}
{if $node->current == true}
Current page is {$node->hierarchy}: {$node->menutext}
{/if}
You also could give the an id with the pages alias and hide the menu link via stylesheets:
Now you just need to add to your stylesheets:
{if $node->current == true}
alias" [/b]>Current page is {$node->hierarchy}: {$node->menutext}
Code: Select all
ul li#home {
display:none;
margin: 0;
padding: 0;
border: none;
}
Re: Hide "Home" link on navigation when user is on the home page
Thanks--for me, it would be hiding a home link--not in the menu. (like a "back" button) Is this possible?
Re: Hide "Home" link on navigation when user is on the home page
If you only want a specific link want to be shown on all pages but the HOME-page, you could insert something like the {cms_selflink} to the homepage, wrapped inside an if statement.
So with the cms_selflilnk:
So with the cms_selflilnk:
or with a a-href:{if $pagealias neq 'home'}
{cms_selflink page="home" text="Home"}
{/if}
Ronny{if $pagealias neq 'home'}
Home
{/if}
Re: Hide "Home" link on navigation when user is on the home page
The home link I have is currently in the template. Can that cms_selflink be used in template or does it have to actually be used in the home page only?
Thanks!
Thanks!
Re: Hide "Home" link on navigation when user is on the home page
It can be placed anywhere you want it to.
Because the link is only shown if you are notat a specific page.
In this case the link is only shown if the page alias (wich you can set at the options tab when editing a page; by default it will be filled automatically by a "websafe" version of the menu text) is not "home".
I would prefere to place it in the Template. (Since it is seen at every page except the page you specified.)
In order to get always the right link to that page i would use the first version of Ronnys examples.
Because the link is only shown if you are notat a specific page.
In this case the link is only shown if the page alias (wich you can set at the options tab when editing a page; by default it will be filled automatically by a "websafe" version of the menu text) is not "home".
I would prefere to place it in the Template. (Since it is seen at every page except the page you specified.)
In order to get always the right link to that page i would use the first version of Ronnys examples.
Re: Hide "Home" link on navigation when user is on the home page
Hmmm..neither of these examples are working for me. This is what I have in the template:
{if $pagealias neq 'micro-auto-paint'}
{cms_selflink page="micro-auto-paint" text="Return to Micro Auto Paint"}
{/if}
I do have friendly urls although I don't know if that would make a difference. The link is still showing up on the "micro-auto-paint" page. I have doubled checked the page name, and it is correct. What am I doing wrong?
{if $pagealias neq 'micro-auto-paint'}
{cms_selflink page="micro-auto-paint" text="Return to Micro Auto Paint"}
{/if}
I do have friendly urls although I don't know if that would make a difference. The link is still showing up on the "micro-auto-paint" page. I have doubled checked the page name, and it is correct. What am I doing wrong?
Re: Hide "Home" link on navigation when user is on the home page
Maybe the variable $pagealias is wrong.
Try $page_alias, $content_alias, $content_name or $page_name... just type {get_template_vars} in your template to see what variables contains what values.
Or the alias of the page is not "micro-auto-paint"? Take a look into the options tab again when editing that page to get the right alias.
I'm not sure but since you are using "-" within your alias it could be that you need to use the double quotes (") instead of single qoutes (').
Try $page_alias, $content_alias, $content_name or $page_name... just type {get_template_vars} in your template to see what variables contains what values.
Or the alias of the page is not "micro-auto-paint"? Take a look into the options tab again when editing that page to get the right alias.
I'm not sure but since you are using "-" within your alias it could be that you need to use the double quotes (") instead of single qoutes (').
Re: Hide "Home" link on navigation when user is on the home page
Hi-- my page alias is correct--double quotes didn't work. Any other ideas?
Re: Hide "Home" link on navigation when user is on the home page
on your template
Code: Select all
{if $page_alias == 'home'}
{menu excludeprefix='home'}
{else}
{menu}
{/if}
Re: Hide "Home" link on navigation when user is on the home page
use $page_alias with the underlinebelgirl wrote: Hi-- my page alias is correct--double quotes didn't work. :( Any other ideas?
Re: Hide "Home" link on navigation when user is on the home page
THAT WAS IT!! I was simply missing the underscore..Ah...brilliant! Thanks everyone. Working great!viebig wrote:use $page_alias with the underlinebelgirl wrote: Hi-- my page alias is correct--double quotes didn't work. :( Any other ideas?