[PHP-DEV] CVS update: php3/doc/functions From: steinm (php-dev <email protected>)
Date: 04/30/99

Date: Friday April 30, 1999 @ 6:29
Author: steinm

Update of /repository/php3/doc/functions
In directory php:/tmp/cvs-serv23613/doc/functions

Modified Files:
        hw.sgml
Log Message:
- different parameter evaluation of hw_modifyobject() (see docs)
- updated documentation

Index: php3/doc/functions/hw.sgml
diff -u php3/doc/functions/hw.sgml:1.18 php3/doc/functions/hw.sgml:1.19
--- php3/doc/functions/hw.sgml:1.18 Sat Apr 17 03:13:11 1999
+++ php3/doc/functions/hw.sgml Fri Apr 30 06:29:17 1999
@@ -337,7 +337,14 @@
      <parameter>remove</parameter> is a list of attributes to remove.
      The second array <parameter>add</parameter> is a list of attributes
      to add. In order to modify an attribute one will have to remove
- the old one and add a new one.
+ the old one and add a new one. <function>hw_modifyobject</function>
+ will always remove the attributes before it adds attributes.
+ The keys of both arrays are the attributes name. The value of each
+ array element can either be an array of a string. If it is an array
+ each attribute value is constructed by the key of each element plus
+ a colon an the value of each element. If it is a string it is taken
+ as the attribute value.
+
     <para>
      If you would like to change the attribute 'Name' with the current
      value 'books' into 'articles' you will have to create two arrays
@@ -353,10 +360,13 @@
       </programlisting>
      </example>
      In order to delete/add a name=value pair from/to the object record just
- pass the remove/add array and set the last/third parameter to NULL.
+ pass the remove/add array and set the last/third parameter to an empty
+ array.
     <para>
- Note: Multilingual attributes, e.g. 'Title', have to be provided in its
- native form 'language':'title'. The above example would than be:
+ Note: Multilingual attributes, e.g. 'Title', can be modified in two
+ ways. Either by providing the attributes value in its native form
+ 'language':'title' or by providing an array with elements for each
+ language as described above. The above example would than be:
      <example>
       <title>modifying Title attribute</title>
       <programlisting role="php">
@@ -365,8 +375,35 @@
        $hw_modifyobject($connect, $objid, $remarr, $addarr);
       </programlisting>
      </example>
+ or
+ <example>
+ <title>modifying Title attribute</title>
+ <programlisting role="php">
+ $remarr = array("Title" => array("en" => "Books"));
+ $addarr = array("Title" => array("en" => "Articles", "ge"=>"Artikel"));
+ $hw_modifyobject($connect, $objid, $remarr, $addarr);
+ </programlisting>
+ </example>
      This removes the english title 'Books' and adds the english title
- 'Articles'.
+ 'Articles' and the german title 'Artikel'.
+ <example>
+ <title>removing attribute</title>
+ <programlisting role="php">
+ $remarr = array("Title" => "");
+ $addarr = array("Title" => "en:Articles");
+ $hw_modifyobject($connect, $objid, $remarr, $addarr);
+ </programlisting>
+ </example>
+ This will remove all attributes with the name 'Title' and adds a
+ new 'Title' attribute. This comes in handy if you want to remove
+ attributes recursively.
+ <para>
+ If you need to delete all attributes with a certain name you will have
+ to pass an empty string as the attribute value.
+ <para>
+ Note: Only the attributes 'Title', 'Description' and 'Keyword' will
+ properly handle the language prefix. If those attributes don't carry
+ a language prefix, the prefix 'xx' will be assigned.
     <para>
      Returns TRUE if no error occurs otherwise FALSE.
    </refsect1>

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>