We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Looking for plugin that converts characters in a URL so that the page can validate

Development and Programming

Shannon Smith's avatar
Shannon Smith
161 posts
16 years ago
Shannon Smith's avatar Shannon Smith

Does anyone know if there is a plugin that will take a URL like:

http://www.isixsigma.com/offsite.asp?A=Fr&Url=http://www.personneltoday.com/articles/2009/01/13/48943/hr-survival-guide-for-2009-how-to-get-the-best-out-of-your-budget.html

and change the unencoded ampersand into & as well as change whatever other symbols are necessary for this to validate properly.

This URL is being pulled in from a magpie feed and it seems to leave all the symbols unencoded and the page fails validation.

Thanks in advance!

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

Would this Encode / Decode plugin help at all?

Best wishes,

Mark

       
Low's avatar
Low
407 posts
16 years ago
Low's avatar Low

Looks like Valid URL does just that.

       
Shannon Smith's avatar
Shannon Smith
161 posts
16 years ago
Shannon Smith's avatar Shannon Smith

I tried valid URL but it insists on putting an extra http:// on the front. I don’t think you can stop it from doing that…. at least it doesn’t seem to have an option to stop that. I suppose I could try some sort of “trim” plugin to take out the http://, but that just seems a bit like overkill.

I also tried a find and replace plugin, but that didn’t work either.

I’ll take a look at the encode/decode thing. Never saw that before.

Thanks to you both.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

No problem. Let us know how it all goes. I’m sure we can get something working between us all if that other plugin doesn’t do it for you.

Best wishes,

Mark

       
Shannon Smith's avatar
Shannon Smith
161 posts
16 years ago
Shannon Smith's avatar Shannon Smith

Hello again Mark,

That is a super cool plugin, but it appears to work TOO well. This is what it does to my link:

href=”{magpie:link}”

because this is how I have to put it in…. surrounding an EE variable:

href=”{exp:np_encodedecode style="url" direction="encode"}{magpie:link}{/exp:np_encodedecode}

So, it seems to just convert the {,},and the : from my variable, making it no longer a variable.

Cool plugin though. Any ideas how I can get around this?

Thanks again, Shannon

Note: I notice when this displays it’s making the link above display a {,}, : but the plugin does encode them properly in my html source code. The EE forum just converted them back because I didn’t wrap it in <pre><code> tags on here.

       
Shannon Smith's avatar
Shannon Smith
161 posts
16 years ago
Shannon Smith's avatar Shannon Smith

Actually, I just realized that it was Lodewijk’s Find & Replace plugin that I also tried, but that didn’t seem to do the trick.

       
Shannon Smith's avatar
Shannon Smith
161 posts
16 years ago
Shannon Smith's avatar Shannon Smith

Ok, I thought I might have solved my problem by adding parse=”inward” to my magpie plugin, but it still doesn’t work….

Here is my code.



The encodedecode plugin tries to work on {magpie:link} literally, rather than the actual link produced by magpie. Why would EE be ignoring my parse=”inward” parameter?

       
Shannon Smith's avatar
Shannon Smith
161 posts
16 years ago
Shannon Smith's avatar Shannon Smith

Last update, as I finally got it to work.

My problem with my parse=”inward” parameter was that I had copied it out of the docs somewhere and pasted it in, so it was using curly quotes and this is a no-no. If I just typed it in it all worked fine.

I eventually solved the validation problem by modifying the encode-decode plugin Mark suggested. The problem with the plugin was that it encoded too much and then the URL would no longer lead to the correct location. I did a very minor edit on the php of the plugin so that I am using the htmlspecialchars php function, rather than the urlencode php function in the plugin.

Anyway, if anyone has similar troubles, I can let you know how I altered the code. It was pretty easy. All works now and the page validates just fine.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.