Skip to main content

Posts

Showing posts from April, 2015

Simple example of datatables

Today's post is about use of datatables. Lot of examples are available on Internet. This example is just to explore it little more and explains how to read data from xml and display using datatables. <?php $file_url=' blog.xml '; $file_content = file_get_contents($file_url); $xml_string_arr=simplexml_load_string($file_content); //Optional: Start of code if you want to add some attribute to xml //code to add unique_id attribute /*foreach( $xml_string_arr->xpath("entry") as $r ) {     $attrs = $r->attributes();        if(!$attrs['unique_id'])         $r->addAttribute('unique_id', $r->id); } $xml_string_arr->asXML($file_url);*/ //End of code if you want to add some attribute to xml $json = json_encode($xml_string_arr); $arr_new = json_decode($json,TRUE); $required_content_arr = $arr_new['entry']; ?> <!DOCTYPE html> <html> <head>     <title>Task3</title>     <link rel="styleshe