[Typo3-dev] Language menu using typoscript+HMENU instead of custom PHP code

Kasper Skårhøj kasper at typo3.com
Fri Apr 30 11:12:30 CEST 2004


I'll take a shot at this later when I'm going to look at languages
handling as a whole.

- kasper

On Thu, 2004-04-29 at 18:15, Hannes Schmidt wrote:
> Hi,
> 
> One of my clients' typo3 sites is multilingual. For that matter, I was
> adapting sample_languageMenu.php to my site while I noticed that a language
> menu is very much like the HMENU content object. I thought it should be easy
> to implement a language menu using HMENU and typoscript instead of custom
> PHP code. That way I wouldn't have to reinvent the wheel regarding
> image-preloading (mouse-overs) and link generation (simulate_static_docs).
> However there is a minor glitch that currently prevents me from doing this.
> I think this glitch is easy to fix for someone who knows typo3 internals
> better that me.
> 
> This is my approach:
> 
> includeLibs.languageMenu = fileadmin/ts/languageMenu.php
> t.languageMenu = HMENU
> t.languageMenu.special = userfunction
> t.languageMenu.special.userFunc = user_languageMenu_class->languageMenuRows
> t.languageMenu.1 = GMENU
> t.languageMenu.1.NO = 1
> 
> The PHP function user_languageMenu_class->languageMenuRows() simply queries
> the database tables 'pages', 'pages_language_overlay' and 'sys_language' and
> returns the default page record and the alternative page language records of
> the current page. The returned rows contain the fields from table 'pages'
> (as specified) *as well as* the fields from table 'pages_language_overlay'.
> This means that we can use these additional fields to tweak the menu items.
> 
> The GMENU uses an itemArrayProcFunc to override the item state to ACT for
> the menu item representing the current page language according to
> sys_language_uid.
> 
> So far everything works fine but:
> 
> Every URL in the menu contains the parameter L=<uid> where uid is the <uid>
> of the *current* page language (due to config.linkVars = L). It should be
> the uid of the target page's language! There is no way to remove the
> parameter and there seems to be no way to add a parameter based on fields in
> the page record representing the menu item. The only way the generated URL
> can be changed is 'addParams'. But 'addParams' can only append a static
> string to the generated URL. What we need is a way to *change* the L
> parameter from the uid of the current page into the uid of the target page.
> 
> 
> _______________________________________________
> Typo3-dev mailing list
> Typo3-dev at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
-- 
Best regards

- kasper

--------------------
It's not a bug, it's a missing feature.






More information about the TYPO3-dev mailing list