 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Matthew Weier O'Phinney's Blog: Responding to Different Content Types in RESTful ZF Apps
by Chris Cornutt March 05, 2010 @ 12:20:22
Continuing on from his previous articles on working with REST in Zend Framework applications (and making the endpoints for a web service) Matthew Weier O'Phinney has a new tutorial with the next logical step in the series, automatically responding to different content types in your application based on the content-type the client sends.
There's no reason you can't re-use your RESTful web service to support multiple formats. Zend Framework and PHP have plenty of tools to assist you in responding to different format requests, so don't limit yourself. With a small amount of work, you can make your controllers format agnostic, and ensure that you respond appropriately to different requests.
He talks about concerns you'll have to worry about when developing your service - grabbing teh raw input instead of the POST values (since most requests will be rawly POSTed) and what to pass that message to to decode it properly. In his example the Zend_Json and Zend_Config_Xml components make it simpler to handle the info and some code to get the results back into your script.
There's also some code for the other side of things - building the response and pushing it out to the correct views depending on the request content type, action and information.
voice your opinion now!
zendframework rest webservice contenttype json xml tutorial
Ibuildings techPortal: Transforming XML with PHP and XSL
by Chris Cornutt December 16, 2009 @ 08:35:37
New on the Ibuildings techPortal today is an article from Michael looking at XML transformation with PHP and XSL (XML-based "style sheets").
If you want to transform XML from one format to another, and especially if either the input or output XML is complicated or the transformation itself is difficult or awkward to express, then XSL may be a good choice. XSL is the eXtensible Stylesheet Language; a family of three W3C recommendations to do with the transformation and presentation of XML documents. This article will walk through some examples of how XSL and PHP can be used to achieve these types of XML tranformations.
He starts off by describing what XSL looks like and how it relates back to the XML you're applying it to. XSL allows you to take an XML file and work with it as a data source to pull bits of information out of or modify and push back out the other side. He gives three specific examples: pulling information out of an XML file, rewriting URLs and one of the more handy things PHP allows you to do - directly call PHP script inside the XSL document for those things that the normal XSL standards don't include.
voice your opinion now!
tutorial xml xsl transform
Sameer Borate's Blog: Beautifying XML documents
by Chris Cornutt September 11, 2009 @ 07:58:15
On his blog today Sameer has a quick new tutorial looking at using the XML_Beautifier PEAR package to "pretty up" your XML documents.
I use xmlPad to format and analyze xml documents, but many times I need to format xml documents on the production server wherein xmlPad is of no use. What one needs is a library that would allow you to beautify your untidy xml documents within your php code. XML_Beautifier provides that solution.
He walks you through the installation and use of the package on a sample script - pulling in the "ugly" XML and outputting the "pretty" XML via the package's formatFile function.
voice your opinion now!
xmlbeautifier xml document tutorial
Evert Pot's Blog: Converting ICalendar to XML
by Chris Cornutt September 03, 2009 @ 10:40:13
Evert Pot has a new post to his blog today looking at a handy script he's developed to convert data formatted in the CalDAV syntax and push it back out as XML.
ICalendar objects have properties, components (such as VEVENT, VTODO) and attributes. This is awfully familiar to XML. So instead of trying to come up with a complicated parser and object structure, I decided to just convert it to XML and use PHP's simplexml.
The post includes the code that does the conversion, an example of CalDAV formatted data and the XML that it would output to.
voice your opinion now!
icalendar xml convert
WebReference.com: XML and PHP Simplified - Formatting XML Documents
by Chris Cornutt August 06, 2009 @ 08:33:04
WebReference.com has the latest tutorial in their "Simplified XML" series posted today. This installment focuses on the formatting of the documents in the browser and how to read them back in.
We have already discussed the XML functions so let's use an example to demonstrate how they work. First, we get the XML file that we want to use. The idea is to create an XML parser. This will then enable us to read and write to an XML document.
Their examples show code that parses an XML document, outputs a simple list of the values inside and how to take an XSL style sheet and apply it to the data as applied through a xml-stylesheet tag.
voice your opinion now!
simple tutorial xml parse style
WebReference.com: XML and PHP Simplified - XML,PHP and the Database
by Chris Cornutt July 23, 2009 @ 12:29:43
WebReference.com continues their simplified look at working with XML in PHP with this new tutorial about working with XML, databases and dynamic generation.
In the previous article, we looked at how to use XML with PHP and saw that it was not very different from writing normal PHP procedures to interact with an XML document. Because PHP treats an XML document like a normal file, it is easy to interact with it, even though its structure is complicated. For example to create a XML document, we use the common functions that PHP uses to create files.
Their examples show how to create a table in a MySQL database, insert some data and pull it back out to push into a dynamically created XML file. Explanation for all of the code is included.
voice your opinion now!
introduction tutorial database xml
PHPro.org: Dynamically Create Menu With PHP DOM
by Chris Cornutt July 20, 2009 @ 10:50:52
New from Kevin Waterson on the PHPro.org site is this tutorial looking at dynamically making a website menu with PHP's DOM functionality.
Most PHP coders will have their own menu generation class that will take an array or an item and add it to a HTML un-ordered list or other tag and the styling is handled with CSS. This has proven to be a worthy solution to menu creation, however, PHP already has all the tools and classes built in to create a menu using DOM. It is both powerful and extensible and further eliminates for yet another class in your tree.
The tutorial shows you how to create a simple XML document to define the menu using the DOM functionality in PHP and finally output it as a series of unordered lists that can be styled in whatever way you want.
voice your opinion now!
xml dom menu dynamic
Chris Jones' Blog: Inserting and Updating Oracle XMLType columns in PHP
by Chris Cornutt July 13, 2009 @ 08:14:21
All of you Oracle users out there might want to check out this recent post from Chris Jones, especially if you've been using the XMLType columns in your tables.
Today a reader mailed me about manipulating XMLType columns when the data is longer than the 4K limit that character-type handling imposes. My free book (see sidebar) has examples of how to do this using CLOB handling in PHP. I noticed that my xmlinsert.php example in the book does a SELECT and UPDATE, but never actually does an INSERT.
To correct the problem of the missing example he includes example code to connect to the database, push the XML into a bind variable and select the row back out to ensure everything's still structured correctly. You need to set up a new descriptor for the insert to work (CLOB).
voice your opinion now!
clob column xmltype xml oracle insert
WebReference.com: XML and PHP Simplified
by Chris Cornutt July 02, 2009 @ 11:54:52
New on WebReference.com is this look (part of a series) at working with XML in PHP, this time it's specifically covering the DOM functionality.
With this series of articles, I will try to simplify and demystify the use and application of XML and the DOM. First, we will look at what XML is and then move on to what functions are available for use to manipulate and use XML.
The tutorial introduces XML and gives a sample structure of a document and breaks it down to explain each of the parts. Following that they look at some of the XML-related functionality to create their sample XML file.
voice your opinion now!
xml simple tutorial
|
Community Events
Don't see your event here? Let us know!
|