duanqian1888 2012-03-08 16:14
浏览 45
已采纳

我可以使用PHP动态插入Pinterest的网址,媒体和描述吗?

Here's my code:

<script type="text/javascript">
(function() {
window.PinIt = window.PinIt || { loaded:false };
if (window.PinIt.loaded) return;
window.PinIt.loaded = true;
function async_load(){
    var s = document.createElement("script");
    s.type = "text/javascript";
    s.async = true;
    if (window.location.protocol == "https:")
        s.src = "https://assets.pinterest.com/js/pinit.js";
    else
        s.src = "http://assets.pinterest.com/js/pinit.js";
    var x = document.getElementsByTagName("script")[0];
    x.parentNode.insertBefore(s, x);
}
if (window.attachEvent)
    window.attachEvent("onload", async_load);
else
    window.addEventListener("load", async_load, false);
})();
</script>

 <!-- Customize and include for EACH button in the page -->
  <a href="http://pinterest.com/pin/create/button/?url=<?php echo $this->helper('core/url')-       >getCurrentUrl(); ?>&media=<?php echo $this->helper('catalog/image')->init($_product, 'image')->resize(500); ?>&description=<?php echo $_product->getShortDescription(); ?>" class="pin-it-button" count-layout="none">Pin It</a> 

The php successfully gathers all of the elements and when I click on the button, it pops up the modal window.

However, in the subsequent modal window, it does not pin to my board when I'm logged in.

The Script tag and link are both inside of a list item.

Any help would be appreciated.

Thanks, Moises M.

  • 写回答

1条回答 默认 最新

  • duanpanhuo0618 2012-05-14 08:51
    关注

    From your description it sounds like the problem is that you are not url encoding the parameters, i.e. everything after the ?url=

    I'm not sure if that's the only problem you'll run into with this, but it should fix the one you're currently hitting!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 求数学坐标画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站