Databases Reference
In-Depth Information
$root → appendChild($elem);
$elemtext = $doc → createTextNode($value);
$elem → appendChild($elemtext);
}
$myDoc = new Zend_Db_Xml_XmlContent($doc);
$about = new DOMDocument();
$abtRoot = $about → createElement("contacts");
$about → appendChild($abtRoot);
$myDoc → about = $about;
$db → saveNew($myDoc);
Since the php array objects are associative, that is, stored as a $key $value
pair, you can see it is easy to create XML elements and attributes by just looping
through the $_POST array.
Modifying data in XCS
If you notice in the previous example, the add/member action adds a member's
profile into data and constructs an empty XML for ABOUT column. An empty
element < /contacts > is created and stored in XCS. When a logged-in user
browses a myContacts member and adds the member as a contact, the
add/contact action is invoked. The contactAction invokes the database method
addContact, which calls XCS's update function to update the entire xml
document. The db addContact() method is explained in detail in the previous
database section.
ViewController
Similar to AddController, ViewController must not implement index action.
However, this controller should implement a __call() to handle dynamic actions
such as the following URL. This makes sure that any URL typing by the user is
handled appropriately.
http://localhost/view/123.
We discussed other actions such as search and display in detail in the previous
database section.
You can download the social network application called myContacts.com
application from the IBM Redbooks Web site at:
http://www.redbooks.ibm.com
Appendix C, “Additional material” on page 319” describes the download
instructions.
 
Search WWH ::




Custom Search