[TYPO3-english] Active Link in Menu When Viewing Home Page

Loek Hilgersom loek at netcoop.nl
Sat Aug 4 22:04:43 CEST 2012


Hi Chanda and Jan,

There is also a different approach: remove the shortcut page 'home' entirely and 
prepend a link to the site-root home page to the menu.

Some examples:

globalMenu {
	....
	stdWrap.preCObject = TEXT
	stdWrap.preCObject {
		typolink.parameter = {$pages.home}
		wrap.cObject = TEXT
		wrap.cObject {
			value = <span class="active">|</span>
			if.value = {$pages.home}
			if.equals.data = TSFE:id
		}
	}
	....

where {$pages.home} is of course a constant with the id of the site root page.

Or a different implementation in an old thread here:
http://lists.typo3.org/pipermail/typo3-english/2007-July/040998.html

I like it because I don't like spreading the Typoscript templates all over the 
page tree. It also avoids the additional realurl issues and you don't have that 
double home page.

Loek


On 04-08-12 10:44, Jan Bednarik wrote:
> Hi Chanda,
>
> you need to create an extension template on the root page and in the root
> template set it as "Template on next level". In this extension template, place
> only 1 line of code into Setup:
>
> globalMenu.alwaysActivePIDlist >
>
> And that's it.
>
> If you create this extension template via List module, make sure it's listed as
> second and the main template is first.
>
> Regards
>
> Jan
>
> Dne 2.8.2012 5:05, ChandaCole napsal(a):
>>
>> Hello Jan,
>>
>> Since my last response I have got the Home link to show as active, just took
>> some playing with to figure out exactly where to set the value.  So, it is
>> now working with
>>
>> globalMenu.alwaysActivePIDlist = 156
>>
>> I am having trouble now with where to place the second line of code to
>> remove the always active link.  I have tried it at the globalMenu.1 level,
>> and also within globalMenu.1 states of NO and ACT, but the Home link remains
>> active regardless of the page I am viewing.
>>
>> Thanks again for your help!
>> Chanda
>>
>>
>>
>> Jan Bednarik wrote:
>>>
>>> Hi Chanda,
>>>
>>> the way I do it that I create shortcut to the root page labeled Home, so
>>> it would appear in the menu. Then to make it active on the homepage, I add
>>>
>>> alwaysActivePid = XXX
>>>
>>> to the definition of the menu. And then I add template on next level,
>>> where I remove it
>>>
>>> alwaysActivePid >
>>>
>>> It may not be the best way, but it works. Maybe someone will come up
>>> with something better.
>>>
>>> Regards
>>>
>>> Jan
>>>
>>>
>>>
>>
>


More information about the TYPO3-english mailing list