From 605dcbc55ed4dfa1c8fb8ed659dc51b0710ff165 Mon Sep 17 00:00:00 2001 From: William Poetra Yoga <30787981+wpyh@users.noreply.github.com> Date: Wed, 30 May 2018 10:04:01 +0700 Subject: Use Config::base_url() properly Using the Config::slash_item() method, we get double forward slashes. For example, base_url = 'http://localhost:8080/' and asset is '/assets/my_asset.css', then the generated URL would be 'http://localhost:8080//assets/my_asset.css'. This patch fixes that, so the generated URL would be 'http://localhost:8080/assets/my_asset.css'. There is actually already an analog example in the case if index_page === TRUE, where the site_url() function is used. --- system/helpers/html_helper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/helpers/html_helper.php') diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index c935f2619..985c68c8a 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -200,7 +200,7 @@ if ( ! function_exists('img')) } else { - $img .= ' src="'.get_instance()->config->slash_item('base_url').$v.'"'; + $img .= ' src="'.get_instance()->config->base_url($v).'"'; } } else @@ -292,7 +292,7 @@ if ( ! function_exists('link_tag')) } else { - $link .= 'href="'.$CI->config->slash_item('base_url').$v.'" '; + $link .= 'href="'.$CI->config->base_url($v).'" '; } } else @@ -313,7 +313,7 @@ if ( ! function_exists('link_tag')) } else { - $link .= 'href="'.$CI->config->slash_item('base_url').$href.'" '; + $link .= 'href="'.$CI->config->base_url($href).'" '; } $link .= 'rel="'.$rel.'" type="'.$type.'" '; -- cgit v1.2.3-24-g4f1b