list/menu-select language

Gesperrt
ilias
Beiträge: 90
Registriert: Di 13. Nov 2007, 11:49
Wohnort: Greece
Kontaktdaten:

list/menu-select language

Beitrag von ilias »

Can some body help me to make a list/menu on my site?
I want to make a list with 4 languages.And when I click on one of the menu's item I want to go to the page with the similar language.
The answer please in English
HerrB
Beiträge: 6935
Registriert: Do 22. Mai 2003, 12:44
Wohnort: Berlin
Kontaktdaten:

Beitrag von HerrB »

Not tested (and Contenido V4.6.23). This is one way ... (note, that the user needs JS activated...)

Code: Alles auswählen

<?php
cInclude("classes", "class.htmlelements.php");
cInclude("classes", "contenido/class.clientslang.php");
cInclude("classes", "contenido/class.lang.php");

oClientLangs = new cApiClientLanguageCollection();
oClientLangs->setWhere("idclient", $client);
oClientLangs->query();

$oSelLang = new cHTMLSelectElement("selLang");
// This JavaScript is REALLY WRONG - for sure, please fix by yourself
$oSelLang->setEvent("change", "document.href='front_content.php?idart=" . $idart . "&changelang=' + this.value");

while ($oClientLang = $oClientLangs->next()) {
   $iID = $oClientLang->get("idlang");
   $oLang = new cApiLanguage($iID);

   $oOption = new cHTMLOptionElement($oLang->get("name"), $iID);
   $oSelLang->addOptionElement($iID, $oOption);
}

echo $oSelLang->render();
?>
Bitte keine unaufgeforderten PMs oder E-Mails -> use da Forum!

Newsletter: V4.4.x | V4.6.0-15 (Module, Backend) | V4.6.22+
Standardartikelliste: V4.4.x | V4.6.x
http://www.contenido.org/forum/search.php | http://faq.contenido.org | http://www.communido.net
Gesperrt