Zum Inhalt springen

2 Sprachen ohne php geht - aber link params verdoppeln sich

Erstellt am 15. April 2005 · 4 Antworten · letzte Antwort am 27. Juli 2005

Tags: Links, Frage

susy2space ·

hallo,

habe es mittlerweile geschafft dass auf den seiten (2Sprachen) nur eine Flagge ( immer die der anderen Sprache) angezeigt werden und bei Klick auf die Flagge die Sprache wechselt , die aktuelle Seite dabei beibehalten wird.

So jetzt klick ich munter zwischen den Sprachen hin und her, und plötzlich bekomme ich solche Links:

https://www.netzwert.ag/new/index.php?id=51&L=1&L=0

Es geht zwar, da anscheinend immer der letzte Parameter genommen wird, ist aber unschön.
Wer kann mir sagen, wo mein Fehler liegt.

typo script setup:

config.admPanel = 0

# - - - language specific (default)
config.linkVars = L
config.sys_language_uid = 0
config.language = en
config.locale_all = en
plugin.meta.global.description = english description
plugin.meta.global.keywords = english, keywords
plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 0

lib.lang_url = TEXT
lib.lang_url.value = index.php?id={page:uid}&L=1
lib.lang_url.htmlSpecialChars = 1
lib.lang_url.insertData = 1
lib.lang_label = TEXT
lib.lang_label.value = English
lib.imprint_label = TEXT
lib.imprint_label.value = Impressum
#footer variable
temp.footer1 = © 2005 Netzwert AG All Rights Reserved
#flagge fuellen
temp.addp = &L=1
temp.lang.file = fileadmin/templates/images/schwarz-rot-gold.gif
#ende flagge

# - - - language specific (english)
[globalVar=GP:L=1]
config.sys_language_uid = 1
config.language = de
config.locale_all = de_DE
plugin.meta.global.description = desc...
plugin.meta.global.keywords = german, keywords, coming here...

plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 1
# tt_content.search.20.layout.10.value = Search result: ###RANGELOW###-###RANGEHIGH### of ###TOTAL###
lib.lang_url.value = index.php?id={page:uid}&L=0
lib.lang_label.value = Deutsch
lib.imprint_label.value = Imprint
#footer
temp.footer1 = © 2005 Netzwert AG Alle Rechte vorbehalten.
#flagge
temp.addp = &L=0
temp.lang.file = fileadmin/templates/images/union-jack.gif
[global]

# subheader
lib.subheader = HMENU
lib.subheader {
  special = rootline
  special {
    range = 1|1
  }
  1 = TMENU
  1 {
    NO.doNotLinkIt = |*||*|1
    NO.stdWrap.cObject = COA
    NO.stdWrap.cObject {
      10 = TEXT
      10.field = subtitle
      10.htmlSpecialChars = 1
    }
  }
}

# kopfzeile menu template
lib.menu_level1 = HMENU
lib.menu_level1.1 = TMENU
lib.menu_level1.1 {
    NO.allWrap = <span class="level1_inact"> | </span><span class="level1_inact">&nbsp;&#124;&nbsp;</span> |*||*| <span class="level1_inact"> | </span>
    NO.stdWrap.case = upper
    ACT = 1
    ACT.stdWrap.case = upper
    ACT.allWrap = <span class="level1_act"> | </span><span class="level1_inact">&nbsp;&#124;&nbsp;</span> |*||*| <span class="level1_act"> | </span>
    ACT.stdWrap.case = upper
}

# menu links template
lib.menu_level2 = HMENU
lib.menu_level2 {
  entryLevel = 1
  1 = TMENU
  2 = TMENU
  1 {
    NO.allWrap =  <tr><td><img src="fileadmin/templates/images/void.gif" height="12px" width="9px"></td><td><img src="fileadmin/templates/images/void.gif" height="1px" width="5px"></td><td class="submenu_inactive" valign="top">|</td></tr><tr><td colspan="3"><img src="fileadmin/templates/images/void.gif" height="16px" width="1px"></td></tr>
    ACT = 1
    ACT.allWrap =  <tr><td valign="top"><img src="fileadmin/templates/images/pfeil.gif" height="12px" width="9px"></td><td><img src="fileadmin/templates/images/void.gif" height="1px" width="5px"></td><td class="submenu_active" valign="top">|</td></tr><tr><td colspan="3"><img src="fileadmin/templates/images/void.gif" height="16px" width="1px"></td></tr>
  }
  2 {
    NO.allWrap = <p class="menu_level3">|</p>
    ACT = 1
    ACT.allWrap = <p class="menu_level3_act">|</p>
  }
}


tt_content.stdWrap.dataWrap = {$content.mainWrap}

# Wrap for contentelement headers
lib.stdheader.stdWrap.wrap = {$content.headerWrap}

# Wrap for body of contentelement type: TEXT
tt_content.text.20.wrap = {$content.bodyWrap}

# Wrap for body of contentelement type: HTML
tt_content.html.wrap = {$content.bodyWrap}

# Wrap for body of contentelement type: IMAGE and IMGTEXT
tt_content.image.15 = TEXT
tt_content.image.15.value = {$content.bodyWrapStart}
tt_content.image.999 = TEXT
tt_content.image.999.value = {$content.bodyWrapEnd}
tt_content.image.20.text.20.wrap = |

tt_content.textpic.15 = TEXT
tt_content.textpic.15.value = {$content.bodyWrapStart}
tt_content.textpic.999 = TEXT
tt_content.textpic.999.value = {$content.bodyWrapEnd}
tt_content.textpic.20.text.20.wrap = |

# Wrap for body of contentelement type: BULLET
tt_content.bullets.20.stdWrap.wrap = {$content.bodyWrap}

# Wrap for body of contentelement type: TABLE
tt_content.table.20.stdWrap.wrap = {$content.bodyWrap}

# Wrap for body of contentelement type: UPLOADS (Filelinks)
tt_content.uploads.20.stdWrap.wrap = {$content.bodyWrap}

# Wrap for body of contentelement type: MENU
tt_content.menu.20.stdWrap.wrap = {$content.bodyWrap}

# Wrap for body of contentelement type: SHORTCUT?
tt_content.shortcut.20.stdWrap.wrap = {$content.bodyWrap}

# Wrap for body of contentelement type: LIST (Plugins)
tt_content.list.20.stdWrap.wrap = {$content.bodyWrap}

# Wrap for body of contentelement type: MULTIMEDIA
tt_content.multimedia.20.stdWrap.wrap = {$content.bodyWrap}

# Wrap for body of contentelement type: MAILFORM
tt_content.mailform.20.stdWrap.wrap = {$content.bodyWrap}

# Wrap for body of contentelement type: SEARCH
# Search Results
tt_content.search.20.stdWrap.wrap = {$content.bodyWrap}
# Search Form
tt_content.search.30.stdWrap.wrap = {$content.bodyWrap}

# Wrap for body of contentelement type: LOGIN
tt_content.login.20.stdWrap.wrap = {$content.bodyWrap}




# Configuring the Auto-Parser
plugin.tx_automaketemplate_pi1 {
  # Read template file
  content = FILE
  content.file = fileadmin/templates/template.html

  elements {
    BODY.all = 1
    BODY.all.subpartMarker = DOCUMENT_BODY
    
    HEAD.all = 1
    HEAD.all.subpartMarker = DOCUMENT_HEADER
    HEAD.rmTagSections = title

    SPAN.all = 1
    TD.all = 1
    TABLE.all = 1
  }
}



lib.stdheader.stdWrap.dataWrap >

# Create COA with different maxW for right column
temp.rightContent = COA
temp.rightContent {
10 = LOAD_REGISTER
10.maxImageWidth = 150
20 < styles.content.getRight
30 = RESTORE_REGISTER

} 

# Flagge template 

# Body template
temp.mainTemplate = TEMPLATE
temp.mainTemplate {
  template =< plugin.tx_automaketemplate_pi1

  subparts.menu_level1 < lib.menu_level1
  subparts.menu_level2 < lib.menu_level2
  subparts.subheader < lib.subheader
  subparts.main < styles.content.get
#use the one created above instead of styles.content.getRight
  subparts.right < temp.rightContent
  subparts.flagge < temp.flagge
#Flagge bauen 
   subparts.flagge = IMAGE
   subparts.flagge.file < temp.lang.file
   subparts.flagge.imageLinkWrap = 1
   subparts.flagge.imageLinkWrap.enable = 1
   lib.lang_url.value = index.php?id={page:uid}
   subparts.flagge.imageLinkWrap.typolink.parameter.data =page:uid 
   #subparts.flagge.imageLinkWrap.typolink.no_cache = 1 
   #subparts.flagge.imageLinkWrap.typolink.parameter =  1_self
   
   subparts.flagge.imageLinkWrap.typolink.additionalParams < temp.addp
   subparts.flagge.imageLinkWrap.typolink.ATagBeforeWrap = 1 
   
   subparts.flagge.insertData = 1
#footer fuellen
  
  subparts.footer1 = TEXT
  subparts.footer1.value < temp.footer1
  subparts.footer1.typolink.parameter =40
  subparts.footer1.typolink.target = _self
  subparts.footer1.typolink.ATagBeforeWrap = 1
  
  subparts.footer2 = TEXT
  subparts.footer2.typolink.parameter =51
  subparts.footer2.typolink.target = _self
  subparts.footer2.typolink.ATagBeforeWrap = 1

  subparts.footer1.insertData = 1
  subparts.footer2.insertData = 1
}

#Header template
temp.headerTemplate = TEMPLATE
temp.headerTemplate {
  template =< plugin.tx_automaketemplate_pi1
  workOnSubpart = DOCUMENT_HEADER
}

# Default PAGE object:
page = PAGE
page.typeNum = 0
page.stylesheet = fileadmin/templates/style.css

page.10 < temp.mainTemplate
Tobidobi ·

Hi,
speicher mal dein Template und probier's mal mit folgendem Code:

# Setting up the language variable "L" to be passed along with links
config.linkVars = L

##### set the default Site Language
config.sys_language_uid = 0
config.language = de

##### Define the used Site languages
# German language, sys_language.uid = 0
[globalVar = GP:L = 0]
config.sys_language_uid = 0
config.language = de
# English language, sys_language.uid = 1
[globalVar = GP:L = 1]
config.sys_language_uid = 1
config.language = uk
[global]

Mehr brauchst du eigentlich nicht. (Natürlich deine Texte, z.B. label.value...). Die Zeile
lib.lang_url.value = index.php?...
würde ich auf jeden Fall mal rausnehmen, da Typo3 die Link-URLs selbst macht.
Meine Templates haben nur diese paar Zeilen und schnurren damit.

Hoffe, es hilft.
Grüße
Tobi

susy2space ·

hi,

die normalen links gehen ja auch, den ärger bekomme ich wenn ich einmal auf die Flaggen geklickt habe....

leider auch wenn ich die zeile mit libl.lang.url.....ruasnehmen..

irgendwer ne andere idee ??

svennail ·

Moin,

das geht ungefähr so:

--> unbedingt auf Typo 3.8 updaten, da das mit dem doppelten linkvars beim Sprachmenü bei den Versionen davor ein Bug ist!

dann kann man ein Menü generieren a la

special = language
siehe:
https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/ContentObjects/Hmenu/Index.html

ins Haupt Template dann noch zu den config.linkvars = L
config.uniqueLinkVars = 1
(neu ab 3.8-)

Grüße
Sven

Beispiel
lib.langMenu = HMENU
lib.langMenu.special = language
lib.langMenu.special.value = 0,1,2
lib.langMenu.1 = GMENU
lib.langMenu.1.NO {
XY = [5.w]+4, [5.h]+4
backColor = white
5 = IMAGE
5.file = media/flags/flag_uk.gif || media/flags/flag_fr.gif || media/flags/flag_es.gif
5.offset = 2,2
}
lib.langMenu.1.ACT < lib.langMenu.1.NO
lib.langMenu.1.ACT=1
lib.langMenu.1.ACT.backColor = black
lib.langMenu.1.USERDEF1 < lib.langMenu.1.NO
lib.langMenu.1.USERDEF1=1
lib.langMenu.1.USERDEF1.5.file = media/flags/flag_uk_d.gif || media/flags/flag_fr_d.gif || media/flags/flag_es_d.gif
lib.langMenu.1.USERDEF1.noLink = 1[/b]

jonas8 ·

Hallo svennail

Möchte mir auch ein Sprachwechsel einrichten, mit special = language, aber mit Text-Links.
Aber komme nicht mehr weiter. Wie kann ich das machen?

temp.sprachwahl = HMENU
temp.sprachwahl.special = language
temp.sprachwahl.special.value = 0,1,2
temp.sprachwahl.1 = TMENU
temp.sprachwahl.1 {
	NO = 1
	NO.??? = Deutsch || Français || English
			
		}
	
seite.10.marks.SPRACHWAHL < temp.sprachwahl

Gruss Jonas