Welcome Guest, Not a member yet? Register   Sign In
Using xml files for a web project.
#5

(03-07-2019, 03:53 PM)ciadmin Wrote: I have used XML to store "website" data for 20+ years. I don't make it directly accessible, but instead have a controller/servlet which retrieves it on the server, from a not-public-facing location, and then I typically render it as HTML in some fashion. I started this practice back when servers weren't as capable, and running a databse engine alongside your web server was considered excessive resource consumption. I switched much of my work to RDBs 10 years ago, but am now switching back to XML & markdown for content, as I find it easier to edit.

I do have some apps which store XML documents as columns in an RDB, but the extra care, encoding & validation led me away from that practice. I even had a couple of apps which stored XHTML in an RDB column, and then carefully dished those for in-browser editing with redactor - not the safest practice.

As for lighter or faster, however you measure those, I was working at one point with a 20,000 "record" XML document, with no noticeable lag dishing pages based on processing that.

So let's say we have an XML file with data like "Post image", "Post title", "Post description" etc.. etc.. 
I made a test a couple of days ago and the result was fine.
Here's the example controller:
Code:
public function xmlview(){
$data['title'] = 'XML File';
$file = base_url('assets/xml/test.xml');
$xml = simplexml_load_file($file);

foreach($xml->children() as $child) {
  $data['items'][] = array(
   'title' => $child->TITLE,
   'year' => (int)$child->YEAR
  );
}

$this->load->view('templates/header', $data);
$this->load->view('pages/xmlview', $data);
$this->load->view('templates/footer', $data);
}

Would you suggest something like that?

//Life motto
if (sad() == true) {
     sad().stop();
     develop();
}
Reply


Messages In This Thread
Using xml files for a web project. - by HarrysR - 03-07-2019, 03:15 PM
RE: Using xml files for a web project. - by HarrysR - 03-07-2019, 04:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB