title: How to extend anchor() function to anchor_admin() in CodeIgniter?
body: <p>I would like to create my own function called <strong>anchor_admin()</strong> based on <strong>anchor()</strong> function in CodeIgniter.</p>
  
  <p>I was thinking like:</p>
  
  <p>I have defined admin path in <strong>config.php</strong> file e.g. like this:</p>
  
  <pre><code>$config['base_url'] = '';
  $config['base_url_admin']   = 'my-custom-admin-folder';
  </code></pre>
  
  <p>and then</p>
  
  <p>I need somehow create a new anchor_admin() function that extends anchor() function. </p>
  
  <p>so instead of typing:</p>
  
  <pre><code>&lt;?php echo anchor('my-custom-admin-folder/gallery', 'Gallery', 'class="admin-link"'); ?&gt;
  </code></pre>
  
  <p>I would type only:</p>
  
  <pre><code>&lt;?php echo anchor_admin('gallery', 'Gallery', 'class="admin-link"'); ?&gt;
  </code></pre>
  
  <p>But the output wold be always:</p>
  
  <pre><code>&lt;a href="http:/localhost/my-custom-admin-folder/gallery" class="admin-link"&gt;Gallery&lt;/a&gt;
  </code></pre>
  
  <p>Basically I only need to ad the config variable $this->config->item('base_url_admin') at the end of the url generated by the core anchor() function.</p>
  
  <p>How to do that?</p>
  
  <p>Which files do I nned to create and where to put?</p>
  
  <p>I guess creating a helper is not the way to go. </p>
  
  <p>Should I create a library or could it be put as a function within my MY_Controller file in core folder of my application that I already have created and I am using it to load some stuff already?</p>