Welcome Guest, Not a member yet? Register   Sign In
confusing uri_string()
#1

Hi,
the name of this fn is actually quite confusing as it does not return the real URI ( for instance if base_url looks like http://host/app )- I know doc says "returns the URI segments"
But it would great if CI could have such fn - it would help to make shorter links (excluding host)

Best Regards,
Janusz
Reply
#2

Janul, I'm not clear what you are asking for.

Did you look at the method: current_url()?  It returns the full url of the current page, with all segments.

If you only want the segments, use the method: uri_string()

Please explain, with examples, what output you would like to receive.
CI 3.1 Kubuntu 19.04 Apache 5.x  Mysql 5.x PHP 5.x PHP 7.x
Remember: Obfuscation is a bad thing.
Clarity is desirable over Brevity every time.
Reply
#3

(02-12-2015, 07:40 PM)twpmarketing Wrote: Janul, I'm not clear what you are asking for.

Did you look at the method: current_url()?  It returns the full url of the current page, with all segments.

If you only want the segments, use the method: uri_string()

Please explain, with examples, what output you would like to receive.

Hi,
thanks for you reply.
example:
Let's presume I have
I have app running https://HOST/APP - where /APP is root for CI app
now I have controller TestCon.php and function show($id)
On different page I can create link to above one: base_url('testcon/show/'.$id.'') - which works fine -> https://HOST/APP/testcon/show/($id)
However uri_string('testcon/show/'.$id.'')  gives 'testcon/show/'.$id.''  not APP/testcon/show/($id)
Off course uri_string() work correctly related to doc (segments)
My question is if could have function in CI to create link with absolute URI

Thanks,
Janusz






 
Reply
#4

http://www.codeigniter.com/userguide3/he...elper.html

uri_string() does not take an input, it returns the URI segments of the current page.

It sounds like the function you are looking for is probably site_url() (or even base_url(), but you already mentioned it, so I'm not sure why you're looking for something else).

If you are trying to get /APP/testcon/show/$id, you're probably going to need to create your own function to retrieve /APP from $this->config->item('base_url') and prepend it to the desired segments.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB