title: CodeIgniter 3 - Reload View with Different CSS Theme
body: <p>I'm still trying to wrap my head around the relationship between controller functions and URL requests. </p>
  
  <p><strong>This is what I'm trying to accomplish:</strong></p>
  
  <p>I've got a single view containing a full HTML page (no templates). On this page I want users to be able to select a theme from a list of links. Each theme has a separate CSS file. I would like the selected link to pass a value to the controller which then reloads the same view with a different CSS file using the $data array.</p>
  
  <p>If the scenario I described above is possible, or if there is a smarter solution, then I'd greatly appreciate any help or suggestions.</p>
  
  <p><strong>Basic View/Controller Structure:</strong></p>
  
  <p><em>I've marked everything I don't understand with ?????????</em></p>
  
  <p>controllers/Demos.php</p>
  
  <p>
  
  <pre><code>public function ?????????
  {
      $data['theme'] = array(
          'Normal' =&gt; "normal.css",
          'Dark' =&gt; "dark.css",
          'Light' =&gt; "light.css",
          'Ultraviolet' =&gt; "ultraviolet.css"
      );
  
      $this-&gt;load-&gt;view('demos/themeswap', $data);
  </code></pre>
  
  <p>views/demos/themeswap.php</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html lang="en-us"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;Theme Swap Demo&lt;/title&gt;
  
      &lt;link rel="stylesheet" href="/assets/css/&lt;?php echo $theme ?&gt;.css" media="screen" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;header&gt;
          &lt;h1&gt;Theme Swap Demo&lt;/h1&gt;
          &lt;nav&gt;
              &lt;ul&gt;
                  &lt;li&gt;&lt;a href="?????????"&gt;Standard&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="?????????"&gt;Dark&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="?????????"&gt;Light&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="?????????"&gt;Ultraviolet&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/nav&gt;
      &lt;/header&gt;
  &lt;main&gt;
      &lt;h1&gt;Some Rock-Solid Content&lt;/h1&gt;
      &lt;p&gt;Behold! I am a paragraph!&lt;/p&gt;
  &lt;/main&gt;
  &lt;footer&gt;
      &lt;p&gt;What an amazing footer.&lt;/p&gt;
  &lt;/footer&gt;
  </code></pre>