Welcome Guest, Not a member yet? Register   Sign In
anchor helper adding url_suffix for image to other files
#1

[eluser]umefarooq[/eluser]
i have seen in documentation that now base_url can accept parameter, if you link an image with anchor helper and you have enable url_suffix its is adding url suffix to image link there should be change in anchor helper too if any suffix already exist then it should use base_url

Code:
anchor('test.jpg');

image with url suffix
http://localhost/test.jpg.html

new
Code:
function anchor($uri = '', $title = '', $attributes = '')
{
  $title = (string) $title;

  if ( ! is_array($uri))
  {
   $site_url = ( ! preg_match('!^\w+://! i', $uri)) ? (!preg_match('/[^\.]+$/i', $uri))?site_url($uri):  base_url().$uri : $uri;
  }
  else
  {
   //$site_url = site_url($uri);
                    $site_url = (!preg_match('/[^\.]+$/gim', $uri))?site_url($uri):  base_url().$uri;
  }

  if ($title == '')
  {
   $title = $site_url;
  }

  if ($attributes != '')
  {
   $attributes = _parse_attributes($attributes);
  }

  return '<a href="'.$site_url.'">'.$title.'</a>';
}




Theme © iAndrew 2016 - Forum software by © MyBB