svn: /pear/peardoc/trunk/en/package/html/html-common2/ attributes.xml

From: Date: Sun, 08 Apr 2012 17:07:54 +0000
Subject: svn: /pear/peardoc/trunk/en/package/html/html-common2/ attributes.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-12175@lists.php.net to get a copy of this message
avb Sun, 08 Apr 2012 17:07:54 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=324962 Log: Document changes in HTML_Common2 2.1.0 Changed paths: U pear/peardoc/trunk/en/package/html/html-common2/attributes.xml Modified: pear/peardoc/trunk/en/package/html/html-common2/attributes.xml =================================================================== --- pear/peardoc/trunk/en/package/html/html-common2/attributes.xml 2012-04-08 16:47:53 UTC (rev 324961) +++ pear/peardoc/trunk/en/package/html/html-common2/attributes.xml 2012-04-08 17:07:54 UTC (rev 324962) @@ -37,6 +37,32 @@ output, attribute names will always be lowercased and quotes will be used around attribute values when outputting the attribute string.</para> </refsection> + <refsection xml:id="package.html.html-common2.attributes.array"> + <info> + <title>Using array notation</title> + </info> + <para> + Since release 2.1.0 <classname>HTML_Common2</classname> implements <link + xmlns:xlink="http://www.w3.org/1999/xlink" + xlink:href="&url.php.lookup;ArrayAccess"><interfacename>ArrayAccess</interfacename></link> + interface, allowing access to attributes using array notation: + <example> + <title>Accessing attributes as array keys</title> + <programlisting role="php"><![CDATA[ +if (!isset($html['id'])) { + // equivalent to $html->setAttribute('id', 'foo'); + $html['id'] = 'foo'; +} +// equivalent to $html->setAttribute('checked'); +$html[] = 'checked'; +// equivalent to $html->removeAttribute('checked'); +unset($html['checked']); + ]]></programlisting> + </example> + + </para> + + </refsection> <refsection xml:id="package.html.html-common2.attributes.class"> <info> <title>Working with CSS Classes</title>

« previous php.pear.doc (#12175) next »