[eluser]rijobo[/eluser]
I've found a function that I can put in my url_helper, which i can use to put images in my anchor. But when I use this function, it does nothing.
This is what I use:
Controller:
Code:
function index()
{
$this->load->helper('url_helper');
$this->load->view('administrator_view');
}
View:
Code:
<?php anchor_img('producttoevoegen', 'title="Nieuw product toevoegen"', '../assets/images/producttoevoegen.jpg', 'alt="Nieuw product toevoegen"'); ?>
Function in helper:
Code:
function anchor_img($uri = '', $anchor_attributes = '', $img_src = '', $img_attributes = '')
{
if ( ! is_array($uri))
{
$site_url = ( ! preg_match('!^\w+://! i', $uri)) ? site_url($uri) : $uri;
}
else
{
$site_url = site_url($uri);
}
if ($anchor_attributes != '')
{
$anchor_attributes = _parse_attributes($anchor_attributes);
}
if (strpos($img_src, '://') === FALSE)
{
$CI =& get_instance();
$img_src = $CI->config->slash_item('base_url').$img_src;
}
if ($img_attributes != '')
{
$img_attributes = _parse_attributes($img_attributes);
}
return '<a href="'.$site_url.'">'.'<img src="'.$img_src.'" />'.'</a>';
}