Pass the SEF'ed URL into php?

17 years 3 months ago - 17 years 3 months ago #814 by andyweb
Hi, I was wondering if there was any way I could pass the SEF version of the URL into PHP? (I have a php script included in the index.php template file)

Using "sefRelToAbs($_SERVER);" only gets me the "dirty URL" unless I have defined an alias.

Thanks

Please Log in or Create an account to join the conversation.

17 years 3 months ago #816 by Saka
sefRelToAbs( substr( $_SERVER), 1, strlen($_SERVER)-1 ) ); should work if Joomla is installed in root.

Emir Sakic
www.sakic.net

Please Log in or Create an account to join the conversation.

17 years 3 months ago #818 by andyweb
Thanks, but echo'ing that returns nothing, hrmmm. My joomla is installed in the root.

Excuse my ignorance ...but I don't quite understand how that code would help any though.

Thing is I don't want to return the, eg: /index.php?option=com_content&task=view&id=8&Itemid=23
I'd like to return the SEF'ed version of the URL, eg. /section/category/page-name.html

Is this possible?

PS. I noticed there seemed to be an extra bracket in there, so removed one at the end as the page was breaking at that point.

Please Log in or Create an account to join the conversation.

17 years 3 months ago #839 by andyweb
Well not to worry, I got it ...the command I was after was:

sefRelToAbs($_SERVER);

Please Log in or Create an account to join the conversation.

17 years 3 months ago #847 by it-info

Well not to worry, I got it ...the command I was after was:

sefRelToAbs($_SERVER);

Where to put htis an what are the benefits?

Regards, Christian

Please Log in or Create an account to join the conversation.

17 years 3 months ago #860 by andyweb
Well, I was using this to serve specific banners to the various sections I have on my website.

So I was pulling the sef url, then using the explode function in php to extract the section name and using that name to serve the specific banner I wanted.

I'm sure there can be many uses for it...

Please Log in or Create an account to join the conversation.

About us

We provide high quality Joomla components created by a co-founder and original core developer of Joomla. For over a decade, our products have been used by more than 20.000 webmasters around the world.

Stay in touch