我可以使用PHP动态插入带有Pinterest的url、媒体和描述吗?
这是我的密码:我可以使用PHP动态插入带有Pinterest的url、媒体和描述吗?,php,javascript,pinterest,Php,Javascript,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
<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>
(功能(){
window.PinIt=window.PinIt | |{loaded:false};
if(window.PinIt.load)返回;
window.PinIt.load=true;
函数异步加载(){
var s=document.createElement(“脚本”);
s、 type=“text/javascript”;
s、 异步=真;
如果(window.location.protocol==“https:”)
s、 src=”https://assets.pinterest.com/js/pinit.js";
其他的
s、 src=”http://assets.pinterest.com/js/pinit.js";
var x=document.getElementsByTagName(“脚本”)[0];
x、 parentNode.insertBefore(s,x);
}
如果(窗口附件)
attachEvent(“onload”,异步加载);
其他的
addEventListener(“加载”,异步加载,false);
})();
php成功地收集了所有元素,当我点击按钮时,它会弹出模态窗口
但是,在随后的模式窗口中,当我登录时,它不会固定到我的板上
脚本标记和链接都位于列表项内
任何帮助都将不胜感激
谢谢,
Moises M.根据您的描述,问题似乎在于您没有对参数进行url编码,即?url之后的所有内容=
我不确定这是否是你遇到的唯一问题,但它应该能解决你目前遇到的问题 您的问题是关于Pinterest还是关于从PHP向JavaScript传递数据?进行一些调试,找出失败的确切位置。这会让别人更容易帮助你,你也可能会自己发现问题。这是关于Pinterest的。我已经使用了他们的代码@nicholaides,并且联系了他们,但是我想看看是否还有其他人有这个问题。在这种情况下,我建议删除任何没有特别强调Pinterest问题的代码。这将使人们更容易了解你的要求。这是一个结合了这一点,并没有一个完全设置测试Pinterest帐户。谢谢