Location: PHPKode > projects > Content*Builder > modules/article2/selectLanguage.php
<?php
	function set_language($langID, $langFlagArr) {
		$langMatch = false;
		foreach($langFlagArr as $k => $v) {
			if($langID == $k) {
				$langMatch   = true;
				$langMatchID = $langID;
			}
		}
		if($langMatch == false) {
			$langMatchID = "1";
		}
		setcookie("main_language", $langMatchID, time()+604800);
		$_COOKIE[main_language] = $langMatchID;
		return $langMatchID;
	}

	if(!isset($main_language)) {
	   set_language("1", $langFlagArr);
	   $_COOKIE[main_language] = '1';
	}

	if(isset($setLanguage)) {
		$main_language = set_language($setLanguage, $langFlagArr);
	}
	
	/* Sprachauswahl erzeugen */
	foreach($langFlagArr as $k => $v) {
		$langSelectID[] = $k;
		$langSelectFlag[] = $v;
		$langSelectName[] = $langNameArr[$k];
		if($k == $main_language) {
			$langSelectHit[] = 1;
		} else {
			$langSelectHit[] = 0;
		}
	}
	
	if($load == "article2") { $tpl->assign("languageSet", "1"); }
	$tpl->assign("languageSelect", 
		array ( "ID"   => $langSelectID,
				"NAME" => $langSelectName,
				"FLAG" => $langSelectFlag, 
				"GET_PARAMS" => $QUERY_STRING,
				"SELECTED" => $langSelectHit,
				"FLAGDIR"  => $location."templates/"
		)
	);
	$tpl->display("languageSelect.template");
?>
Return current item: Content*Builder