我可以使用PHP在Pinterest中动态插入url、媒体和描述吗


Can I use PHP to dynamically insert url, media and description with Pinterest?

这是我的代码:

<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> 

php成功地收集了所有元素,当我点击按钮时,它会弹出模式窗口。

然而,在随后的模式窗口中,当我登录时,它不会固定到我的板上

Script标记和链接都在列表项中。

如有任何帮助,我们将不胜感激。

谢谢,Moises M.

根据您的描述,问题似乎是您没有对参数进行url编码,即在?url=

我不确定这是否是你遇到的唯一问题,但它应该能解决你目前遇到的问题!