title: CodeIgniter: How to add css link tag to the head of html page from within a helper
body: <p>I've got a helper method which renders some html along with the required <strong>css</strong> and <strong>js</strong> links. I am simply concatenating all the html tags and returning the built string. The helper method is something like this:</p>
  
  <pre><code>function display_linkPreview($data = array())
  {
      $return = "&lt;link rel=\"stylesheet\" class=\"cssStatics\" type=\"text/css\" href=".base_url()."assets/css/stylesheet.css\" /&gt;
          &lt;script type=\"text/javascript\" src=".base_url()."assets/js/linkPreview.js\" &gt;&lt;/script&gt;
          &lt;div&gt;blah blah&lt;div&gt;&lt;/div&gt;&lt;/div&gt;";
      return $return;
  }
  </code></pre>
  
  <p>And this is the way I am going to render the outpt of <code>display_linkPreview</code> in one of the views:</p>
  
  <pre><code>echo display_linkPreview($body);
  </code></pre>
  
  <p>The problem is that all the output of <code>display_linkPreview</code>, including the <code>&lt;link&gt;</code> and <code>&lt;script&gt;</code> tags will be rendered in the middle of HTML page where I have called <code>echo</code>. How can I modify <code>display_linkPreview</code> to add <code>css</code> and <code>js</code> tags to the <code>&lt;head&gt;</code> of html?</p>