Welcome Guest, Not a member yet? Register   Sign In
anchor external url with urlencode
#1

Hi everybody,
i'm trying in a view to make a link to an external url like this :


Code:
$c_url_redir = 'http://www.example.com/content.php?id=test&article=3';
if (isset($c_url_redir)){
   echo anchor(urlencode($c_url_redir), "go", 'class="pure-button pure-button-primary" target="_blank"');
}


CI add base_url to my external url...Why and how to fix that?
Reply
#2

(This post was last modified: 03-16-2015, 08:40 AM by sajid19991.)

(03-16-2015, 03:08 AM)pioc Wrote: Hi everybody,
i'm trying in a view to make a link to an external url like this :



Code:
$c_url_redir = 'http://www.example.com/content.php?id=test&article=3';
if (isset($c_url_redir)){
   echo anchor(urlencode($c_url_redir), "go", 'class="pure-button pure-button-primary" target="_blank"');
}


CI add base_url to my external url...Why and how to fix that?

correct way to do this

Code:
$c_url_redir = 'http://www.example.com/content.php?id=test&article=3';
if (isset($c_url_redir)){
   echo anchor($c_url_redir, "go", 'class="pure-button pure-button-primary" target="_blank"');
}

ci's anchor function is not able to detect external url when you encode it...
Reply
#3

CI's helper functions, like anchor(), are helpers for YOUR CI app. If you want to link to something external outside of your app, don't use CI's helpers and create a traditional <a> tag.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB