Page 1 of 1

Checking URL Segments?

Posted: Sun May 23, 2004 1:12 pm
by Vik
I've got a weblog that uses the ExpressionEngine blogging CMS, which is written in PHP.

I'm trying to get one of my templates to include some PHP code that will check the URL segments of the URL that loaded it.

In a post on the EE forums, I got this advice:
You could check the URL segments. If there's an entry ID or "URL Title" then you know it's from a permalink.
What's the correct way to do this in PHP? Thanks very much in advance for any info.

Posted: Fri May 28, 2004 9:06 pm
by kettle_drum
You can get the $_SERVER['HTTP_REFERER'] which should hopefully have the full url of the page the user came from and then you know that any var sent to that page would have to be after a '?', so you can explode the string and your left with the page location and the variables set to that page, then if theres more than 1 variable sent to the page they are seperated by '&', so explode by that again.

Posted: Mon May 31, 2004 10:12 am
by pickle
Also, look at [php_man]parse_url[/php_man]