Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-12-16 07:47:40

cfenison
Member
Registered: 2004-06-25
Posts: 14
Website

Encode del.icio.us link ampersands

Howdy folks. I’m working on a redesign of my photoblog here. Lots of work let to do, but it’s time for me to start trying to validate. I’m running into a problem with my ampersands, namely that they are not encoded. I’m using MagpieRSS and the txp.icio.us plugin for my blogroll. I know there’s a couple of different ways to encode special characters using PHP like this one but I don’t know how to use it. Can I wrap htmlspecialchars around something in the plugin? Or perhaps I could hack one of the php files in the /include/ directory.

Any help?

Thanks,
Chris


-Chris
chrisfenison.com

Offline

#2 2005-12-16 08:23:44

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Encode del.icio.us link ampersands

You’d need to update the plugin itself. You can request the author to do it, or you can do it yourself:

  1. Go to the plugin tab, find the txp.icio.us plugin, and click on the link next to it named “edit”.
  2. Find line 56, which looks like: $url = $item['link'];
  3. Replace that with incorrect code removed, see followup post

Last edited by Mary (2005-12-16 09:52:25)

Offline

#3 2005-12-16 09:06:45

cfenison
Member
Registered: 2004-06-25
Posts: 14
Website

Re: Encode del.icio.us link ampersands

You are awesome. Thanks for the quick response. I can see what the line you gave me was trying to go, but it doesn’t quite work. It’s replacing the entire URL with an ampersand. I assume chr(38), ‘&’ is the part which turn an unencoded ampersand into an encoded one, but something doesnt seem to be working.

Maybe I didn’t make it clear that it’s the URLs that have the bad ampersands. Although, it appears that’s what you were trying to fix since you asked me to edit “$url” which I assume is the URL. :)

Any ideas?


-Chris
chrisfenison.com

Offline

#4 2005-12-16 09:50:56

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Encode del.icio.us link ampersands

Whoopsie, gotta get them parameters in the right order. I’m awake, really I am… Ugh, and my ampsersand got bunged up when I posted too.

Replace: $url = $item['link']; with: $url = str_replace(chr(38), '&', $item['link']);

Offline

#5 2005-12-16 18:00:38

cfenison
Member
Registered: 2004-06-25
Posts: 14
Website

Re: Encode del.icio.us link ampersands

SWEET! That did it. Thanks so much. I’m sure others will find this thread useful. Hopefully we’ve metioned all the terms people would be searching for.


-Chris
chrisfenison.com

Offline

Board footer

Powered by FluxBB