what does sefRelToAbs do ?

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
User avatar
jalil
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 128
Joined: Wed Jul 04, 2007 4:54 am
Location: Kuala Lumpur, Malaysia
Contact:

what does sefRelToAbs do ?

Post by jalil » Tue Sep 11, 2007 2:25 am

i want to translate between SEF URLS to traditional or Joomla! URLs and vice versa...is this (sefRelToAbs) the right function to use ?

User avatar
plamendp
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sun Nov 13, 2005 10:41 am
Location: Varna, Bulgaria

Re: what does sefRelToAbs do ?

Post by plamendp » Tue Sep 11, 2007 9:47 am

Hi,

sefRelToAbs() converts "traditional", relative URL:

index.html?a=b&c=d

to SEF, absolute URL: 

/webroot/pathto/index.html/a,b/c,d

Plamen(dp)





Plamen(dp)
Some day I'll change my signature to something meaningful...some day...

User avatar
ianmac
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 237
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: what does sefRelToAbs do ?

Post by ianmac » Tue Sep 11, 2007 12:24 pm

The functionality of sefRelToAbs depends on the SEF setting of the Joomla! system it is running on.  Should also be noted it is a 1.0 only function and in 1.5 JRoute::_() should be used.

Ian
Help test my Component XML Generator Tool!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!

User avatar
plamendp
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sun Nov 13, 2005 10:41 am
Location: Varna, Bulgaria

Re: what does sefRelToAbs do ?

Post by plamendp » Tue Sep 11, 2007 2:00 pm

Good point, thanks!

Plamen
Some day I'll change my signature to something meaningful...some day...

User avatar
ChiefGoFor
Joomla! Engineer
Joomla! Engineer
Posts: 282
Joined: Tue Sep 13, 2005 12:22 am
Location: Omaha, Nebraska, USA

Re: what does sefRelToAbs do ?

Post by ChiefGoFor » Tue Sep 11, 2007 3:56 pm

Just to add to what Ian said, your SEF setting will affect how this function operated, but it is always a good idea to use it (in J! 1.0), even if you do not use SEF.

For instance, let's say we have:

Code: Select all

sefRelToAbs('index.php?option=com_content&task=view&id=19&Itemid=34')


If SEF is off, it will be converted to:

Code: Select all

http://www.yourdomain.com/index.php?option=com_content&task=view&id=19&Itemid=34


If SEF is on, it will be converted to:

Code: Select all

http://www.yourdomain.com/content/view/19/34/



Hense the name, relative links become absolute. The past in front is taken from your $mosConfig_live_site variable in configuration.php (Global Configuration)

I hope that helps someone out there.
Kenneth Crowder - Omaha, Nebraska, USA
Joomla! ...because open source matters

User avatar
jalil
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 128
Joined: Wed Jul 04, 2007 4:54 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: what does sefRelToAbs do ?

Post by jalil » Wed Sep 12, 2007 12:01 am

ChiefGoFor wrote:Just to add to what Ian said, your SEF setting will affect how this function operated, but it is always a good idea to use it (in J! 1.0), even if you do not use SEF.


i think this is a very important point. i coding 1.0 right now, and when i go to 1.5 i just stick a JRoute in sef. :)

User avatar
jalil
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 128
Joined: Wed Jul 04, 2007 4:54 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: what does sefRelToAbs do ?

Post by jalil » Wed Sep 12, 2007 12:14 am

currently the sef.php in only resets $_SERVER['REQUEST'].

so i have to take the codes from sef into a newfile and modify them for my purpose. is this ok to do ?
i do not mind that if someone does that to my code, sol ong as the credits are kept intact, and if i understand the license correctly, it should be ok to jusy copy the sef.php ?

dhowe01
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Sep 19, 2007 6:57 pm

Re: what does sefRelToAbs do ?

Post by dhowe01 » Sat Oct 06, 2007 12:34 am

ianmac wrote:The functionality of sefRelToAbs depends on the SEF setting of the Joomla! system it is running on.  Should also be noted it is a 1.0 only function and in 1.5 JRoute::_() should be used.

Ian


Should we expect sefRefToAbs to work when compatibility mode is turned on in 1.5?

User avatar
ianmac
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 237
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: what does sefRelToAbs do ?

Post by ianmac » Mon Oct 08, 2007 12:54 pm

I would imagine, yes.

This is a often used function, so though I haven't tried it, I would say most certainly it would be.  If it doesn't, please file a bug report.

Ian
Help test my Component XML Generator Tool!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!

User avatar
eddyyanto
Joomla! Apprentice
Joomla! Apprentice
Posts: 44
Joined: Tue Jan 17, 2006 7:42 am
Contact:

Re: what does sefRelToAbs do ?

Post by eddyyanto » Mon Oct 29, 2007 5:36 am

It seemed that sefRelToAbs() function doesn't work with index2.php.
Has anybody achieved that before? I mean make the sefRelToAbs to work with index2.php?  :pop
+ what's great about open-source? kindness of sharing
+ http://www.eddyyanto.com

dhowe01
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Sep 19, 2007 6:57 pm

Re: what does sefRelToAbs do ?

Post by dhowe01 » Mon Oct 29, 2007 11:43 am

It doesn't work with CB either.  Apparently Beat has reported this to the Joomla Dev team on several times and it just isn't getting fixed.

User avatar
ChiefGoFor
Joomla! Engineer
Joomla! Engineer
Posts: 282
Joined: Tue Sep 13, 2005 12:22 am
Location: Omaha, Nebraska, USA

Re: what does sefRelToAbs do ?

Post by ChiefGoFor » Mon Oct 29, 2007 2:50 pm

dhowe01 wrote:It doesn't work with CB either.  Apparently Beat has reported this to the Joomla Dev team on several times and it just isn't getting fixed.


?? Beat is on the Dev team ;)
Kenneth Crowder - Omaha, Nebraska, USA
Joomla! ...because open source matters

dhowe01
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Sep 19, 2007 6:57 pm

Re: what does sefRelToAbs do ?

Post by dhowe01 » Mon Oct 29, 2007 5:07 pm

ChiefGoFor wrote:
?? Beat is on the Dev team ;)


Please refer to this thread:

http://www.joomlapolis.com/component/op ... 106/#47106

Where the following is stated, by Beat:
I reported this bug 3 times to joomla core team, once even in bug tracker.

Maybe you could report it to Joomla 1.5 Q&T forums as well ?

Exact problem is that relative paths do not get converted correctly within components in SEF mode to absolute paths in sefRelToAbs() function.


Seems like the ball is being dropped somewhere.

User avatar
ChiefGoFor
Joomla! Engineer
Joomla! Engineer
Posts: 282
Joined: Tue Sep 13, 2005 12:22 am
Location: Omaha, Nebraska, USA

Re: what does sefRelToAbs do ?

Post by ChiefGoFor » Fri Nov 09, 2007 8:22 pm

Ah, reported to the Core Team... not the Dev Team. :) Thanks for the extra info.
Kenneth Crowder - Omaha, Nebraska, USA
Joomla! ...because open source matters


Post Reply