Home arrow Forum Ampersand Processing
  Welcome, Guest. Please login or register.
Did you miss your activation email?
December 02, 2008, 04:06:39 AM
Home New Posts Search Calendar


Login with username, password and session length
+  Joomla Forum
|-+  Joomla Hacks
| |-+  Joomla-SMF Forum Support
| | |-+  Joomla-SMF 1.0.x (Moderators: -Wolverine, kai920)
| | | |-+  Ampersand Processing
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: Ampersand Processing  (Read 4377 times)
Kevin8020
QA / Testers
Joomla Master
*****

Karma: +33/-18
Offline Offline

Posts: 105



View Profile WWW
Ampersand Processing
« on: November 17, 2005, 10:32:52 PM »

Hi there. I've been using the Joomla-SMF component in a site I am currently working on. I have the site localized on my computer, and have it working very nicely. One of the strange issues I ran into was with the ampersand (&) and validation. In the component configuration to my setup, it reads this in the mosurl line:
"http://localhost:85/joomla/index.php?option=com_smf&Itemid=27&"

Now, this causes the board not to XHTML validate because the & only survives so long. Now, when I change this line to read this, it works fine:
"http://localhost:85/joomla/index.php?option=com_smf&Itemid=27&"

I believe this is because the component takes the first & and processes it, returning a plain &. Adding the second layer in sends this successfully to the forums. This brings up another larger issue, as it causes all the links to stop working! Is there any way to get this to work?

Thanks!
-Kevin8020
« Last Edit: November 17, 2005, 10:35:56 PM by Kevin » Logged
jj
Joomla Pro
**

Karma: +5/-2
Offline Offline

Posts: 53


View Profile
Re: Ampersand Processing
« Reply #1 on: November 17, 2005, 11:13:22 PM »

Try urlencoding the string

e.g.
http://www.albionresearch.com/misc/urlencode.php
Logged
sean
Joomla Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8


View Profile
Re: Ampersand Processing
« Reply #2 on: November 18, 2005, 04:26:06 AM »

give us a clue then??
are you saying we should make a php proggy that url encodes everything that comes back from the component? i'm not a php programmer and have no idea where the component or joomla does it's url building. This problem looks more like a fault with either joomla or the component code and it's similar to my problem here http://www.joomlahacks.com/component/option,com_smf/Itemid,94/topic,942.0
Logged
joomlanewbie
Joomla Master
***

Karma: +20/-5
Offline Offline

Posts: 145


View Profile
Re: Ampersand Processing
« Reply #3 on: November 18, 2005, 10:09:45 AM »

I'm not exactly sure what JJ is saying..(I think I have an idea I'll try later) but I DO know theres something afoot with the internal representation and recognition of the url string..

for instance, when you click on [img]http://www.joomlahacks.com/smf/Themes/MamboHacks/images/english/go_down.gif/img] (or the go up button) it is supposed to instantly jumpy to the bottom or top.. instead it (dramatic,ominous drum roll) RELOADS THE ENTIRE URL!

subsequent clicks then jump you straight up and down...

This site does it.. but that may have something to do with SEF urls though...



What i think JJ is referring to is if you encode the string (url) early on, you will 'escape' or mask the characters so that they wont be stripped out or acted upon? It's worth a try I suppose, but not on a live site and it  may break SEF if you have it..
Logged
Kevin8020
QA / Testers
Joomla Master
*****

Karma: +33/-18
Offline Offline

Posts: 105



View Profile WWW
Re: Ampersand Processing
« Reply #4 on: November 18, 2005, 02:35:51 PM »


Well, I attempted to change all my "&" to "%26" with the following code:
"$mosurl = str_replace( '&', '%26', $mosurl );"

It worked good, and my page validated, but none of the URL's worked. They all responded with this error:

"The page you are trying to access does not exist.
Please select a page from the main menu."

I used the same code with & instead of %26, and it also worked, but again, the links did absolutely nothing when clicked on.

Any other ideas?
« Last Edit: November 18, 2005, 02:37:53 PM by Kevin » Logged
sean
Joomla Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8


View Profile
Re: Ampersand Processing
« Reply #5 on: November 19, 2005, 05:30:56 AM »

if i take the amp; part out of my url things display and correctly. There are some strange goings on here but the joomla forums are about as useful as a chocolate fireguard. I tried to use a couple of other forum components and while they seemed to work as far as the url encoding etc i still have a problem where when i post a message apostrophe shows up as a slash and apostrophe!
a little knowledge is dangerous as they say but i have a dedicated server with a standard fedora 3 installation, the likes of mambo and phpnuke etc ran fine on it.
Logged
joomlanewbie
Joomla Master
***

Karma: +20/-5
Offline Offline

Posts: 145


View Profile
Re: Ampersand Processing
« Reply #6 on: November 19, 2005, 05:59:18 AM »

Kevin,Sean .. Neither of you are using a SEF products correct? it's the raw url coming out of the program?

I believe to really test with this you HAVE to have an unmodded/unpatched SMF installation to look at simultaeneously.

At Kevin, str_replace() is way different than urlencode though they may seem to do the same thing (changing the "&" - Urlencode has some kind of logic determining what it changes, str_replace just exchanges the "&" even if the "&" were already escaped or quoting.

we all have to help each other on this, or as they say,let one "&" wash the other!





(ok. very lame-if you want REAL help @ 5:am then you best get a chocolate fireguard! yum chocolate)

This is really where somebody like (ok, actually Cowboy himself) steps in a gives a high level overview of how the component attempts it's magic as I sense we are embarking on a grand process of discovery in vain )
Logged
sean
Joomla Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8


View Profile
Re: Ampersand Processing
« Reply #7 on: November 19, 2005, 10:39:22 AM »

i've checked and i'm not using any sef at all.
unmodded smf seems to work fine on it's own. The error seems to be component related somewhere after post??
I also have tried the phpbb bridge and that works fine.
Sidenote:-After some faffing around i've sorted the dreaded apostophe problem, i don't like the idea of having to enable magic quotes though!
Logged
sean
Joomla Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8


View Profile
Re: Ampersand Processing
« Reply #8 on: November 19, 2005, 11:12:19 AM »

persistance always pays lol
i've found a hack around it in my case
take a look at the config.smf.php file at the $mosurl line
mine had the amp; inserted, took that bit out and it's working perfectly now!
i know nothing about mambo/joomla etc so i've no idea if that line is like that for a reason but it's not broke anything else
Logged
Kevin8020
QA / Testers
Joomla Master
*****

Karma: +33/-18
Offline Offline

Posts: 105



View Profile WWW
Re: Ampersand Processing
« Reply #9 on: November 19, 2005, 02:01:12 PM »

@joomlanewbie: I don't have any SEF stuff on at all. I did run validation on SMF before bridging it, and it works fine.
_____________________

Ok, after further looking into this, I found some weird stuff. Take a look at this line in the bridge version (the one with validation problems):
Quote

Now, when I access this directly, through the /forums/ link, I get this:
Quote

If the correct live site was specified for this, it would work, but since the config stuff is still joomlaized, it does nothing useful. What I find interesting is that the first instance uses &'s and the second uses ?'s... strange...

Well, I'm really clueless now Smiley

BTW: I'll be uploading this site to the net soon... that could make things easier.
____________________
Another note. Here is some info on the $mosurl line:
$mosurl = http://localhost:85/joomla/index.php?option=com_smf&Itemid=27&"; - Validates but links are broken
$mosurl = http://localhost:85/joomla/index.php?option=com_smf&Itemid=27& - Links work but page doesn't validate
$mosurl = http://localhost:85/joomla/index.php?option=com_smf&Itemid=27&
-Links work, page doesn't validate

________________________________
Issue found:
With "&" at the end, the link to the general discussion forums is as follows:
"http://localhost:85/joomla/index.php?option=com_smf&Itemid=27&?board=1.0" (Note the ? before board)

With "&" the url is as follows:
http://localhost:85/joomla/index.php?option=com_smf&Itemid=27&board=1.0 (Notice the lack of ?, this link is functional)

What is adding the ? in?
« Last Edit: November 19, 2005, 02:19:37 PM by Kevin » Logged
Kevin8020
QA / Testers
Joomla Master
*****

Karma: +33/-18
Offline Offline

Posts: 105



View Profile WWW
Re: Ampersand Processing
« Reply #10 on: November 19, 2005, 06:49:23 PM »

Cheesy

YAY! I was able to track down the code in question.

In my config.smf.php file, this is what my $mosurl looks like (the standard)
"http://localhost:85/joomla/index.php?option=com_smf&Itemid=27&"

In functions.smf.php, my line 256 looked like this
$tmpurl = str_replace("&?","&",$tmpurl);
I replaced it with this
$tmpurl = str_replace("&?","&",$tmpurl);

Above that line, I inserted this code
$tmpurl = str_replace("&","&",$tmpurl);


The page is valid and the links are functional!! YAY!

« Last Edit: November 19, 2005, 06:54:53 PM by Kevin » Logged
joomlanewbie
Joomla Master
***

Karma: +20/-5
Offline Offline

Posts: 145


View Profile
Re: Ampersand Processing
« Reply #11 on: November 19, 2005, 10:27:59 PM »

Hey before you go yay...

Try your code as seen through the eyes of a couple browsers...I read somewhere that that & /amp processing fixup takes place in the browser too, in the same way some websites auto correct if you go to

www.cnet/new/music
OR
www.cnet/new/music/
it may be that some of that junk is interpreted differently by different browsers.
Logged
Jelte
Guest
Re: Ampersand Processing
« Reply #12 on: December 24, 2005, 07:18:55 AM »

Cheesy

YAY! I was able to track down the code in question.

In my config.smf.php file, this is what my $mosurl looks like (the standard)
"http://localhost:85/joomla/index.php?option=com_smf&Itemid=27&"

In functions.smf.php, my line 256 looked like this
$tmpurl = str_replace("&?","&",$tmpurl);
I replaced it with this
$tmpurl = str_replace("&?","&",$tmpurl);

Above that line, I inserted this code
$tmpurl = str_replace("&","&",$tmpurl);


The page is valid and the links are functional!! YAY!



Did this with my site but still having the same problems (using joomla 1.04, bridge 1.02a, CB RC2)
Logged
CJ
Joomla Newbie
*

Karma: +1/-0
Offline Offline

Posts: 3


View Profile
Re: Ampersand Processing
« Reply #13 on: July 28, 2006, 09:18:37 PM »

I had a problem with pages not validating for XHTML after installing the bridge. Kevin's fix solved the problem for me and all the links work fine. Thanks Kevin.
Logged
-Wolverine
Moderator
Joomla Guru
*****

Karma: +376/-34
Offline Offline

Posts: 3393


Lead Developer


View Profile WWW
Re: Ampersand Processing
« Reply #14 on: July 28, 2006, 09:37:33 PM »

this has undergone successful testing and it'll be in the next release.
Logged

Need help?  Check Here First!
Get the JSMF User Guide
SEARCH this forum.
Pages: [1] Go Up Print 
« previous next »
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Joomla Forum | Powered by SMF 1.1 RC1.
© 2001-2005, Lewis Media. All Rights Reserved.
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!

Joomla Hacks is a Joomla Components, Joomla Modules, Joomla Templates, & Joomla Mambots resource portal. None of the text or images in this public website may be copied without the expressed written consent of the authors. Copyright 2005 by JoomlaHacks.com. Powered by Joomla. All rights reserved.
Terms of Use
Joomla Hacks



Joomla Hacks
German Lang French Lang Italian Lang Spanish Lang Japanese Lang Chinese Lang
Joomla Comment
Search Contact About Advertise Blogs Topsites Submit News Register Login