CakePhp 3 Xml and Basic Auth
Hi guys, I have a weird problem when trying to acces an XML file with Basic Authentication enable. When i try to acces the url to retrieve JSON, all work as intended: browser ask username & password. Successfull auth give me the json, auth failed = json with status 401. Same Url but in XML format: the browser never ask for credential, the reponse start with: *Warning* (4096): Object of class Cake\Network\Request could not be converted to string [*CORE\src\Utility\Xml.php*, line *338*] If I request the json with right credential, then ask the XML, I get the xml file. Maybe I made a mistake, but I can't find where ! Thanks ps: Cakephp 3.1.4. ps 2: sorry for my english -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: XML output
Take a look in the CakePHP book 2.x at this location http://book.cakephp.org/2.0/en/views/json-and-xml-views.html#using-a-data-view-with-view-files The solution is written in the class XmlView section :) Enjoy, John On Tuesday, 30 June 2015 16:43:25 UTC+3, Juan Ezquerro LLanes wrote: I'm using cake 2.x, how can i use _rootNode for custom xml output? I would like to delete the response/response labels. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
XML output
I'm using cake 2.x, how can i use _rootNode for custom xml output? I would like to delete the response/response labels. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Read XML data and show into Menu
I am not getting the idea .. how to do this plz urgently send me the solution... -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: XML Parsing Error in Google Shopping Feed
Read about XML CDATA, this will help you http://stackoverflow.com/questions/2784183/what-does-cdata-in-xml-mean On Monday, September 8, 2014 7:53:15 PM UTC+2, Rafael Queiroz wrote: Hi, I'm trying Google Shopping feed in my app, i using Cake 2.2.5, parseExtensions and RequestHandler respondAs XML. The sitemap.xml is perfect but feed.xml returned XML Parsing Error: undefined entity. The content i'm using is example_feed.xml from Google Shopping (copied in https://gist.github.com/rafaelqueiroz/55b7a360da3f4e82efa3). Why ? How work ? Thanks. -- Regards, Rafael F. Queiroz -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
XML Parsing Error in Google Shopping Feed
Hi, I'm trying Google Shopping feed in my app, i using Cake 2.2.5, parseExtensions and RequestHandler respondAs XML. The sitemap.xml is perfect but feed.xml returned XML Parsing Error: undefined entity. The content i'm using is example_feed.xml from Google Shopping (copied in https://gist.github.com/rafaelqueiroz/55b7a360da3f4e82efa3). Why ? How work ? Thanks. -- Regards, Rafael F. Queiroz -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
How to convert this php array into xml?
I am using cakephp v2.5. I would like to convert an array into xml. The array looks like this; $Items = array( (int) 0 = array( 'Item' = array( 'id' = '2' ) ), (int) 1 = array( 'Item' = array( 'id' = '4' ) )) To convert this array to xml, the following php code was run; $xmlObject = Xml::fromArray(array('response' = $Items )); echo $xmlObject-asXML(); Unfortunately, the following error was encountered; Warning (2): SimpleXMLElement::__construct(): Entity: line 3: parser error : Extra content at the end of the document [CORE\Cake\Utility\Xml.php, line 221] I think I found the problem but still not have the solution. The output of array('response' = $Items) returns a maximum depth reached message. Anyone can advise? How can this array be converted into xml in php or cakephp (using cake's built-in functions)? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: How to convert this php array into xml?
I had some issues initially with this, I've taken a method from one of my shells and stripped it down to something basic with a multidimensional array. http://pastie.org/private/6ljulcnwc7dqwsxcpqdjbq Maybe if you try using $xmlObject = Xml::build(array('response' = $Items)); followed by $xmlObject-asXML(); On 21 August 2014 10:59, Sam lightai...@gmail.com wrote: I am using cakephp v2.5. I would like to convert an array into xml. The array looks like this; $Items = array( (int) 0 = array( 'Item' = array( 'id' = '2' ) ), (int) 1 = array( 'Item' = array( 'id' = '4' ) )) To convert this array to xml, the following php code was run; $xmlObject = Xml::fromArray(array('response' = $Items )); echo $xmlObject-asXML(); Unfortunately, the following error was encountered; Warning (2): SimpleXMLElement::__construct(): Entity: line 3: parser error : Extra content at the end of the document [CORE\Cake\Utility\Xml.php, line 221] I think I found the problem but still not have the solution. The output of array('response' = $Items) returns a maximum depth reached message. Anyone can advise? How can this array be converted into xml in php or cakephp (using cake's built-in functions)? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout. -- Kind Regards Stephen Speakman -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Parse RSS/xml data using cakephp XML Lib (Cake 1.3.X).
$data= trim(file_get_contents($url)); App::import('Xml'); $xml = new Xml($data); // This converts the Xml document object to a formatted array $xmlAsArray = Set::reverse($xml); // Or you can convert simply by calling toArray(); $xmlAsArray = $xml-toArray(false); return $xmlAsArray; Enjoy. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
How to get URL parameters in cakephp with URL that ends with xml?
I would like to pass URL parameters in cakephp with URL that ends with xml like below; http://localhost/cp251/controller/api_get_info?page=1.xml The controller function looks like this; public function api_get_info(){ if($this-RequestHandler-responseType() == 'xml') { //Problem is that the code never executes inside this if statement //Controller action }} The problem is that the code never executes inside the if statement if($this-RequestHandler-responseType() == 'xml'). However, if the URL becomes http://localhost/cp251/controller/api_get_info.xml, then the code will execute inside the if statement. Unfortunately, this is not what I want because the URL parameters cannot be sent. How can I pass URL parameters in cakephp with URL that ends with xml? I am using cakephp 2.5.1 Thank you. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: How to get URL parameters in cakephp with URL that ends with xml?
Have a look at http://book.cakephp.org/2.0/en/development/routing.html#Router::parseExtensions On 4 Jun 2014, at 10:41, Sam lightai...@gmail.com wrote: I would like to pass URL parameters in cakephp with URL that ends with xml like below; http://localhost/cp251/controller/api_get_info?page=1.xml The controller function looks like this; public function api_get_info() { if($this-RequestHandler-responseType() == 'xml') { //Problem is that the code never executes inside this if statement //Controller action } } The problem is that the code never executes inside the if statement if($this-RequestHandler-responseType() == 'xml'). However, if the URL becomes http://localhost/cp251/controller/api_get_info.xml, then the code will execute inside the if statement. Unfortunately, this is not what I want because the URL parameters cannot be sent. How can I pass URL parameters in cakephp with URL that ends with xml? I am using cakephp 2.5.1 Thank you. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: How to get URL parameters in cakephp with URL that ends with xml?
Duplicate of http://stackoverflow.com/questions/24033937/extracting-url-parameters-in-cakephp-with-url-that-ends-with-xml Am Mittwoch, 4. Juni 2014 11:41:56 UTC+2 schrieb Sam: I would like to pass URL parameters in cakephp with URL that ends with xml like below; http://localhost/cp251/controller/api_get_info?page=1.xml The controller function looks like this; public function api_get_info(){ if($this-RequestHandler-responseType() == 'xml') { //Problem is that the code never executes inside this if statement //Controller action }} The problem is that the code never executes inside the if statement if($this-RequestHandler-responseType() == 'xml'). However, if the URL becomes http://localhost/cp251/controller/api_get_info.xml, then the code will execute inside the if statement. Unfortunately, this is not what I want because the URL parameters cannot be sent. How can I pass URL parameters in cakephp with URL that ends with xml? I am using cakephp 2.5.1 Thank you. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
(Web Service) Using XML to Output HTML into my website
Hello. I hope I can explain myself clearly so that I will get help here. I've been given a web service access to show content to my website (The web service is in a another domain). The information is about Hotels (Hotels names, Hotel Images, Hotel Category, Hotels Locations, Hotels descriptions). The file is like the following: soap:Envelope xmlns:soap=http://www.w3.org/2003/05/soap-envelope; xmlns:bud=http://www.softur.com.ar/wsbridge/budget.wsdl; xmlns:bud1=http://www.softur.com.ar/wsbridge/budget.xsd; soap:Header/ soap:Body bud:searchHotelFaresRQ1 !--Optional:-- cityLocation code=PMV / dateFrom2014-05-30/dateFrom dateTo2014-05-31/dateTo name/name pos idFakeID/id passwordFakePassWord/password /pos currencyUSD/currency OtherBrokertrue/OtherBroker FareTypeSelectionList xmlns=http://www.softur.com.ar/wsbridge/budget.xsd; FareTypeSelection OccupancyId=11/FareTypeSelection Ocuppancy OccupancyId=1 Occupants type=ADT / Occupants type=ADT / /Ocuppancy /FareTypeSelectionList /bud:searchHotelFaresRQ1 /soap:Body /soap:Envelope I am running that request using soapUI 3.5.1, which outputs an XML file with lots of data about Hotels. HotelFares UniqueId=HT|0011080 BackOfficeCode=000814 BackOfficeOperatorCode=00658 xmlns= HotelAddress xmlns=http://www.softur.com.ar/wsbridge/budget.xsd;Hotel Address/HotelAddress NameHOTEL AGUA DORADA/Name Category 4 */Category HotelPhone xmlns=http://www.softur.com.ar/wsbridge/budget.xsd;55/HotelPhone HotelZone xmlns=http://www.softur.com.ar/wsbridge/budget.xsd;Hotel Zone Area/HotelZone HotelAccess xmlns=http://www.softur.com.ar/wsbridge/budget.xsd;Address Description of the Hotel Here/HotelAccess HotelPosition xmlns=http://www.softur.com.ar/wsbridge/budget.xsd; Latitude-63.93631/Latitude Longitude11.022754/Longitude /HotelPosition /HotelFares I want to show that information as an HTML file into my website, but I don't know how to go about this. I guess saving these information appropriately into a database, and then spitting that information from the database to my website would be a way. Any help I can get here using CakePHP so that I would know where to start would really help. Thanks in advance. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
View come from XML file
Hi, We have created an XML file and need to show view to using that XML file and XSLT file. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
RE: (Web Service) Using XML to Output HTML into my website
Hello, I guess that you can parse the XML file using PHP and output that as HTML. For example: http://blog.teamtreehouse.com/how-to-parse-xml-with-php5 http://www.php.net/manual/en/book.xml.php Since you’re using CakePHP, the “right” way is using a DataSource that does this conversion. You can either write that yourself (sounds scary, but it’s not that bad, especially if you only need to read information), or try to find a community-written SOAP datasource that does what you want (or make little adjustments to make it work.) For example:” http://blog.pagebakers.nl/2008/12/18/soapsource-a-soap-client-datasource-for-cakephp/ http://book.cakephp.org/2.0/en/models/datasources.html Once you convert from SOAP to a CakePHP-DB like sort of thing, generating the HTML is simple enough. An alternative way (non-CakePHP) would be to use XSLT (e.g., http://www.w3schools.com/xml/xml_xsl.asp) to convert from HTML to XML. You may either accomplish this client-side, or write a simple script (PHP or otherwise) that does the parsing. Then you can read the styled document and include it where needed. That should get you started. PS: Are you sure your domain name isn’t supposed to be .tur.ar? https://nic.ar/dominios-tur-ar.xhtml From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of NHGDESIGN Sent: 27. mai 2014 17:22 To: cake-php@googlegroups.com Subject: (Web Service) Using XML to Output HTML into my website Hello. I hope I can explain myself clearly so that I will get help here. I've been given a web service access to show content to my website (The web service is in a another domain). The information is about Hotels (Hotels names, Hotel Images, Hotel Category, Hotels Locations, Hotels descriptions). The file is like the following: soap:Envelope xmlns:soap=http://www.w3.org/2003/05/soap-envelope; xmlns:bud=http://www.softur.com.ar/wsbridge/budget.wsdl; xmlns:bud1=http://www.softur.com.ar/wsbridge/budget.xsd; soap:Header/ soap:Body bud:searchHotelFaresRQ1 !--Optional:-- cityLocation code=PMV / dateFrom2014-05-30/dateFrom dateTo2014-05-31/dateTo name/name pos idFakeID/id passwordFakePassWord/password /pos currencyUSD/currency OtherBrokertrue/OtherBroker FareTypeSelectionList xmlns=http://www.softur.com.ar/wsbridge/budget.xsd; FareTypeSelection OccupancyId=11/FareTypeSelection Ocuppancy OccupancyId=1 Occupants type=ADT / Occupants type=ADT / /Ocuppancy /FareTypeSelectionList /bud:searchHotelFaresRQ1 /soap:Body /soap:Envelope I am running that request using soapUI 3.5.1, which outputs an XML file with lots of data about Hotels. HotelFares UniqueId=HT|0011080 BackOfficeCode=000814 BackOfficeOperatorCode=00658 xmlns= HotelAddress xmlns=http://www.softur.com.ar/wsbridge/budget.xsd;Hotel Address/HotelAddress NameHOTEL AGUA DORADA/Name Category 4 */Category HotelPhone xmlns=http://www.softur.com.ar/wsbridge/budget.xsd;55/HotelPhone HotelZone xmlns=http://www.softur.com.ar/wsbridge/budget.xsd;Hotel Zone Area/HotelZone HotelAccess xmlns=http://www.softur.com.ar/wsbridge/budget.xsd;Address Description of the Hotel Here/HotelAccess HotelPosition xmlns=http://www.softur.com.ar/wsbridge/budget.xsd; Latitude-63.93631/Latitude Longitude11.022754/Longitude /HotelPosition /HotelFares I want to show that information as an HTML file into my website, but I don't know how to go about this. I guess saving these information appropriately into a database, and then spitting that information from the database to my website would be a way. Any help I can get here using CakePHP so that I would know where to start would really help. Thanks in advance. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.commailto:cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.commailto:cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout. Ricardo Vieitez | Student Assistant - Network Administration University of Florida Department of Housing and Residence Education PO Box 112100 | Gainesville, FL 32611-2100 office 352.392.2171 x10355 | fax 352.392.6819 | ricar...@housing.ufl.edumailto:ricar...@housing.ufl.edu StrengthsQuest Top 5: Analytical, Strategic, Learner, Responsibility, Relator - Find Out Morehttp://www.strengthsquest.com/content/141728/index.aspx Please consider the environment before printing this email. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us
Re: (Web Service) Using XML to Output HTML into my website
Hi, What about moving that data to an array and then use that array to show the information in html? Something as follow: $xml=Xml::build('YOUR XML URL'); $hotelFares = $xml-xpath('HotelFares_PATH_IN_XML'); You can even use Xml::toArray() to convert your object into an array. Is that what you was looking for? Regards, Fernando 2014-05-27 18:21 GMT-03:00 NHGDESIGN hover.tours.p...@gmail.com: Hello. I hope I can explain myself clearly so that I will get help here. I've been given a web service access to show content to my website (The web service is in a another domain). The information is about Hotels (Hotels names, Hotel Images, Hotel Category, Hotels Locations, Hotels descriptions). The file is like the following: soap:Envelope xmlns:soap=http://www.w3.org/2003/05/soap-envelope; xmlns:bud=http://www.softur.com.ar/wsbridge/budget.wsdl; xmlns:bud1= http://www.softur.com.ar/wsbridge/budget.xsd; soap:Header/ soap:Body bud:searchHotelFaresRQ1 !--Optional:-- cityLocation code=PMV / dateFrom2014-05-30/dateFrom dateTo2014-05-31/dateTo name/name pos idFakeID/id passwordFakePassWord/password /pos currencyUSD/currency OtherBrokertrue/OtherBroker FareTypeSelectionList xmlns= http://www.softur.com.ar/wsbridge/budget.xsd; FareTypeSelection OccupancyId=11/FareTypeSelection Ocuppancy OccupancyId=1 Occupants type=ADT / Occupants type=ADT / /Ocuppancy /FareTypeSelectionList /bud:searchHotelFaresRQ1 /soap:Body /soap:Envelope I am running that request using soapUI 3.5.1, which outputs an XML file with lots of data about Hotels. HotelFares UniqueId=HT|0011080 BackOfficeCode=000814 BackOfficeOperatorCode=00658 xmlns= HotelAddress xmlns= http://www.softur.com.ar/wsbridge/budget.xsd;Hotel Address/HotelAddress NameHOTEL AGUA DORADA/Name Category 4 */Category HotelPhone xmlns= http://www.softur.com.ar/wsbridge/budget.xsd;55/HotelPhone HotelZone xmlns= http://www.softur.com.ar/wsbridge/budget.xsd;Hotel Zone Area/HotelZone HotelAccess xmlns= http://www.softur.com.ar/wsbridge/budget.xsd;Address Description of the Hotel Here/HotelAccess HotelPosition xmlns= http://www.softur.com.ar/wsbridge/budget.xsd; Latitude-63.93631/Latitude Longitude11.022754/Longitude /HotelPosition /HotelFares I want to show that information as an HTML file into my website, but I don't know how to go about this. I guess saving these information appropriately into a database, and then spitting that information from the database to my website would be a way. Any help I can get here using CakePHP so that I would know where to start would really help. Thanks in advance. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout. -- Fernando Negrotto -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
CakePHP 3.0-dev3 Xml Request Handling
For those reading at home, reuben opened an issue and that issue has been fixed. -mark -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
CakePHP 3.0-dev3 Xml Request Handling
Hi I'm wondering what the correct method of serializing models for XML output should be? After getting XML request routing working, via explicitly specifying xml in the Router::parseExtensions() call, I'm getting an error when doing a serialize on a paginated model. The error is response script/ message DOMText::__construct() expects parameter 1 to be string, object given /message url/authors.xml/url code500/code /response In my AuthorsController, the action is: public function index() { $authors = $this-paginate($this-Authors); $this-set(array( 'authors' = $authors, '_serialize' = array('authors') )); } In AppController, I have public $components = array('RequestHandler'); In routes.php I have Router::mapResources('authors'); Router::parseExtensions(['xml']); I have Template/Authors/index.ctp, but I'm expecting that to get used for the HTML request only. The .xml extension should use the XmlView. The URL usage is http://localhost/authors.xml The error trace is: 2014-05-20 23:28:55 Error: [DOMException] DOMText::__construct() expects parameter 1 to be string, object given Request URL: /authors.xml Stack Trace: #0 C:\dev\projects\intalio-webservice\src\app\vendor\cakephp\cakephp\src\Utility\Xml.php(259): DOMText-__construct(Object(Cake\ORM\ResultSet)) #1 C:\dev\projects\intalio-webservice\src\app\vendor\cakephp\cakephp\src\Utility\Xml.php(322): Cake\Utility\Xml::_fromArray(Object(DOMDocument), Object(DOMElement), Array, 'tags') #2 C:\dev\projects\intalio-webservice\src\app\vendor\cakephp\cakephp\src\Utility\Xml.php(283): Cake\Utility\Xml::_createChild(Array) #3 C:\dev\projects\intalio-webservice\src\app\vendor\cakephp\cakephp\src\Utility\Xml.php(216): Cake\Utility\Xml::_fromArray(Object(DOMDocument), Object(DOMDocument), Array, 'tags') #4 C:\dev\projects\intalio-webservice\src\app\vendor\cakephp\cakephp\src\View\XmlView.php(151): Cake\Utility\Xml::fromArray(Array, Array) #5 C:\dev\projects\intalio-webservice\src\app\vendor\cakephp\cakephp\src\View\XmlView.php(115): Cake\View\XmlView-_serialize(Array) #6 C:\dev\projects\intalio-webservice\src\app\vendor\cakephp\cakephp\src\Controller\Controller.php(620): Cake\View\XmlView-render(NULL, NULL) #7 C:\dev\projects\intalio-webservice\src\app\vendor\cakephp\cakephp\src\Routing\Dispatcher.php(143): Cake\Controller\Controller-render() #8 C:\dev\projects\intalio-webservice\src\app\vendor\cakephp\cakephp\src\Routing\Dispatcher.php(109): Cake\Routing\Dispatcher-_invoke(Object(App\Controller\AuthorsController)) #9 C:\dev\projects\intalio-webservice\src\app\webroot\index.php(37): Cake\Routing\Dispatcher-dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response)) #10 {main} I guess because of the way that Models have changed, perhaps a ResultSet can not simply be serialized to XML that way that we might have done previously. Is what I'm doing expected to work? Regards Reuben Helms -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Generate XML using controller and force it to sent as download
Still haven't figured this out. Is this at all possible with CakePHP? I can't imagine it would not be possible. thanks On Thursday, December 19, 2013 5:16:50 PM UTC+1, Willem wrote: Hi, Goal: I have a button on a page. When user clicks it should generate a XML file and make it download (instead of opening in browser window). Cake version: 1.3 So I create a HTML link like this: ?php echo $html-link( __('Generate XML file', true), array('action'='generateXMLFile','ext'='xml'), array('class'='button','target'='_blank') ); ? Which outputs a simple HTML link. I have added in Routes: Router::parseExtensions('json','xml'); My action: function generateXMLFile(){ // Configure::write('debug',0); // Only XML Requests if(!$this-RequestHandler-isXml()){ die(); } } My view: response posts Post idtest 234/id /Post /posts /response My Layout: ?php header('Content-type: text/xml');? ?php echo $this-Xml-header(); ? ?php echo $content_for_layout; ? Now when I click the link the XML is sent as output to the screen. Clicking with right mousebutton -save as.. makes it possible to save the file as XML. Headers are correctly set as text/xml How can i prevent this from outputting to the screen but output it to a file/stream for download ? thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Generate XML using controller and force it to sent as download
It can be done with regular PHP, so it can be done with CakePHP. The MediaView is a view class uses specifically for downloading files, and media, rather than viewing in the browser. However, this usually requires that the file is locally available on the disk, and this isn't happening in your case. However, looking at the MediaView and related processing, we can see that you need the Content-Disposition header entry, to force an attachment, with a particular file name. So, using a cheats method, include the following in your layout: ?php header('Content-Disposition: attachment; filename=myxml.xml'); ? Though you may want to using something a bit more CakePHP friendly than the raw header() command. It's been a while since I've done development in CakePHP 1.3, however in CakePHP 2.4, you can specify $this-response-download($filename); to write that header. Regards Reuben Helms On Thursday, 2 January 2014 21:43:03 UTC+10, Willem wrote: Still haven't figured this out. Is this at all possible with CakePHP? I can't imagine it would not be possible. thanks On Thursday, December 19, 2013 5:16:50 PM UTC+1, Willem wrote: Hi, Goal: I have a button on a page. When user clicks it should generate a XML file and make it download (instead of opening in browser window). Cake version: 1.3 So I create a HTML link like this: ?php echo $html-link( __('Generate XML file', true), array('action'='generateXMLFile','ext'='xml'), array('class'='button','target'='_blank') ); ? Which outputs a simple HTML link. I have added in Routes: Router::parseExtensions('json','xml'); My action: function generateXMLFile(){ // Configure::write('debug',0); // Only XML Requests if(!$this-RequestHandler-isXml()){ die(); } } My view: response posts Post idtest 234/id /Post /posts /response My Layout: ?php header('Content-type: text/xml');? ?php echo $this-Xml-header(); ? ?php echo $content_for_layout; ? Now when I click the link the XML is sent as output to the screen. Clicking with right mousebutton -save as.. makes it possible to save the file as XML. Headers are correctly set as text/xml How can i prevent this from outputting to the screen but output it to a file/stream for download ? thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Generate XML using controller and force it to sent as download
Hi, Goal: I have a button on a page. When user clicks it should generate a XML file and make it download (instead of opening in browser window). Cake version: 1.3 So I create a HTML link like this: ?php echo $html-link( __('Generate XML file', true), array('action'='generateXMLFile','ext'='xml'), array('class'='button','target'='_blank') ); ? Which outputs a simple HTML link. I have added in Routes: Router::parseExtensions('json','xml'); My action: function generateXMLFile(){ // Configure::write('debug',0); // Only XML Requests if(!$this-RequestHandler-isXml()){ die(); } } My view: response posts Post idtest 234/id /Post /posts /response My Layout: ?php header('Content-type: text/xml');? ?php echo $this-Xml-header(); ? ?php echo $content_for_layout; ? Now when I click the link the XML is sent as output to the screen. Clicking with right mousebutton -save as.. makes it possible to save the file as XML. Headers are correctly set as text/xml How can i prevent this from outputting to the screen but output it to a file/stream for download ? thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
XML-RPC DataSource - client for Wordpress
I'm searching for an example or tutorial on how to implement a Xml-rpc client for Wordpress using the cakephp datasource. Someone has any example or tutorial to help me? Thank you. Eduardo Barbosa Moreira *Eng. Mecatrônico :: Programador Java* -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
File download from Soap Resonse (binary from xml)
Hi Ive a working soapclient now. So far so good :) In the response I am getting a binary string as a object (php5 Soapclient class). NowI would like to extract this binary-object and offer a option to display or download it. What is the best way to do this with cake? I have already tried the build in response class. But it seems this will need to have the file in the file system first (needs path setting in the cookbook example). I am glad to avoid this. Could you provide a short example how to do this? Thanks, Frank -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Format my XML output in CakePHP
It's not that simple. Even though the array is changed, will still give something like: response players Player id2/id first_nameCiro/first_name second_nameSpee/second_name /Player /players playersPlayer id3/id first_nameUgo/first_name second_nameRidi/second_name/Player/players /response I have the same problem. So I tried to isolate the problem, and I think it is on the array returned by the Model class. The array returned by the function find is: array( (int) 0 = array( 'Project' = array( 'id' = '1' ) ), (int) 1 = array( 'Project' = array( 'id' = '2', ) ) ) And the one which is cited in the documentation for XML (http://book.cakephp.org/2.0/en/core-utility-libraries/xml.html#transforming-an-array-into-a-string-of-xml) is: array( 'projects' = array( 'project' = array( (int) 0 = array( 'id' = (int) 1 ), (int) 1 = array( 'id' = (int) 2 ) ) ) ) Even after the XmlView._serialize() insert the response and output nodes, still have differences. I'm using the 2.3.0 version, and there is no issue about this on http://cakephp.lighthouseapp.com/dashboard This is really a problem? Em quarta-feira, 23 de janeiro de 2013 22h26min36s UTC-2, jsundquist escreveu: Change your set array to be players instead of output. On Jan 23, 2013 6:01 PM, Mariano C. mariano@gmail.com javascript: wrote: I have the players table with three field id, first_name, last_name. The PlayersController have method index that show every player in the table: public function index() { $output = $this-Player-find('all'); $this-set(array( 'output' = $output, '_serialize' = array('output') )); $this-render('generic_response'); } and the generic_response is an XML view that look like this: ?php $xml = Xml::fromArray(array('response' = $output)); echo $xml-asXML(); The resulting XML is: response output Player id2/id first_nameCiro/first_name second_nameSpee/second_name /Player /output output Player id3/id first_nameUgo/first_name second_nameRidi/second_name /Player /output/response but I want something like: response players Player id2/id first_nameCiro/first_name second_nameSpee/second_name /Player Player id3/id first_nameUgo/first_name second_nameRidi/second_name /Player /players/response How can I do this? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake...@googlegroups.comjavascript: . To unsubscribe from this group, send email to cake-php+u...@googlegroups.com javascript:. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Parse XML string as PHP Array
Try http://book.cakephp.org/2.0/en/development/rest.html#accepting-input-in-other-formats So, by following http://book.cakephp.org/2.0/en/development/rest.html#the-simple-setup //In app/Config/routes.php...Router::mapResources('seasons'); Router::parseExtensions(array('xml')); and by adding RequestHandler component to AppController, XML input will be auto-converted into $this-request-data --ready for saving. Anyway, to convert XML to an array see http://book.cakephp.org/2.0/en/core-utility-libraries/xml.html#xml-api On Friday, January 25, 2013 8:19:00 AM UTC+1, Mariano C. wrote: I'm creating a RESTful webservice, right now I'm facing the insertion of the new resource (the Seasonresource). This is the body of the POST request: request Season titlenew title/title /Season/request and this is the controller that effectively perform the insertion: public function add() { // i feel shame for this line :) $request = json_decode(json_encode((array) simplexml_load_string($this-request-input())), 1); if (!empty($request)) { $obj = compact(request); if ($this-Season-save($obj['request'])) { $output['status'] = Configure::read('WS_SUCCESS'); $output['message'] = 'OK'; } else { $output['status'] = Configure::read('WS_GENERIC_ERROR'); $output['message'] = 'KO'; } $this-set('output', $output); } $this-render('generic_response');} The code works pretty well, but as I wrote in the snippet above I consider the first line of the controller really ugly, so, the question is: How can I parse XML string as PHP Array? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Parse XML string as PHP Array
I'm creating a RESTful webservice, right now I'm facing the insertion of the new resource (the Seasonresource). This is the body of the POST request: request Season titlenew title/title /Season/request and this is the controller that effectively perform the insertion: public function add() { // i feel shame for this line :) $request = json_decode(json_encode((array) simplexml_load_string($this-request-input())), 1); if (!empty($request)) { $obj = compact(request); if ($this-Season-save($obj['request'])) { $output['status'] = Configure::read('WS_SUCCESS'); $output['message'] = 'OK'; } else { $output['status'] = Configure::read('WS_GENERIC_ERROR'); $output['message'] = 'KO'; } $this-set('output', $output); } $this-render('generic_response');} The code works pretty well, but as I wrote in the snippet above I consider the first line of the controller really ugly, so, the question is: How can I parse XML string as PHP Array? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Format my XML output in CakePHP
I have the players table with three field id, first_name, last_name. The PlayersController have method index that show every player in the table: public function index() { $output = $this-Player-find('all'); $this-set(array( 'output' = $output, '_serialize' = array('output') )); $this-render('generic_response'); } and the generic_response is an XML view that look like this: ?php $xml = Xml::fromArray(array('response' = $output)); echo $xml-asXML(); The resulting XML is: response output Player id2/id first_nameCiro/first_name second_nameSpee/second_name /Player /output output Player id3/id first_nameUgo/first_name second_nameRidi/second_name /Player /output/response but I want something like: response players Player id2/id first_nameCiro/first_name second_nameSpee/second_name /Player Player id3/id first_nameUgo/first_name second_nameRidi/second_name /Player /players/response How can I do this? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Format my XML output in CakePHP
Change your set array to be players instead of output. On Jan 23, 2013 6:01 PM, Mariano C. mariano.calan...@gmail.com wrote: I have the players table with three field id, first_name, last_name. The PlayersController have method index that show every player in the table: public function index() { $output = $this-Player-find('all'); $this-set(array( 'output' = $output, '_serialize' = array('output') )); $this-render('generic_response'); } and the generic_response is an XML view that look like this: ?php $xml = Xml::fromArray(array('response' = $output)); echo $xml-asXML(); The resulting XML is: response output Player id2/id first_nameCiro/first_name second_nameSpee/second_name /Player /output output Player id3/id first_nameUgo/first_name second_nameRidi/second_name /Player /output/response but I want something like: response players Player id2/id first_nameCiro/first_name second_nameSpee/second_name /Player Player id3/id first_nameUgo/first_name second_nameRidi/second_name /Player /players/response How can I do this? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Adding multple records through REST XML web services
You have to parse the XML to Cake's pattern and then you can use saveMany, for example. http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-savemany-array-data-null-array-options-array Att, -- Luiz Antonio S Messias Desenvolvedor Web http://twitter.com/tonyzrp @tonyzrp http://twitter.com/tonyzrp *LinkedIn* http://www.linkedin.com/in/luizantoniosmessias On 28 November 2012 04:18, Sam lightai...@gmail.com wrote: Dear CakePHP experts, I have an add() record function that is used as a REST web service via XML. The code is very simple. Something like below; $this-Object-create(); $this-Object-save($this-request-data); The limitation is that this function can only add one record at a time. What I want is to add multiple records at one time. The XML file can contain multiple records. So, I would like the function to be able to add multiple records via REST XML. May I know if CakePHP can be made to do this? I tried googling for a solution but could not find any. Can the experts here advise or provide some hints on how to start? Thank you very much -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: XML doctype
Unfortunately, this ability was left out of Cake's XML class, which is just a wrapper for returning either a SimpleXML or DOMDocument object. The latter's doctype property is read-only. In order to have a doctype one needs to jump through some hoops: http://pointbeing.net/weblog/2009/03/adding-a-doctype-declaration-to-a-domdocument-in-php.html With SimpleXML, you can include the doctype in the string that you feed to the constructor. See here (not the accepted answer but those below): http://stackoverflow.com/questions/1397036/how-to-convert-array-to-simplexml On Wed, Nov 28, 2012 at 1:44 AM, technobulka technobu...@gmail.com wrote: How to add doctype after ?xml version=1.0 encoding=UTF-8?? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
XML doctype
How to add doctype after *?xml version=1.0 encoding=UTF-8?*? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: XML doctype
echo $this-Xml-header(); // generates: ?xml version=1.0 encoding=UTF-8 ? You can pass in a different version number and encoding type as parameters of the header method. echo $this-Xml-header(array('version'='1.1')); // generates: ?xml version=1.1 encoding=UTF-8 ? -- Thanks Regards Chetan Patel -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Adding multple records through REST XML web services
Dear CakePHP experts, I have an add() record function that is used as a REST web service via XML. The code is very simple. Something like below; $this-Object-create(); $this-Object-save($this-request-data); The limitation is that this function can only add one record at a time. What I want is to add multiple records at one time. The XML file can contain multiple records. So, I would like the function to be able to add multiple records via REST XML. May I know if CakePHP can be made to do this? I tried googling for a solution but could not find any. Can the experts here advise or provide some hints on how to start? Thank you very much -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
xml tag with one attribute and one value
Hello ... and thank you so very much for assisting! The core libraries utilities xml documentation seems to imply that I can return the value of a tag's text by using '@' as the key. See following, straight from the documentation: === ?php $xmlArray = array( 'project' = array( '@id' = 1, 'name' = 'Name of project, as tag', '@' = 'Value of project' ) ); $xmlObject = Xml::fromArray($xmlArray); $xmlString = $xmlObject-asXML(); The content of $xmlString will be: ?php ?xml version=1.0? project id=1Value of projectnameName of project, as tag/name/project === This is definitely what I would like to do, but whenever I use '@' as a key, I get a major page full of errors. I would like to return something like: project id=1Value of project/project (with no child tags) In fact, and this is probably a different issue, I would really like to return: projects project id=1Value of project/project project id=2Value of project/project project id=3Value of project/project project id=4Value of project/project /projects Again, thank you!!! Kevin -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: xml format problem
Still cant figure it out so I hard coded the xml. I see in cake 2.xx that there are some methods for this. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
xml format problem
Hello i am using 1.3 I am trying to get this format from my array. array( 'Response' = array( 'Sms' = 'Thank you!', ) ) response SmsThank you!/Sms /response but after trying (see below) I can't get that output. Is there a way to do this? ?php echo $this-Xml-header(); echo $this-Xml-serialize($response); ? ?xml version=1.0 encoding=UTF-8 ? response Sms=Thank you! / and ?php echo $this-Xml-header(); echo $xml-serialize($response, array('format' = 'tags')); ? ?xml version=1.0 encoding=UTF-8 ? - response - Sms - ![CDATA[ Thank you! ]] /Sms /response Thanks Robert -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: xml format problem
What's the problem exactly? Is it the CDATA block? The ?xml tag? On Sun, Oct 14, 2012 at 3:08 PM, Robert Gravel rockb...@gmail.com wrote: Hello i am using 1.3 I am trying to get this format from my array. array( 'Response' = array( 'Sms' = 'Thank you!', ) ) response SmsThank you!/Sms /response but after trying (see below) I can't get that output. Is there a way to do this? ?php echo $this-Xml-header(); echo $this-Xml-serialize($response); ? ?xml version=1.0 encoding=UTF-8 ? response Sms=Thank you! / and ?php echo $this-Xml-header(); echo $xml-serialize($response, array('format' = 'tags')); ? ?xml version=1.0 encoding=UTF-8 ? - response - Sms - ![CDATA[ Thank you! ]] /Sms /response Thanks Robert -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: xml format problem
I do not need the extra CDATA markup . I only need the Response and Sms open and close tags along with my text -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Tutorial to receive data from xml web services?
Hi, I wouldlike to learn and understand how to receive data from a xml webservice. But I googled for hours and couldn't find any good explanation. Most of the links I found were talking about how to send data out as XML. But I am looking for getting the data to print them into my view. Does anyone know a good example to study it? Which is really simple for beginners? Thanks!! -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: How can controller action function distinguish whether URL ends with .xml or not?
From what i remember this should do the trick, in your controller action if ( $this-RequestHandler-isXML()) { // do some xml specific code } Check out the documentation on Request Handling for more details. http://book.cakephp.org/2.0/en/core-libraries/components/request-handling.html On Friday, September 14, 2012 6:31:38 AM UTC+3, Lightee wrote: Dear Cakephp gurus, I am creating some web services using cakephp with XML. When user visit a URL, cakephp is smart enough to detect the URL extension and direct to the correct view folder. For example, if URL ends with .xml, view is directed to the xml folder. My problem comes with the controller. If there any way for controller to know whether URL ends with .xml? Currently, I have to create new actions for add, edit, delete and view just to handle .xml URLs. THank you. -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: How can controller action function distinguish whether URL ends with .xml or not?
Thank you very much. It works! On Friday, September 14, 2012 3:40:56 PM UTC+8, johnny wrote: From what i remember this should do the trick, in your controller action if ( $this-RequestHandler-isXML()) { // do some xml specific code } Check out the documentation on Request Handling for more details. http://book.cakephp.org/2.0/en/core-libraries/components/request-handling.html On Friday, September 14, 2012 6:31:38 AM UTC+3, Lightee wrote: Dear Cakephp gurus, I am creating some web services using cakephp with XML. When user visit a URL, cakephp is smart enough to detect the URL extension and direct to the correct view folder. For example, if URL ends with .xml, view is directed to the xml folder. My problem comes with the controller. If there any way for controller to know whether URL ends with .xml? Currently, I have to create new actions for add, edit, delete and view just to handle .xml URLs. THank you. -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: How can controller action function distinguish whether URL ends with .xml or not?
I recommend taking a look at parse extensions This will take care of exactly what you want it to do without any extra controller logic http://book.cakephp.org/2.0/en/development/rest.html On Thursday, September 13, 2012 8:31:38 PM UTC-7, Lightee wrote: Dear Cakephp gurus, I am creating some web services using cakephp with XML. When user visit a URL, cakephp is smart enough to detect the URL extension and direct to the correct view folder. For example, if URL ends with .xml, view is directed to the xml folder. My problem comes with the controller. If there any way for controller to know whether URL ends with .xml? Currently, I have to create new actions for add, edit, delete and view just to handle .xml URLs. THank you. -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: How can controller action function distinguish whether URL ends with .xml or not?
*hey* please tell me how to make login page for admin in cake php i am a newbie so dont know much... I have made a table as user name with email pass and id fields. I have made user.php page and user_controller.php page and view/user/login.ctp file *model/user.php page* ?php class User extends AppModel { var $name = 'User'; var $useTable = 'users'; var $validate = array( 'email' = array( 'kosher' = array( 'rule' = 'email', 'message' = 'Please make sure your email is entered correctly.' ), 'unique' = array( 'rule' = 'isUnique', 'message' = 'An account with that email already exists.' ), 'required' = array( 'rule' = 'notEmpty', 'message' = 'Please Enter your email.' ) ), 'passwd' = array( 'min' = array( 'rule' = array('minLength', 6), 'message' = 'Usernames must be at least 6 characters.' ), 'required' = array( 'rule' = 'notEmpty', 'message'='Please enter a password.' ), ), 'passwd_confirm' = array( 'required'='notEmpty', 'match'=array( 'rule' = 'validatePasswdConfirm', 'message' = 'Passwords do not match' ) ), 'firstname' = array( 'required' = array( 'rule' = 'notEmpty', 'message'='Please enter your first name.' ), 'max' = array( 'rule' = array('maxLength', 30), 'message' = 'First name must be fewer than 30 characters' ) ), 'lastname' = array( 'required' = array( 'rule' = 'notEmpty', 'message' = 'Please enter your last name.' ), 'max' = array( 'rule' = array('maxLength', 30), 'message' = 'Last name must be fewer than 30 characters' ) ) ); function validatePasswdConfirm($data) { if ($this-data['User']['passwd'] !== $data['passwd_confirm']) { return false; } return true; } function beforeSave() { if (isset($this-data['User']['passwd'])) { $this-data['User']['password'] = Security::hash($this-data['User']['passwd'], null, true); unset($this-data['User']['passwd']); } if (isset($this-data['User']['passwd_confirm'])) { unset($this-data['User']['passwd_confirm']); } return true; } } ? *controller/user_controller.php page * ?php var $components = array('Auth'); function beforeFilter() { $this-Auth-userModel = 'User'; $this-Auth-fields = array('username' = 'email', 'password' = 'password'); $this-Auth-loginAction = array('admin' = false, 'controller' = 'users', 'action' = 'login'); $this-Auth-loginRedirect = array('controller' = 'users', 'action' = 'index'); } function login() {} function logout() { $this-redirect($this-Auth-logout()); } function beforeFilter() { //function that enables people to register without logging in $this-Auth-allow('add'); parent::beforeFilter(); } ? * view/users/login.ctp* ?php if ($session-check('Message.auth')) $session-flash('auth'); // If authentication message it exist it will be displayed echo $form-create('User', array('action' = 'login')); // creating user form with 2 fields email and password echo $form-input('email'); echo $form-input('password'); echo $form-end('Login'); ? *please do check out the naming conventions also and do tell me how to use them properly* -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: How can controller action function distinguish whether URL ends with .xml or not?
Hello, It may help you. Check http://arafats.info/cakephp-auth-setup/ Thanks Arafat On Sat, Sep 15, 2012 at 4:26 AM, Sumit Srivastava sumitsrivastava.aniwebdesi...@gmail.com wrote: *hey* please tell me how to make login page for admin in cake php i am a newbie so dont know much... I have made a table as user name with email pass and id fields. I have made user.php page and user_controller.php page and view/user/login.ctp file *model/user.php page* ?php class User extends AppModel { var $name = 'User'; var $useTable = 'users'; var $validate = array( 'email' = array( 'kosher' = array( 'rule' = 'email', 'message' = 'Please make sure your email is entered correctly.' ), 'unique' = array( 'rule' = 'isUnique', 'message' = 'An account with that email already exists.' ), 'required' = array( 'rule' = 'notEmpty', 'message' = 'Please Enter your email.' ) ), 'passwd' = array( 'min' = array( 'rule' = array('minLength', 6), 'message' = 'Usernames must be at least 6 characters.' ), 'required' = array( 'rule' = 'notEmpty', 'message'='Please enter a password.' ), ), 'passwd_confirm' = array( 'required'='notEmpty', 'match'=array( 'rule' = 'validatePasswdConfirm', 'message' = 'Passwords do not match' ) ), 'firstname' = array( 'required' = array( 'rule' = 'notEmpty', 'message'='Please enter your first name.' ), 'max' = array( 'rule' = array('maxLength', 30), 'message' = 'First name must be fewer than 30 characters' ) ), 'lastname' = array( 'required' = array( 'rule' = 'notEmpty', 'message' = 'Please enter your last name.' ), 'max' = array( 'rule' = array('maxLength', 30), 'message' = 'Last name must be fewer than 30 characters' ) ) ); function validatePasswdConfirm($data) { if ($this-data['User']['passwd'] !== $data['passwd_confirm']) { return false; } return true; } function beforeSave() { if (isset($this-data['User']['passwd'])) { $this-data['User']['password'] = Security::hash($this-data['User']['passwd'], null, true); unset($this-data['User']['passwd']); } if (isset($this-data['User']['passwd_confirm'])) { unset($this-data['User']['passwd_confirm']); } return true; } } ? *controller/user_controller.php page * ?php var $components = array('Auth'); function beforeFilter() { $this-Auth-userModel = 'User'; $this-Auth-fields = array('username' = 'email', 'password' = 'password'); $this-Auth-loginAction = array('admin' = false, 'controller' = 'users', 'action' = 'login'); $this-Auth-loginRedirect = array('controller' = 'users', 'action' = 'index'); } function login() {} function logout() { $this-redirect($this-Auth-logout()); } function beforeFilter() { //function that enables people to register without logging in $this-Auth-allow('add'); parent::beforeFilter(); } ? * view/users/login.ctp* ?php if ($session-check('Message.auth')) $session-flash('auth'); // If authentication message it exist it will be displayed echo $form-create('User', array('action' = 'login')); // creating user form with 2 fields email and password echo $form-input('email'); echo $form-input('password'); echo $form-end('Login'); ? *please do check out the naming conventions also and do tell me how to use them properly* -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US. -- *Thanks Regards. - Yasir Arafat (Hasib)* *Deputy Project Manager, *Software Solutions Grameen Solutions Contact Information: ** ** Cell : +8801816 536 901, +880197 *333* 2 888 Web: http://arafats.info http://arafats.info -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
How can controller action function distinguish whether URL ends with .xml or not?
Dear Cakephp gurus, I am creating some web services using cakephp with XML. When user visit a URL, cakephp is smart enough to detect the URL extension and direct to the correct view folder. For example, if URL ends with .xml, view is directed to the xml folder. My problem comes with the controller. If there any way for controller to know whether URL ends with .xml? Currently, I have to create new actions for add, edit, delete and view just to handle .xml URLs. THank you. -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
XML-to_array() no longer works with html
Somewhere between 2.0.1 and 2.2.2 the Utility/Xml class lost the ability to consume and html string and output it as an array. Obviously this is an Xml class and I was asking it to work with HTML, but does anyone know if CakePHP has a class to do this still (turn html to array)? -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: XML export basics
It's a small point, but I'd suggest putting this in your model. It's generally best to put as much in the model as possible. I've been working on XML export destined for InDesign so if you have any questions feel free to contact me directly. I'm no expert -- it's my first crack at XML for ID -- but I did manage to more or less muddle my way through ID's quirks. On Tue, Sep 4, 2012 at 9:56 PM, kevin.ncbible ke...@ncbible.com wrote: Andras: Thank you! That was exactly what I needed, inserted at the top of the controller page. I do appreciate your help. On Tuesday, September 4, 2012 5:49:26 PM UTC-7, Andras Kende wrote: Try to add: App::uses('Xml', 'Utility'); Andras Kende http://www.kende.com -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US. -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
XML export basics
Hello ... and thank you for being willing to offer your time and expertise to help me! My ultimate goal is to take the data from one of my models and export it as an xml file (that I can then import into Adobe InDesign). I've read the article XML under Core Libraries, but cannot seem to get started. Every time I try to use one of the examples, I get the error: Error: Class 'Xml' not found. I assume there is something very basic I'm not seeing. I was just placing code into my index function, e.g.: public function index($id = null) { // JUST TRYING TO TEST BASIC XML FUNCTIONALITY $xmlArray = array('root' = array('child' = 'value')); $xmlObject = Xml::fromArray($xmlArray, array('format' = 'tags')); // You can use Xml::build() too $xmlString = $xmlObject-asXML(); die(debug($xmlString)); } Can you tell me what I'm doing wrong, missing? ... perhaps a reminder of the basic xml setup (do I need a helper setup?) and a small sample code that will produce some basic xml output so I know I'm on the right track. I will really appreciate your help -- thank you! Kevin -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: XML export basics
Try to add: App::uses('Xml', 'Utility'); Andras Kende http://www.kende.com On Sep 4, 2012, at 4:11 PM, kevin.ncbible ke...@ncbible.com wrote: Hello ... and thank you for being willing to offer your time and expertise to help me! My ultimate goal is to take the data from one of my models and export it as an xml file (that I can then import into Adobe InDesign). I've read the article XML under Core Libraries, but cannot seem to get started. Every time I try to use one of the examples, I get the error: Error: Class 'Xml' not found. I assume there is something very basic I'm not seeing. I was just placing code into my index function, e.g.: public function index($id = null) { // JUST TRYING TO TEST BASIC XML FUNCTIONALITY $xmlArray = array('root' = array('child' = 'value')); $xmlObject = Xml::fromArray($xmlArray, array('format' = 'tags')); // You can use Xml::build() too $xmlString = $xmlObject-asXML(); die(debug($xmlString)); } Can you tell me what I'm doing wrong, missing? ... perhaps a reminder of the basic xml setup (do I need a helper setup?) and a small sample code that will produce some basic xml output so I know I'm on the right track. I will really appreciate your help -- thank you! Kevin -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US. -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: XML export basics
Andras: Thank you! That was exactly what I needed, inserted at the top of the controller page. I do appreciate your help. On Tuesday, September 4, 2012 5:49:26 PM UTC-7, Andras Kende wrote: Try to add: App::uses('Xml', 'Utility'); Andras Kende http://www.kende.com -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: REST, Xml::fromArray() and find('all')
Thanks for your answer. Yes indeed it doesn't behave the way the manual says it should. For now I will use an alternative ;-) Le jeudi 23 août 2012 11:47:02 UTC+1, Alexandre Leprêtre a écrit : Hi everyone, I am trying to build a nice REST API for my website and I had never tried it through CakePHP. I started to follow the (short) instructions, however, the way it works looks totally different from what I can read in the Cookbook. I use CakePHP 2.2.1. Here's what I've done so far: *app/Controller/OrdersController.php* ?php class OrdersController extends AppController { public function fetch($accountId) { $this-loadModel('Account'); $this-Account-id = $accountId; $orders = $this-Order-find('all', array( 'conditions' = array('Order.account_id' = $accountId) )); $response = $orders; $this-set(compact('response')); } } *app/View/Orders/xml/fetch.ctp* ?php $xml = Xml::fromArray(array('orders' = $orders)); echo $xml-asXML(); I tried this with the first account and everything was fine *Ouput:* orders Order id502cc39f-5b74-4a25-9bb2-670458d0d2b2/id order_ref96277/order_ref account_id502cc39d-8640-465a-b0da-670458d0d2b2/account_id created2012-08-16 09:55:43/created modified2012-08-16 09:55:43/modified /Order /orders Everything is fine with an account that has one order. However, with an account that has several orders, this doesn't work anymore. *Expected output:* orders Order id502cc39f-66eb-59d2-2337-670458d0d2b2/id order_ref96255/order_ref account_id502cc39d-6325-ad25-5b64-670458d0d2b2/account_id created2012-08-16 09:42:33/created modified2012-08-16 09:42:33/modified /Order Order id502cc39f-ee21-3c89-8120-670458d0d2b2/id order_ref96231/order_ref account_id502cc39d-6325-ad25-5b64-670458d0d2b2/account_id created2012-08-16 09:21:01/created modified2012-08-16 09:21:01/modified /Order /orders * * *What I get:* This page contains the following errors: error on line 1 at column 367: Entity 'nbsp' not defined Below is a rendering of the page up to the first error.*Warning* (2)http://devapi.ssl247.net/orders/fetch/502cc1be-7e48-4913-89c2-65f058d0d2b2.xml: SimpleXMLElement::__construct() [simplexmlelement.--constructhttp://devapi.ssl247.net/orders/fetch/simplexmlelement.--construct]: Entity: line 3: parser error : Extra content at the end of the document [* CORE\Cake\Utility\Xml.php*, line *197*]Codehttp://devapi.ssl247.net/orders/fetch/502cc1be-7e48-4913-89c2-65f058d0d2b2.xml Contexthttp://devapi.ssl247.net/orders/fetch/502cc1be-7e48-4913-89c2-65f058d0d2b2.xml I assume that Xml::fromArray() doesn't accept multiple numeric keys. Or something like this. I don't mind editing my PHP array to get he XML I expect but I really don't know how I should write my array for this :-( Any help is welcome. Thank you!! Alex -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: REST, Xml::fromArray() and find('all')
I can confirm this issue. The Xml class does not play nice with the array structure generated by the model find method when multiple records are returned. Due to the time sensitive nature of my task, I opted to use JSON rather than debug a core utility class. That said, I would certainly love to hear the fix if anyone has it readily available. Ryan On Thursday, 23 August 2012 04:47:02 UTC-6, Alexandre Leprêtre wrote: Hi everyone, I am trying to build a nice REST API for my website and I had never tried it through CakePHP. I started to follow the (short) instructions, however, the way it works looks totally different from what I can read in the Cookbook. I use CakePHP 2.2.1. Here's what I've done so far: *app/Controller/OrdersController.php* ?php class OrdersController extends AppController { public function fetch($accountId) { $this-loadModel('Account'); $this-Account-id = $accountId; $orders = $this-Order-find('all', array( 'conditions' = array('Order.account_id' = $accountId) )); $response = $orders; $this-set(compact('response')); } } *app/View/Orders/xml/fetch.ctp* ?php $xml = Xml::fromArray(array('orders' = $orders)); echo $xml-asXML(); I tried this with the first account and everything was fine *Ouput:* orders Order id502cc39f-5b74-4a25-9bb2-670458d0d2b2/id order_ref96277/order_ref account_id502cc39d-8640-465a-b0da-670458d0d2b2/account_id created2012-08-16 09:55:43/created modified2012-08-16 09:55:43/modified /Order /orders Everything is fine with an account that has one order. However, with an account that has several orders, this doesn't work anymore. *Expected output:* orders Order id502cc39f-66eb-59d2-2337-670458d0d2b2/id order_ref96255/order_ref account_id502cc39d-6325-ad25-5b64-670458d0d2b2/account_id created2012-08-16 09:42:33/created modified2012-08-16 09:42:33/modified /Order Order id502cc39f-ee21-3c89-8120-670458d0d2b2/id order_ref96231/order_ref account_id502cc39d-6325-ad25-5b64-670458d0d2b2/account_id created2012-08-16 09:21:01/created modified2012-08-16 09:21:01/modified /Order /orders * * *What I get:* This page contains the following errors: error on line 1 at column 367: Entity 'nbsp' not defined Below is a rendering of the page up to the first error.*Warning* (2)http://devapi.ssl247.net/orders/fetch/502cc1be-7e48-4913-89c2-65f058d0d2b2.xml: SimpleXMLElement::__construct() [simplexmlelement.--constructhttp://devapi.ssl247.net/orders/fetch/simplexmlelement.--construct]: Entity: line 3: parser error : Extra content at the end of the document [* CORE\Cake\Utility\Xml.php*, line *197*]Codehttp://devapi.ssl247.net/orders/fetch/502cc1be-7e48-4913-89c2-65f058d0d2b2.xml Contexthttp://devapi.ssl247.net/orders/fetch/502cc1be-7e48-4913-89c2-65f058d0d2b2.xml I assume that Xml::fromArray() doesn't accept multiple numeric keys. Or something like this. I don't mind editing my PHP array to get he XML I expect but I really don't know how I should write my array for this :-( Any help is welcome. Thank you!! Alex -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
REST, Xml::fromArray() and find('all')
Hi everyone, I am trying to build a nice REST API for my website and I had never tried it through CakePHP. I started to follow the (short) instructions, however, the way it works looks totally different from what I can read in the Cookbook. I use CakePHP 2.2.1. Here's what I've done so far: *app/Controller/OrdersController.php* ?php class OrdersController extends AppController { public function fetch($accountId) { $this-loadModel('Account'); $this-Account-id = $accountId; $orders = $this-Order-find('all', array( 'conditions' = array('Order.account_id' = $accountId) )); $response = $orders; $this-set(compact('response')); } } *app/View/Orders/xml/fetch.ctp* ?php $xml = Xml::fromArray(array('orders' = $orders)); echo $xml-asXML(); I tried this with the first account and everything was fine *Ouput:* orders Order id502cc39f-5b74-4a25-9bb2-670458d0d2b2/id order_ref96277/order_ref account_id502cc39d-8640-465a-b0da-670458d0d2b2/account_id created2012-08-16 09:55:43/created modified2012-08-16 09:55:43/modified /Order /orders Everything is fine with an account that has one order. However, with an account that has several orders, this doesn't work anymore. *Expected output:* orders Order id502cc39f-66eb-59d2-2337-670458d0d2b2/id order_ref96255/order_ref account_id502cc39d-6325-ad25-5b64-670458d0d2b2/account_id created2012-08-16 09:42:33/created modified2012-08-16 09:42:33/modified /Order Order id502cc39f-ee21-3c89-8120-670458d0d2b2/id order_ref96231/order_ref account_id502cc39d-6325-ad25-5b64-670458d0d2b2/account_id created2012-08-16 09:21:01/created modified2012-08-16 09:21:01/modified /Order /orders * * *What I get:* This page contains the following errors: error on line 1 at column 367: Entity 'nbsp' not defined Below is a rendering of the page up to the first error.*Warning* (2)http://devapi.ssl247.net/orders/fetch/502cc1be-7e48-4913-89c2-65f058d0d2b2.xml: SimpleXMLElement::__construct() [simplexmlelement.--constructhttp://devapi.ssl247.net/orders/fetch/simplexmlelement.--construct]: Entity: line 3: parser error : Extra content at the end of the document [* CORE\Cake\Utility\Xml.php*, line *197*]Codehttp://devapi.ssl247.net/orders/fetch/502cc1be-7e48-4913-89c2-65f058d0d2b2.xml Contexthttp://devapi.ssl247.net/orders/fetch/502cc1be-7e48-4913-89c2-65f058d0d2b2.xml I assume that Xml::fromArray() doesn't accept multiple numeric keys. Or something like this. I don't mind editing my PHP array to get he XML I expect but I really don't know how I should write my array for this :-( Any help is welcome. Thank you!! Alex -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: XML does not work anymore (changed from one server to another)
I solved this by using a php.ini file with this content: allow_url_fopen = On -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Send XML as parameter on a POST request
Actually, it worked with $data = $this-request-input(); Thanks On Friday, June 22, 2012 7:44:22 PM UTC-6, Justin Edwards wrote: Or $data = $this-request-input('Xml::build', array('return' = 'domdocument')); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Send XML as parameter on a POST request
I already made the POST request but I dont know how to catch it and save it to the database. I intend to save an XML content to a TEXT column. Could you guide me please? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Send XML as parameter on a POST request
$this-request-data On Fri, Jun 22, 2012 at 5:24 PM, darkangel luisill...@gmail.com wrote: I already made the POST request but I dont know how to catch it and save it to the database. I intend to save an XML content to a TEXT column. Could you guide me please? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Send XML as parameter on a POST request
Or $data = $this-request-input('Xml::build', array('return' = 'domdocument')); On Fri, Jun 22, 2012 at 8:42 PM, Justin Edwards justinledwa...@gmail.comwrote: $this-request-data On Fri, Jun 22, 2012 at 5:24 PM, darkangel luisill...@gmail.com wrote: I already made the POST request but I dont know how to catch it and save it to the database. I intend to save an XML content to a TEXT column. Could you guide me please? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
How to post with xml file?
Hi, I want to post xml file to another site,I don't know that. I try to make a sample, But that's a post request. Anyone that can give me an example on how to make coding? :Sample $root = '?xml version=1.0 encoding=UTF-8 ?api-request id=A/api-request'; $xml = new SimpleXMLElement($root); $xml-addChild('id', $this-request-data['id']); $xml-addChild('name', $this-request-data['name']); App::uses('HttpSocket', 'Network/Http'); $HttpSocket = new HttpSocket(); $results = $HttpSocket-post('https://example.com/api/', array($xml- asXML())); Thanks 88 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
How to post with xml file?
Hi, I want to post xml file to another site,I don't know that. I try to make a sample, But that's a post request. Anyone that can give me an example on how to make coding? :Sample $root = '?xml version=1.0 encoding=UTF-8 ?api-request id=A/api-request'; $xml = new SimpleXMLElement($root); $xml-addChild('id', $this-request-data['id']); $xml-addChild('name', $this-request-data['name']); App::uses('HttpSocket', 'Network/Http'); $HttpSocket = new HttpSocket(); $results = $HttpSocket-post('https://example.com/api/', array($xml- asXML())); Thanks -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
XML does not work anymore (changed from one server to another)
Hi! I just have the problem, that I do extract from a xml feed and display it in a view. It works fine on server1 but not on server2. I get this error message: 2012-06-01 11:02:08 Warning: Warning (2): SimpleXMLElement::__construct(http://www.domain.com/?feed=rss2) [a href='http://php.net/simplexmlelement.--construct'simplexmlelement.--construct/a]: failed to open stream: no suitable wrapper could be found in [/homepages/xx/xx/htdocs/lib/Cake/Utility/Xml.php, line 104] and also I find in error log 2012-06-01 11:02:03 Error: [Exception] String could not be parsed as XML I am not sure what I should look for? I can open the same script on another server and there it works just fine! Why not on a another server? Is it a script problem? Or a server setting? Please advice! Thanks! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: XML Issues
The parser is complaining because there's a tag mismatch. It may be worth rendering to a variable and writing it to the log to see what Cake is outputting. Or setting $this-layout to false and then sending a Content-type: text/plain header first to keep the browser from attempting to parse the output. I don't understand why you would want to output XML for your add action, though. On Sun, May 20, 2012 at 11:26 AM, Cara cblack@gmail.com wrote: I am trying to write what should be a simple API using CakePHP's REST with XML. The code I have is very basic, still not working. I realize it is very likely a simple thing like file extension or path to file, but I am very new to REST and limited when using XML. any help would be greatly appreciated. Here is my error XML Parsing Error: mismatched tag. Expected: /div. Location: http://member.ozonefit.com/users/add.xml Line Number 62, Column 4: /body --^ Here are the files Routes Router::mapResources('users'); Router::parseExtensions('xml'); Users Controller var $components = array('RequestHandler'); function add(){ $this-layout = 'default'; if( $this-RequestHandler-isXML() ) { configure::write('debug',0); $users['firstname'] = 'firstname'; $users['lastname'] = 'lastname'; $this-set(compact('users')); } } layouts-xml-default.xml ?php echo $this-Xml-header(array('version'='1.1')); layouts-users-xml add.xml ?php echo $this-Xml-serialize($users); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
uploading XML file into database
hello guyz.. is there any way to upload xml file to database. how can we upload xml files's data into database. plz give me example. thankx in advance. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: uploading XML file into database
Il 23/05/2012 15:52, Teji ha scritto: hello guyz.. is there any way to upload xml file to database. how can we upload xml files's data into database. plz give me example. thankx in advance. You could save it as a text or a binary -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
XML Issues
I am trying to write what should be a simple API using CakePHP's REST with XML. The code I have is very basic, still not working. I realize it is very likely a simple thing like file extension or path to file, but I am very new to REST and limited when using XML. any help would be greatly appreciated. Here is my error XML Parsing Error: mismatched tag. Expected: /div. Location: http://member.ozonefit.com/users/add.xml Line Number 62, Column 4: /body --^ Here are the files Routes Router::mapResources('users'); Router::parseExtensions('xml'); Users Controller var $components = array('RequestHandler'); function add(){ $this-layout = 'default'; if( $this-RequestHandler-isXML() ) { configure::write('debug',0); $users['firstname'] = 'firstname'; $users['lastname'] = 'lastname'; $this-set(compact('users')); } } layouts-xml-default.xml ?php echo $this-Xml-header(array('version'='1.1')); layouts-users-xml add.xml ?php echo $this-Xml-serialize($users); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: XML DataSource or solution
Hello Carlos, I have a similar requirement, and was not able to find an XML data source anywhere. The closest I have seen to one is this one, which is half finished (and also dual data source which is not what I need): http://ask.cakephp.org/questions/view/crud_interaction_with_an_xml_data_source It seems that your own attempt is half finished as well. Does anyone know of a fully functional XML or Text Data Source for Cake PHP 2.x? Thanks, Pete On Thursday, February 10, 2011 2:00:28 PM UTC-6, Carlos Paparoni wrote: Hi everyone, I'm new to CakePHP and started using it in hopes of developing a project assigned to me in a course at my university as quickly as possible. The project requires that I avoid the use of databases completely, relying on XML files (or rather, file) to load, display, add, remove, search and save data. However, Cake relies mostly on databases, and while I managed to actually avoid the use of any, and read the XML file, I don't know where to go from there. I completed the blog tutorial and adapted it for the project (mainly the index view), but that is what I have so far. I was searching online for a solution, but didn't find any (except for code snippets here and there about writing a XML DS from scratch). I thought about using the Array DataSource (since I can convert the XML file into an array) but don't really know how exactly to implement that. Any ideas or suggestions? I would really appreciate some help. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
XML or Text based Data Source?
Hello All, I have a small application I wish to write that requires storing data to either XML files or Plain Text files. I am therefore searching for either an XML or a Text Data Source for CakePHP 2.1, and was surprised that I am not able to find such Data Sources. Can anyone shed some light on this matter? Thanks, Pete -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Problem with loading xml data
Can I push this up? I still need your help, guys! Am Montag, 26. März 2012 09:34:44 UTC+2 schrieb heohni: Hi, within a helper class I would like to call this xml App::uses('Xml', 'Utility'); App::uses('AppHelper', 'View/Helper'); class SuggestHelper extends AppHelper { function suggest($keyword){ $keyword = urlencode(trim($keyword)); $xml = Xml::build($this-feed_url.$keyword); $parsed_xml = Set::reverse($xml); But I am always getting this error as soon as I search for more than 2 words, or of the keywords contains any strange letters like german umlauts parser error : Input is not proper UTF-8, indicate encoding ! Cake is already uft-8. So what do I have to do? When I call 2 or more words, they are like this: 'word1+word2' = that should be ok, or not? IF I call the URL directly in the browser it returns me the correct XML without any error messages.. anyone any ideas for me? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Problem with loading xml data
Hi, within a helper class I would like to call this xml App::uses('Xml', 'Utility'); App::uses('AppHelper', 'View/Helper'); class SuggestHelper extends AppHelper { function suggest($keyword){ $keyword = urlencode(trim($keyword)); $xml = Xml::build($this-feed_url.$keyword); $parsed_xml = Set::reverse($xml); But I am always getting this error as soon as I search for more than 2 words, or of the keywords contains any strange letters like german umlauts parser error : Input is not proper UTF-8, indicate encoding ! Cake is already uft-8. So what do I have to do? When I call 2 or more words, they are like this: 'word1+word2' = that should be ok, or not? IF I call the URL directly in the browser it returns me the correct XML without any error messages.. anyone any ideas for me? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Send XML as parameter on a POST request
That's not a POST request, it's GET. For really long data, it's better to send it as an actual POST. On Wed, Feb 29, 2012 at 1:00 PM, darkangel luisill...@gmail.com wrote: Hi, I'm getting started with Cake and I'm developing a REST web service but have some troubles. I need to send a XML string to the Record action to save that string in the database. The way I'm doing is converting the XML string to hexadecimal in order to include it in my request but I got an HTML output with the following error: Bad Request Your browser sent a request that this server could not understand. Can anybody help me with this issue please? I'm stucked Thanks in advance. This is my action: class TransfersController extends AppController { public $components = array('RequestHandler'); public function record($rfc = null, $xml = null, $opnum = null) { if ($this-request-is('post')) { //Code to manipulate the received data } else { $message = 'The request is wrong'; } $this-set('message', $message); } } and this is the request I'm sending: http://localhost/myapp/transfers/record/RAA04745123QW5/3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D38223F3E0A3C736F6170656E763A456E76656C6F706520786D6C6E733A736F6170656E763D22687474703A2F2F736368656D61732E786D6C736F61702E6F72672F736F61702F656E76656C6F70652F2220786D6C6E733A6F786D6C3D22687474703A2F2F772E76656E74616E696C6C61756E6963612E676F622E6D782F636F76652F77732F6F786D6C2F223E3C736F6170656E763A4865616465723E3C777373653A536563757269747920786D6C6E733A777373653D22687474703A2F2F646F63732E6F617369732D6F70656E2E6F72672F7773732F323030342F30312F6F617369732D3230303430312D7773732D777373656375726974792D7365636578742D312E302E7873642220736F6170656E763A6D757374556E6465727374616E643D2231223E3C777373653A557365726E616D65546F6B656E3E093C777373653A557365726E616D653E5241413034313031344A41323C2F777373653A557365726E616D653E3C777373653A50617373776F726420547970653D22687474703A2F2F646F63732E6F617369732D6F70656E2E6F72672F7773732F323030342F30312F6F617369732D3230303430312D7773732D757365726E616D652D746F6B656E2D70726F66696C652D312E302350617373776F726454657874223E614571526C587955784F5737754959487858314B477A6B594449394638504B614C55745A716F62484D745944414872416142364C554F46376D4F675854486A563C2F777373653A50617373776F72643E3C2F777373653A557365726E616D65546F6B656E3E3C2F777373653A53656375726974793E3C2F736F6170656E763A4865616465723E3C736F6170656E763A426F64793E3C6F786D6C3A736F6C69636974617252656369626972436F7665536572766963696F3E3C6F786D6C3A636F6D70726F62616E7465733E3C6F786D6C3A7469706F4964656E746966696361646F723E303C2F6F786D6C3A7469706F4964656E746966696361646F723E3C6F786D6C3A6964656E74696669636163696F6E3E35322D303734313736323C2F6F786D6C3A6964656E74696669636163696F6E3E3C6F786D6C3A666563686145787065646963696F6E3E323031312D30332D31383C2F6F786D6C3A666563686145787065646963696F6E3E3C6F786D6C3A636572746966696361646F4F726967656E3E303C2F6F786D6C3A636572746966696361646F4F726967656E3E3C6F786D6C3A726663436F6E73756C74613E5241413034313031344A41323C2F6F786D6C3A726663436F6E73756C74613E3C6F786D6C3A7375626469766973696F6E3E303C2F6F786D6C3A7375626469766973696F6E3E3C6F786D6C3A7469706F466967757261416475616E616C3E313C2F6F786D6C3A7469706F466967757261416475616E616C3E3C6F786D6C3A637572703E5A5A414D3537303130314D5A53444C5230353C2F6F786D6C3A637572703E3C6F786D6C3A636F7272656F456C656374726F6E69636F3E6C73657272616E6F40616475616E61736F66742E636F6D2E6D783C2F6F786D6C3A636F7272656F456C656374726F6E69636F3E3C6F786D6C3A6669726D61456C656374726F6E6963613E3C6F786D6C3A636572746966696361646F3E333038323034344038323034413030333032303130323032313433303330333033303331333033303330333033303330333133303334333033373336333633303044303630393241383634383836463730443031303130353035303033303832303133363331333833303336303630333535303430333043324634313245343332453230363436353643323035333635373237363639363336393646323036343635323034313634364436393645363937333734373236313633363943334233364532303534373236393632373537343631373236393631333132463330324430363033353530343041304332363533363537323736363936333639364632303634363532303431363436443639364536393733373437323631363336394333423336453230353437323639363237353734363137323639363133313146333031443036303932413836343838364637304430313039303131363130363136333646363437333430373336313734324536373646363232453644373833313236333032343036303335353034303930433144343137363245323034383639363436313643363736463230333733373243323034333646364332453230343737353635373237323635373236463331304533303043303630333535303431313043303533303336333033303331304233303039303630333535303430363133303234443538333131393330313730363033353530343038304331303434363937333734373236393734364632303436363536343635373236313641313031313036303335353034303730433041343337353631373536383734363536443646363133303331303630393241383634383836463730443031303930323043323435323635373337303646364537333631363236433635334132303436363537323645363136453634364
Cake v2 how to parse a xml file?
Hi, I came from this article: http://bakery.cakephp.org/articles/fahad19/2008/08/26/parsing-xml-files-with-cakephp But under v2 everything is so new to me. And I never workd with cake and xml before, so I am a bloddy beginner in this: App::import('Xml'); should be now App::uses('Xml', 'Lib'); right? But how do I replace this: $parsed_xml = new Xml($file); Is there anyone out there who could help me with this new v2 version and parsing a xml file? THANKS! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Cake v2 how to parse a xml file?
its actually App::uses('Xml', 'Utility'); (which can be found out looking into the core files) its also mentioned here: http://book.cakephp.org/2.0/en/appendices/2-0-migration-guide.html and did you try to read the book? http://book.cakephp.org/2.0/en/core-utility-libraries/xml.html?highlight=xml#Xml there are also pretty good examples there On 13 Dez., 11:04, heohni heidi.anselstet...@consultingteam.de wrote: Hi, I came from this article:http://bakery.cakephp.org/articles/fahad19/2008/08/26/parsing-xml-fil... But under v2 everything is so new to me. And I never workd with cake and xml before, so I am a bloddy beginner in this: App::import('Xml'); should be now App::uses('Xml', 'Lib'); right? But how do I replace this: $parsed_xml = new Xml($file); Is there anyone out there who could help me with this new v2 version and parsing a xml file? THANKS! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
XML-serialize() with CDATA?
Hello, I've been exporting Cake data arrays as XML using the XML helper's serialize(), and then using that to import into other Cake apps, and it makes a nice way to exchange data between our set of app servers. Now, however, I'm dealing with data that would be best wrapped in CDATA tags, and while I can see that there's support in the XML class, I can't for the life of me figure out how to make it do that. Can someone provide some guidance? thanks! -eric -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
xml parsing error
I am getting the following error {DTOCollection:[],ErrorCollection:[{ErrorCode: 80,FriendlyErrorMessage:Requested XML format is not correct!}],IsResultTrue:false,IsSuccess:false}in the following portion of code $dom = new DOMDocument(); $dom=load($url); $root = $dom-documentElement; //$nodesToDelete = array(); $root = $root-getElementsByTagName('item'); basically url is not loading..can any 1 suggest what to do...plz help.. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
amchart + CakePHP Xml Serialize
Hi, I'm using amchart to make graphics, I need to generate an XML like this: chart graphs graph gid=1 value xid=100 color=#318DBD-0.307/value value xid=101 color=#318DBD-0.168/value value xid=102 color=#318DBD-0.073/value value xid=103 color=#318DBD-0.027/value value xid=104 color=#318DBD-0.251/value But: $parsed = array( 'chart'=array( 'graphs'=array( array( 'graph'=array( 'gid'=1, 'value'=array( array( 'xid'='100', array(5) ) ) ) ) ) ) ); is generating: chart graphs graph gid=1 value xid=100 value5/value /value/graph /graphs /chart I don't want that duplicated 'value' tag. Can anyone help me? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
how to convert data from controller to xml format in view
hello I'm new of cake I need snippet to display data form controller in xml format I know is use xml helper but I don't understand example in book some body can example to teach me pls -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: how to convert data from controller to xml format in view
this is answer http://www.ninjacodermonkey.co.uk/2010/11/cakephp-array-to-xml-from-within-controller/ On Jul 26, 6:56 am, taqman filler taqman...@gmail.com wrote: hello I'm new of cake I need snippet to display data form controller in xml format I know is use xml helper but I don't understand example in book some body can example to teach me pls -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: how to convert data from controller to xml format in view
Good find! On Mon, Jul 25, 2011 at 8:17 PM, taq taqman...@gmail.com wrote: this is answer http://www.ninjacodermonkey.co.uk/2010/11/cakephp-array-to-xml-from-within-controller/ On Jul 26, 6:56 am, taqman filler taqman...@gmail.com wrote: hello I'm new of cake I need snippet to display data form controller in xml format I know is use xml helper but I don't understand example in book some body can example to teach me pls -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Xml to array problem
Hi I've prablem with Set::reverse. I load this xml and function return array with 3 nodes of 4. I don't know what is going on. This is pressing matter I need help. Sorry for my english ?xml version=1.0 encoding=UTF-8? Presentation xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; width=624 height=800 courseid=9 xsi:noNamespaceSchemaLocation=http://localhost/files/xml/ schemat.xsd page background-color= number=1 background- image=bg_1308687631.JPG head font-size=13 width=0 text-align=center height=0 font- family=Arial id=1 font-color=black position=leftvaluePoszukiwanie zastosowania/value animate enable=0 kind=slideDown speed=5000 delay=0/ /head image id=3 width=0 height=0 path=present_1308693116.png position=right animate enable=1 kind=FadeIn speed=5000 delay=0/ /image /page page background-color= number=2 background- image=bg_1308687631.JPG/ page background-color= number=3 background- image=bg_1308687631.JPG/ page background-color= number=4 background- image=bg_1308687631.JPG head font-size=13 width=0 text-align=center height=0 font- family=Arial id=1 font-color=black position=leftvaluePoszukiwanie zastosowania/value animate enable=0 kind=slideDown speed=5000 delay=0/ /head image id=3 width=0 height=0 path=present_1308693372.png position=right animate enable=1 kind=slideDown speed=5000 delay=0/ /image /page /Presentation -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
XML at both client and server side
Hello All! I am designing an open source web application that has to access and update a mysql database. It is a data intensive form based application. During entry phase it will bring exisitng set of records or defaults on the page and will save the same form data after user updates/enters data into it. Many reports are part of the same application which brings in set of records(typically few records to few hundreds) for the criteria entered by user. I am wondering how does XML come into picture. Is it worth spending efforts in creating schemas and then XML files, to format data read through MysSQL queries and parse back to be displayed in browser? I see lot of information for syntax side of XML. If anyone can direct me to usage side of XML that will be great. Thanks in advance Bhawna -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Cake 1.2 problem with XML files in plugin vendors folder
There isn't any code. Its just a plain static xml file. When I put an image, css or js file into vendors folder I can access it with a url like /plugin_name/img/myimage.jpg. When I try to access files of other types I get the myfile.extController could not be found error. I get the impression that I either need to add some code to handle different content types, or serve the static xml file from a different location. Levi On Apr 28, 1:28 pm, cricket zijn.digi...@gmail.com wrote: On Thu, Apr 28, 2011 at 12:30 PM, lsenft lse...@gmail.com wrote: I would like to load an XML file from a plugin vendors folder. I get the following error: Error: myfile.xmlController could not be found. Is there a way to serve xml files from a plugin's vendors folder? What's the code that leads to the error? Some days, it's like every other person posting to this list assumes everyone else can read minds. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Cake 1.2 problem with XML files in plugin vendors folder
On Fri, Apr 29, 2011 at 10:49 AM, lsenft lse...@gmail.com wrote: There isn't any code. Then I guess you're just imagining this error then. Well, I'm happy this has all been sorted out. Have a nice day. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Cake 1.2 problem with XML files in plugin vendors folder
Hi Levi, Ignore the trolls. They won't survive I'd you don't feed them. :) Unfortunately. in version 1.2 you can only serve plugin img, CSS, and JS files, and only from folders with those names. There's much more freedom in 1.3. Each plugin has its own webroot folder. - Jamie On Apr 29, 7:49 am, lsenft lse...@gmail.com wrote: There isn't any code. Its just a plain static xml file. When I put an image, css or js file into vendors folder I can access it with a url like /plugin_name/img/myimage.jpg. When I try to access files of other types I get the myfile.extController could not be found error. I get the impression that I either need to add some code to handle different content types, or serve the static xml file from a different location. Levi On Apr 28, 1:28 pm, cricket zijn.digi...@gmail.com wrote: On Thu, Apr 28, 2011 at 12:30 PM, lsenft lse...@gmail.com wrote: I would like to load an XML file from a plugin vendors folder. I get the following error: Error: myfile.xmlController could not be found. Is there a way to serve xml files from a plugin's vendors folder? What's the code that leads to the error? Some days, it's like every other person posting to this list assumes everyone else can read minds. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Cake 1.2 problem with XML files in plugin vendors folder
I would like to load an XML file from a plugin vendors folder. I get the following error: Error: myfile.xmlController could not be found. Is there a way to serve xml files from a plugin's vendors folder? Thank you, Levi -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
xml parser now what
Hi I am getting different xmls and after parsing I want them to be pushed to database. Is there an easy way to accomplish that. Is there a database to xml mapping tool available for cakephp. thanks -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: xml parser now what
On Thu, Apr 28, 2011 at 10:36 AM, Janu asimmee...@gmail.com wrote: Hi I am getting different xmls and after parsing I want them to be pushed to database. Is there an easy way to accomplish that. Is there a database to xml mapping tool available for cakephp. You can turn the XML into an array but you'll need to do some work to ensure the array structure matches your schema. See here: http://blog.crazytje.be/xml-to-array-and-array-to-xml-in-cakephp/ -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Cake 1.2 problem with XML files in plugin vendors folder
On Thu, Apr 28, 2011 at 12:30 PM, lsenft lse...@gmail.com wrote: I would like to load an XML file from a plugin vendors folder. I get the following error: Error: myfile.xmlController could not be found. Is there a way to serve xml files from a plugin's vendors folder? What's the code that leads to the error? Some days, it's like every other person posting to this list assumes everyone else can read minds. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
generating xml templet using cakephp
Hi All, How to generate a XML template dynamically and parse it. Thanks in advance, Rakesh yadav -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: generating xml templet using cakephp
http://book.cakephp.org/view/1485/Xml -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/4/14 rakeshyadav rakeshyadav rakeshyadav@gmail.com Hi All, How to generate a XML template dynamically and parse it. Thanks in advance, Rakesh yadav -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Problem with xml- cakephp
The example you posted as to what you would like it to look like isn't really xml at all, just a single xml tag with html inside. Really with XML you would write the data like how it is output already, then you would have something else be it a website or a piece of software which can parse that data and display it / use it as required. Also, you might want to check the spelling on your example, I would hope dognuts aren't a food item on the menu ;) On 14 March 2011 09:40, rakeshyadav rakeshyadav rakeshyadav@gmail.comwrote: HI All, i am trying to generate XML template on my report generated data. the stuff related to generate XML i keep in view page as below. ?php //example i am pushing data to $Data $Data = array('storetype' = $store['st']['store_type']); App::import('Helper', 'Xml'); App::import('Core', 'File'); $xml = new XmlHelper(); $file = $xml-header(); // We need the XML header before our data. $file .= $xml-serialize($Data, array('whitespace' = true)); // Write the file. $xmlFile =new File('/tmp' .'/filename.xml'); $xmlFile-write($file, 'w'); $xmlFile-close(); ? for this i am getting out put as below ?xml version=1.0 encoding=UTF-8 ? std_class subcategorys=Cake , biscuits, dognuts / std_class storetype=Checkers / std_class banchcode=262 / std_class branchname=CC LADYSMITH - OVAL / std_class bookedDates= / (But this is not the way i want result). i want to generate templet file example as below report-contents th tr text align=center Sub Category-1 /text td Store Type /td td Branch Code /td td Branch Name /td td Dates Booked /td td align=left Dates Available /td /tr /th tr td Checkers Hyper /td td 6983 /td td CH HY Centurion /td td /td td align=left 15-02-2011,14-03-2013, /td /tr tr td =bgclor=red' DELI /td /tr /report-contents can any one worked on this type of solution please suggest me the right way to archive. Thanks in Advance , Rakesh -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Kind Regards Stephen http://www.ninjacodermonkey.co.uk -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Problem with xml- cakephp
On Mar 19, 11:03 am, Stephen step...@ninjacodermonkey.co.uk wrote: The example you posted as to what you would like it to look like isn't really xml at all, just a single xml tag with html inside. Really with XML you would write the data like how it is output already, then you would have something else be it a website or a piece of software which can parse that data and display it / use it as required. Also, you might want to check the spelling on your example, I would hope dognuts aren't a food item on the menu ;) nothin wrong with dognuts, full of goodness, full of vitamins, full of maribone jelly... :) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Problem with xml- cakephp
HI All, i am trying to generate XML template on my report generated data. the stuff related to generate XML i keep in view page as below. ?php //example i am pushing data to $Data $Data = array('storetype' = $store['st']['store_type']); App::import('Helper', 'Xml'); App::import('Core', 'File'); $xml = new XmlHelper(); $file = $xml-header(); // We need the XML header before our data. $file .= $xml-serialize($Data, array('whitespace' = true)); // Write the file. $xmlFile =new File('/tmp' .'/filename.xml'); $xmlFile-write($file, 'w'); $xmlFile-close(); ? for this i am getting out put as below ?xml version=1.0 encoding=UTF-8 ? std_class subcategorys=Cake , biscuits, dognuts / std_class storetype=Checkers / std_class banchcode=262 / std_class branchname=CC LADYSMITH - OVAL / std_class bookedDates= / (But this is not the way i want result). i want to generate templet file example as below report-contents th tr text align=center Sub Category-1 /text td Store Type /td td Branch Code /td td Branch Name /td td Dates Booked /td td align=left Dates Available /td /tr /th tr td Checkers Hyper /td td 6983 /td td CH HY Centurion /td td /td td align=left 15-02-2011,14-03-2013, /td /tr tr td =bgclor=red' DELI /td /tr /report-contents can any one worked on this type of solution please suggest me the right way to archive. Thanks in Advance , Rakesh -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Array formatting from XML web service using Set::combine
I'm having a bit of trouble with Set::combine when using it to deal with xml converted into an array. I am using the XML utility library, then Set::reverse() to flip it from an object into an array for easy traversal The problem is that if a child element only contains 1 record, it is formatted as such: array( 'Result' = array( 'userID' = 5, 'name' = 'bill' ) ); but if the the same child element contains multiple records, it is formatted as such: array( 'Result' = array( 1 = array( 'userID' = 5, 'name' = 'bill' ), 2 = array( 'userID' = 25, 'name' = 'jane' ) ) ); how do I reliably reformat this array using Set::combine() to provide me with an array whos keys are userID and whos values are name? I've tried using Path1 as 'Result.{n}.userID' and Path2 as 'Result.{n}.name', however this will not work in the first instance as it is doesn't contain the {n} path -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Array formatting from XML web service using Set::combine
sorry, second array should be: array( 'Result' = array( 0 = array( 'userID' = 5, 'name' = 'bill' ), 1 = array( 'userID' = 25, 'name' = 'jane' ) ) ); On Sun, Feb 27, 2011 at 11:34 PM, Greg Skerman gsker...@gmail.com wrote: I'm having a bit of trouble with Set::combine when using it to deal with xml converted into an array. I am using the XML utility library, then Set::reverse() to flip it from an object into an array for easy traversal The problem is that if a child element only contains 1 record, it is formatted as such: array( 'Result' = array( 'userID' = 5, 'name' = 'bill' ) ); but if the the same child element contains multiple records, it is formatted as such: array( 'Result' = array( 1 = array( 'userID' = 5, 'name' = 'bill' ), 2 = array( 'userID' = 25, 'name' = 'jane' ) ) ); how do I reliably reformat this array using Set::combine() to provide me with an array whos keys are userID and whos values are name? I've tried using Path1 as 'Result.{n}.userID' and Path2 as 'Result.{n}.name', however this will not work in the first instance as it is doesn't contain the {n} path -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
XML Helper Documentation needed
Greetings all, I was wondering if someone could point me to a more detailed description of the XML Helper and how to produce a desired xml file from a php array. I've gone through the following documentation http://book.cakephp.org/view/1485/Xml http://book.cakephp.org/view/1473/XML http://book.cakephp.org/view/1238/REST Even found this external link, which I thought to be the most useful http://www.ninjacodermonkey.co.uk/2010/11/cakephp-array-to-xml-from-within-controller/ Essentially, what I'd like to know some more about is whether the xml helper allows you to do things like add tag ids. Also, if there were any more resources out there that others had come accross on how the php arrays should be structured etc. Let me know. Regards, Mmm -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: XML Helper Documentation needed
Here I have adjusted NCM's code as it did not use the File class and was outputting the generated xml to the file twice (one after the other) also I have amended to have a id which is Stephen22 $xmlData = array( 'person' = array( 'id' = 'Stephen22', 'name' = 'Stephen', 'age' = 22, 'hair' = array( 'length' = 'medium', 'colour' = 'dark brown' ) ) ); App::import('Helper', 'Xml'); App::import('Core', 'File'); $xml = new XmlHelper(); $file = $xml-header(); // We need the XML header before our data. $file .= $xml-serialize($xmlData, array('whitespace' = true)); // Write the file. $xmlFile = new File(TMP . '/filename.xml'); $xmlFile-write($file, 'w'); $xmlFile-close(); ?xml version=1.0 encoding=UTF-8 ? person id=Stephen22 name=Stephen age=22 hair length=medium colour=dark brown / /person Whereas $xmlData = array( 'person' = array( 'id' = 'Stephen22', 'name' = 'Stephen', 'age' = 22, 'hair' = array( 'length' = 'medium', 'colour' = 'dark brown' ), 'being' = array('I am a fish') ) ); outputs ?xml version=1.0 encoding=UTF-8 ? person id=Stephen22 name=Stephen age=22 hair length=medium colour=dark brown / being ![CDATA[I am a fish]] /being /person - S On 18 February 2011 15:19, Matthew McNaughton mamcnaugh...@gmail.comwrote: Greetings all, I was wondering if someone could point me to a more detailed description of the XML Helper and how to produce a desired xml file from a php array. I've gone through the following documentation http://book.cakephp.org/view/1485/Xml http://book.cakephp.org/view/1473/XML http://book.cakephp.org/view/1238/REST Even found this external link, which I thought to be the most useful http://www.ninjacodermonkey.co.uk/2010/11/cakephp-array-to-xml-from-within-controller/ Essentially, what I'd like to know some more about is whether the xml helper allows you to do things like add tag ids. Also, if there were any more resources out there that others had come accross on how the php arrays should be structured etc. Let me know. Regards, Mmm -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: XML Helper Documentation needed
Hi Sam On 18 February 2011 16:13, Sam Sherlock sam.sherl...@gmail.com wrote: Here I have adjusted NCM's code as it did not use the File class - S Thanks for the amendment, I will update my blog post accordingly and my file in the previous project. I agree the File class is better than using fopen, my fopen line in my code is actually a full path from root. -- Kind Regards Stephen @ NinjaCoderMonkey www.ninjacodermonkey.co.uk -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: XML DataSource or solution
On Feb 11, 2011, at 20:34, Carlos Paparoni wrote: To make an update on the situation: I made the code work with the Array DataSource up to a point. The problem right now is that it uses a $records array which is assigned statically in the Model, like this: ?php class State extends AppModel { var $name = 'State'; var $useDbConfig = 'local'; var $displayField = 'name'; //Here is where records are assigned to the array: var $records = array( array('id' = 1, 'name' = 'Alabama', 'abbr' = 'AL'), array('id' = 2, 'name' = 'Alaska', 'abbr' = 'AK'), array('id' = 3, 'name' = 'Arizona', 'abbr' = 'AZ') ); } ? The issue is that if I try to use a function inside the model (for example, one I found to read a XML file and turn it into an array), I get parsing errors from PHP. So, I'm stuck. Where should I add that functionality? Should I edit the datasource and have it read the XML from there? Correct, if you want to call PHP functions, you cannot do so in the declaration of your class; you must do so for example in the constructor: ?php class State extends AppModel { var $name = 'State'; var $useDbConfig = 'local'; var $displayField = 'name'; function __construct() { parent::__construct(); // here you could populate $this-records using a function instead $this-records = array( array('id' = 1, 'name' = 'Alabama', 'abbr' = 'AL'), array('id' = 2, 'name' = 'Alaska', 'abbr' = 'AK'), array('id' = 3, 'name' = 'Arizona', 'abbr' = 'AZ') ); } } -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: XML DataSource or solution
Thank you for the quick reply, I appreciate it. I've tried what you suggested, and it is working, up to a point. Here is the code I'm using: DataSource - app/plugins/array_datasource/models/datasources/ array_source.php (I've only included the relevant modifications instead of the entire file, unless needed) function __construct($config = array()) { parent::__construct($config); //Modification to read the XML file and populate the $records array: App::import('Core', 'Xml'); App::import('Core', 'File'); $this-FileUtil = new File(WWW_ROOT.'files/'.'data.xml'); $this-File = $this-FileUtil-read(); $xml = new Xml($this-File); $this-records = $xml-toArray(); } Controller - app/controllers/registros_controller.php class RegistrosController extends AppController { var $helpers = array ('Html','Form'); var $name = 'Registros'; function index() { $this-set('registros', $this-Registro-find('all')); //My guess is that find isn't working correctly } } Model - app/models/registro.php class Registro extends AppModel { var $name = 'Registro'; var $useTables = false; var $useDbConfig= 'local'; var $displayField = 'espanol_comun'; //Note that I've copied the same code from the datasource here. It apparently makes no difference, since I've commented them alternatively. /* function __construct($config = array()) { parent::__construct($config); //Modification to read the XML file and populate the $records array: App::import('Core', 'Xml'); App::import('Core', 'File'); $this-FileUtil = new File(WWW_ROOT.'files/'.'data.xml'); $this-File = $this-FileUtil-read(); $xml = new Xml($this-File); $this-records = $xml-toArray(); debug($this-records); //This works. }*/ var $validate = array( 'espanol_comun' = array('rule' = 'notEmpty'), 'categoria' = array('rule' = 'notEmpty'), 'definicion'= array('rule' = 'notEmpty'), 'ambito'= array('rule' = 'notEmpty') ); } View - adapted from the Blog tutorial - app/views/registros/index.ctp //Relevant foreach loop: ?php foreach ($registros as $registro): ? tr td ?php echo $this-Html-link( $registro['Registro'] ['espanol_comun'], array('controller' = 'registros', 'action' = 'view', $registro['Registro'] ['espanol_comun'])); ? ... ?php endforeach; ? When I display the view, I get notice errors in each field, saying Notice (8): Undefined index: Registro [APP\views\registros\index.ctp, line 16] which corresponds to the foreach loop. Any ideas on what I'm doing wrong? If I debug $this-records from the __construct function, I get the array just fine. (I don't know if it's a better idea to use pastebin to link the entire code. I would be happy to do so if necessary.) On 12 feb, 13:51, Ryan Schmidt google-2...@ryandesign.com wrote: On Feb 11, 2011, at 20:34, Carlos Paparoni wrote: To make an update on the situation: I made the code work with the Array DataSource up to a point. The problem right now is that it uses a $records array which is assigned statically in the Model, like this: ?php class State extends AppModel { var $name = 'State'; var $useDbConfig = 'local'; var $displayField = 'name'; //Here is where records are assigned to the array: var $records = array( array('id' = 1, 'name' = 'Alabama', 'abbr' = 'AL'), array('id' = 2, 'name' = 'Alaska', 'abbr' = 'AK'), array('id' = 3, 'name' = 'Arizona', 'abbr' = 'AZ') ); } ? The issue is that if I try to use a function inside the model (for example, one I found to read a XML file and turn it into an array), I get parsing errors from PHP. So, I'm stuck. Where should I add that functionality? Should I edit the datasource and have it read the XML from there? Correct, if you want to call PHP functions, you cannot do so in the declaration of your class; you must do so for example in the constructor: ?php class State extends AppModel { var $name = 'State'; var $useDbConfig = 'local'; var $displayField = 'name'; function __construct() { parent::__construct(); // here you could populate $this-records using a function instead $this-records = array( array('id' = 1, 'name' = 'Alabama', 'abbr' = 'AL'), array('id' = 2, 'name' = 'Alaska', 'abbr' = 'AK'), array('id' = 3, 'name
XML DataSource or solution
Hi everyone, I'm new to CakePHP and started using it in hopes of developing a project assigned to me in a course at my university as quickly as possible. The project requires that I avoid the use of databases completely, relying on XML files (or rather, file) to load, display, add, remove, search and save data. However, Cake relies mostly on databases, and while I managed to actually avoid the use of any, and read the XML file, I don't know where to go from there. I completed the blog tutorial and adapted it for the project (mainly the index view), but that is what I have so far. I was searching online for a solution, but didn't find any (except for code snippets here and there about writing a XML DS from scratch). I thought about using the Array DataSource (since I can convert the XML file into an array) but don't really know how exactly to implement that. Any ideas or suggestions? I would really appreciate some help. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php