Seite 1 von 1

Umlaute von Ä ins AE (Article List Advance)

Verfasst: So 9. Aug 2009, 15:16
von derSteffen
Hallo liebe Community,

ich versuche meiner Artikle List advance folgendes beizubringen.

In der Headline sollen Umlaute wieder als AE, OE, UE ausgegeben werden, Leerzeichen als Unterstrich usw.

Ich habe versucht mit der Funktion etwas zu machen:

Code: Alles auswählen

function capiStrReplaceDiacritics ($sString, $sourceEncoding = "ISO-8859-1", $targetEncoding = false)
{
	/* If the target encoding isn't set, use source encoding */
	if ($targetEncoding == false)
	{
		$targetEncoding = $sourceEncoding;
	}
	
	// replace regular german umlauts and other common characters with diacritics
    static $aSearch, $aReplace;
    if (!isset($aSearch)) {
        $aSearch  = array('Ä',  'Ö',  'Ü',  'ä',  'ö', 'ü', 'ß',  'Á', 'À', 'Â', 'á', 'à', 'â', 'É', 'È', 'Ê', 'é', 'è', 'ê', 'Í', 'Ì', 'Î', 'í', 'ì', 'î', 'Ó', 'Ò', 'Ô', 'ó', 'ò', 'ô', 'Ú', 'Ù', 'Û', 'ú', 'ù', 'û');
        $aReplace = array('Ae', 'Oe', 'Ue', 'ae', 'oe', 'ue', 'ss', 'A', 'A', 'A', 'a', 'a', 'a', 'E', 'E', 'E', 'e', 'e', 'e', 'I', 'I', 'I', 'i', 'i', 'i', 'O', 'O', 'O', 'o', 'o', 'o', 'U', 'U', 'U', 'u', 'u', 'u');
    }
    $sString = str_replace($aSearch, $aReplace, $sString);
	
	/* TODO: Additional converting */
	
	return ($sString);
}
Ich bin mir auch nicht ganz sicher, wo ich im Output meines Modules sage, gebe Headline-Text wie folgt aus, aber ich denke mal hier:

Code: Alles auswählen

$sTmpValue = html_entity_decode(strip_tags(urldecode($db2->f('headline'))));
               if ($aSettings["HeadlineLength"] > 0 && strlen($sTmpValue) > $aSettings["HeadlineLength"]) {
                  # Cutting text but preserving words and entities
                  $sTmpValue = capiStrTrimAfterWord($sTmpValue, $aSettings["HeadlineLength"])."...";
               }
               $aData[$i]["Headline"] = $sTmpValue;
kann mir bitte jemand vo euch ein eTipp geben?

Vielen Dank schon mal!