Language links within menu?

Author Message

Olaf Fichtner

Sunday 04 July 2010 9:15:48 pm

Hello,

I wonder if anyone ever tried to embed language links into for example the top menu. I am sure there must be a method to create a manual link to switch to a language, a link that can be inserted into a menu - but I have not discovered any...

Yannick Komotir

Monday 05 July 2010 8:19:50 am

Hello,

are you try to do this with the switchlanguage module ?

<|- Software Engineer @ eZ Publish developpers -|>
@ http://twitter.com/yannixk

Olaf Fichtner

Monday 05 July 2010 9:19:13 am

I think so... Sorry, I only started recently, with 4.3, so I am not sure how this was done in previous versions. I just searched and it seems that there is a built-in module called "switchlanguage" in 4.3. (heard of it the first time), so the answer should probably be "yes".

Olaf Fichtner

Tuesday 06 July 2010 12:12:57 am

I think I made a little bit progress: I put the content of extension/ezwebin/design/ezwebin/templates/page_header_languages.tpl into extension/ezwebin/design/ezwebin/templates/menu/double_top.tpl, right before the /ul for topmenu-firstlevel.

Language links are correctly showing up in the topmenu now, but they are lining up with all other menu items on the left. Now I try to find a way to get them aligned to the right, while regular menu items should be on the left...

Btw, if I want to use an override for double_top.tpl, where should I put that? I tried extension/ezwebin/design/ezwebin/override/templates, but there was no change...

Olaf Fichtner

Wednesday 14 July 2010 6:51:10 am

OK, solved. I am sure there may be a more elegant way to do this, but I got it working this way:

As I said, I copied the code from the languages template into the double top menu template, between the closing ul for the first line and the closing div. I put the code into a ul with the id "topmenu-language".

Next I copied all CSS settings regarding "topmenu-firstlevel" into my override CSS, renaming "firstlevel" to "language" and added a "float:right" to "div#topmenu ul#topmenu-language li", because I wanted the regular menu items on the left, while language links should be on the right. In the same section I changed the separator image setting from left bottom to right bottom and copied the separator and selected link background image to the override image folder.

To highlight the selected language, I changed "li.selected" in these sections to "li.current_siteaccess". Unfortunately the language code does not know "firstli" to designate the first link (though that probably could be done), so there is a separator line on the right edge, but I can live with that.

Maybe this helps someone to break the "typical ezP layout" that sometimes gets mentioned here on the forums. And if someone has a better solution, don't be shy...

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 11:07:04
Script start
Timing: Jan 18 2025 11:07:04
Module start 'layout'
Timing: Jan 18 2025 11:07:04
Module start 'content'
Timing: Jan 18 2025 11:07:05
Module end 'content'
Timing: Jan 18 2025 11:07:05
Script end

Main resources:

Total runtime1.3637 sec
Peak memory usage4,096.0000 KB
Database Queries63

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 589.0313152.6250
Module start 'layout' 0.00590.0031 741.656339.4453
Module start 'content' 0.00901.3530 781.1016553.1172
Module end 'content' 1.36200.0016 1,334.218812.1641
Script end 1.3636  1,346.3828 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.2384160.0002
Check MTime0.00140.0999160.0001
Mysql Total
Database connection0.00110.078510.0011
Mysqli_queries1.306695.8145630.0207
Looping result0.00060.0469610.0000
Template Total1.318496.720.6592
Template load0.00210.150420.0010
Template processing1.316496.529220.6582
Template load and register function0.00020.014510.0002
states
state_id_array0.00950.696610.0095
state_identifier_array0.00170.125720.0009
Override
Cache load0.00170.1263210.0001
Sytem overhead
Fetch class attribute can translate value0.00060.046620.0003
Fetch class attribute name0.00150.109860.0002
XML
Image XML parsing0.00070.051220.0003
class_abstraction
Instantiating content class attribute0.00000.000960.0000
General
dbfile0.00130.0956160.0001
String conversion0.00000.000440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 5

Time used to render debug report: 0.0002 secs