John Davidson

php - Generate Xml with Js in Codeigniter?

0 comments
Message:


I am having problem with creating xml with codeigniter any help please!
here is what im doing


$this->load->helper('xml');
$data['settings'] = $this->settings_model->getSettings();
$string = $this->load->view('sitemap', $data);
$string = '<p>Here is a paragraph & an entity (&#123;).</p>';
$string = xml_convert($string);
echo $string;


My Answer:
load->library('xml_writer');

$data = array(
'name' => 'John Doe',
'age' => 30,
'email' => '[email protected]'
);

$xml = $this->xml_writer->get_xml_from_array($data);

echo $xml;

This code snippet assumes that you have already loaded the XML Writer library in CodeIgniter. The get_xml_from_array method is used to convert the array data into XML format. Make sure to check if the XML Writer library is properly loaded and configured in your CodeIgniter application.

Rate this post

3 of 5 based on 2227 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us