title: How to feed data to model in CodeIgniter from different XMLs
body: <p>I have a CodeIgniter application with a Xml_model:</p>
  
  <pre><code>&lt;?php
  defined('BASEPATH') OR exit('No direct script access allowed');
  
  class Xml_model extends CI_Model {
  
          private $xml;
  
          public function __construct() {
            parent::__construct();
            $this-&gt;xml = simplexml_load_file(base_url('xml/example.xml'));
          }
  
          public function getAllTags() {
            return array_unique($this-&gt;xml-&gt;xpath('descendant::Keyword'));
          }
  
          public function getLinks($nodeName) {
            return $this-&gt;xml-&gt;xpath('/Documents/TabPage/Node[@name="'.$nodeName.'"]/Links/Link');
          }
  
          public function getTabs() {
            return $this-&gt;xml-&gt;xpath('/Documents/TabPage/@name');
          }
  
          public function getNodes($tabName) {
            return $this-&gt;xml-&gt;xpath('/Documents/TabPage[@name="'.$tabName.'"]/Node/@name');
          }
  
          public function getPath($nodeName) {
            return $this-&gt;xml-&gt;xpath('/Documents/TabPage/Node[@name="'.$nodeName.'"]/Path');
          }
  
          public function search($tagName) {
            return $this-&gt;xml-&gt;xpath('//*[Keyword="'.$tagName.'"]/parent::Node/@name');
          }
  
  }
  ?&gt;
  </code></pre>
  
  <p>I want to be able to load this model with different XMLs. These XMLs are selected by a dropdown menu on the site. The XMLs are defining the navigation on the site so after selecting the XML from the dropdown the page reloads and does so with the newly selected XML. But I don't know how I can do that because I can't load a model with a parameter in CodeIgniter.</p>
  
  <p>The dropdown: </p>
  
  <pre><code>  &lt;div class="xml"&gt;
      &lt;form method="post" id="xml-form"&gt;
        &lt;select name="xml-select"&gt;
          &lt;?php
            foreach(glob('xml/*.xml') as $filename) {
              echo '&lt;option value="'.$filename.'"&gt;'.explode(".",explode("/",$filename)[1])[0].'&lt;/option&gt;';
            }
          ?&gt;
        &lt;/select&gt;
        &lt;button type="submit"&gt;&lt;span class="glyphicon glyphicon-refresh"&gt;&lt;/span&gt;&lt;/button&gt;
      &lt;/form&gt;
    &lt;/div&gt;
  </code></pre>