cvs: phpdoc-da /reference/strings/functions get-html-translation-table.xml
[email protected] ("Jonathan Holst")
| Newsgroups | php.doc.da |
|---|---|
| Message-ID | <cvsholst1090878211@cvsserver> |
holst Mon Jul 26 17:43:31 2004 EDT
Added files:
/phpdoc-da/reference/strings/functions
get-html-translation-table.xml
Log:
Initial translation
http://cvs.php.net/co.php/phpdoc-da/reference/strings/functions/get-html-translation-table.xml?r=1.1&p=1
Index: phpdoc-da/reference/strings/functions/get-html-translation-table.xml
+++ phpdoc-da/reference/strings/functions/get-html-translation-table.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- EN-Revision: 1.6 Maintainer: holst Status: ready -->
<refentry id="function.get-html-translation-table">
<refnamediv>
<refname>get_html_translation_table</refname>
<refpurpose>
Returnerer oversættelsestabellen brugt af
<function>htmlspecialchars</function> og
<function>htmlentities</function>
</refpurpose>
</refnamediv>
<refsect1>
<title>Beskrivelse</title>
<methodsynopsis>
<type>array</type><methodname>get_html_translation_table</methodname>
<methodparam><type>int</type><parameter>table</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>quote_style</parameter></methodparam>
</methodsynopsis>
<para>
<function>get_html_translation_table</function> vil returnere
oversættelsestabellen som bliver brugt internt i
<function>htmlspecialchars</function> og
<function>htmlentities</function>.
</para>
<para>
Der er to nye konstanter (<constant>HTML_ENTITIES</constant> og
<constant>HTML_SPECIALCHARS</constant>) som tillade dig at specificere
den tabel du ønsker. Som i <function>htmlspecialchars</function>- og
<function>htmlentities</function>-funktionerne kan du valgfrit
specificere <parameter>quote_style</parameter>'en du arbejder med.
Standarden er <constant>ENT_COMPAT</constant>. Se beskrivelsen af disse
tilstande i <function>htmlspecialchars</function>.
</para>
<para>
<example>
<title>Oversættelsestabel-eksempel</title>
<programlisting role="php">
<![CDATA[
<?php
$trans = get_html_translation_table(HTML_ENTITIES);
$str = "Hallo & <Frau> & Krämer";
$encoded = strtr($str, $trans);
?>
]]>
</programlisting>
</example>
<literal>$encoded</literal>-variablen vil nu indeholde <literal>"Hallo
&amp; &lt;Frau&gt; &amp; Kr&auml;mer".</literal>
</para>
<para>
En anden interessant brug af denne funktion er for, med hjælp fra
<function>array_flip</function>, at ændre retningen af oversættelsen.
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
$trans = array_flip($trans);
$original = strtr($encoded, $trans);
?>
]]>
</programlisting>
</informalexample>
Indholdet af <literal>$original</literal> vil nu være: "Hallo &
<Frau> & Krämer".
</para>
<para>
Se også
<function>htmlspecialchars</function>,
<function>htmlentities</function>,
<function>strtr</function> og
<function>array_flip</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->