PRO-Webs, Inc. since 2003 :: Zen Cart Hosting :: Zen Cart SEO – 12 Steps to Success
**I answer questions in the forum, private messages are not conducive to a helpful community.
I think we will put that down to weirdness in that case. The code I posted is exactly what I am using.
How odd :-) As you say. If it works it works. Miller time.
Nick
iszent.com
PRO-Webs, Inc. since 2003 :: Zen Cart Hosting :: Zen Cart SEO – 12 Steps to Success
**I answer questions in the forum, private messages are not conducive to a helpful community.
Hi, folks. To make URLs with reserved characters such as the question mark or ampersand work with Pinterest, please percent-encode them. Ampersands translate to %26; questions marks translate to %3F. If you need help with this you can paste your non-encoded URL into the form at http://business.pinterest.com/widget-builder and get back the right answer.
More information on percent-encoding here:
http://en.wikipedia.org/wiki/Percent_encoding
Thanks very much,
Kent Brewster, Button Wrangler, Pinterest
Thanks for your attention to this.
A couple of questions if you are still around:
Firstly, where would that information be available to developers on the pinterest site? It would be nice if it was there. As it would save a whole lot of experimentation about what works. The ability to post a single link and have it encoded is nice but does not really help developers who are trying to programatically create buttons.
Secondly, I guess that what you are saying, for php applications, is that the function rawurlencode() needs to be used rather than urlencode(). Correct?
Thanks
Nick
Nick
iszent.com
We definitely owe you some documentation, Nick. Working on it now; when it appears, we'll be sure to link it prominently from the Widget Builder.
Yes, rawurlencode() seems preferable to urlencode(), since it will do the right thing with spaces. Neither function turns ampersands into HTML entities, which are guaranteed not to work in an URL.
--Kent
Thanks Kent
You are right. rawurlencode won't solve the issue by itself.
Zen, like many platforms that use dynamic style urls ( and don't use pretty URLs) will output this as a link
index.php?main_page=index&cPath=3
So, either one needs to modify the method of creation of the link. Which is kind of boring. Or one needs to use a function like str_replace() to turn the '&' back in to '&' before then rawurlencoding it.
So, I think that that is really the message for anyone reading this thread.
You need to use a function similar to the one that Melanie used above.
I'd say that the best one would be:
Where $url is the url that zen is creating. And $pinterest _url is the version of that that you want to insert into the pinterest button.Code:$pinterest_url = rawurlencode(str_replace('&','&',$url));
Nick
iszent.com