hw_modifyobjectSynopsis
DescriptionThis function replaces the deprecated hw_changeobject() . It allows you to add or remove attributes in an object's stored object record. The attribute names are given as the element keys of the remove_attributes and add_attributes arrays, and the attribute values are given as the element values. If the value is a string, that's taken as the attribute value. If it's an array, it represents a list of attributes with the attribute name, followed by a colon, followed by the attribute value (a typical example would be the multilingual use of the Title attribute). If the value is anything other than a string or array, nothing is done to the attribute (see the following for why this is necessary). There are some rules that must be followed, due to the way that the Hyperwave back-end works. To add a new attribute, you must specify the attribute name in both remove_attributes and add_attributes . The entry in remove_attributes must have a value of anything other than a string or array, so that the server won't try to remove any existing attributes with the same name. The corresponding attribute name/value pair in add_attributes is added as the new attribute. To remove an attribute, specify the name and value of the attribute you want to remove in remove_attributes , and pass NULL for add_attributes . To modify an attribute, place the attribute (name and current value) in remove_attributes , and the same name and the new value in add_attributes . ExampleExample 513. Modify an object's attributes /* Adding a new attribute. Running this n times will result in the same attribute * being added n times. */ echo "Old object record: \n" . hw_getobject($hw_link, $obj_id); $rem_array = array('Jimbo' => 0); $add_array = array('Jimbo' => 'Test One'); hw_modifyobject($hw_link, $obj_id, $rem_array, $add_array); echo "New object record: \n" . hw_getobject($hw_link, $obj_id); /* Remove all attributes with the name 'Jimbo' and value 'Test One' */ echo "Old object record:\n" . hw_getobject($hw_link, $obj_id); $rem_array = array('Jimbo' => 'Test Two'); hw_modifyobject($hw_link, $obj_id, $rem_array, NULL); echo "New object record:\n" . hw_getobject($hw_link, $obj_id);
PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing
(Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch).
This material may be distributed only subject to the terms and conditions set forth
in the Open Publication License, v1.0 or later (the latest version is presently available at
http://www.opencontent.org/openpub/).
The authors of this book have elected not to choose any options under the OPL. This online book was obtained
from http://www.fooassociates.com/phpfer/
and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4
for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All
persons and entities shall have neither liability nor responsibility to any person or entity with respect to
any loss or damage arising from the information contained in this book.
|