【问题标题】:Parameter 'image_url' (value http:null) is not a valid URL format参数“image_url”(值 http:null)不是有效的 URL 格式
【发布时间】:2016-02-29 15:44:05
【问题描述】:

我正在尝试从我的电子商店分享我的产品,但我收到此错误:

参数“image_url”(值 http:null)不是有效的 URL 格式。

我已经阅读了有关此主题的先前答案,但我仍然没有能力解决它... 我的模板在node-product.tpl.php 中有这段代码,它是node-products 的模板:

<a target="_blank" href="http://pinterest.com/pin/create/button/?url=<?php print $base_url . "/" . drupal_get_path_alias('node/' . $node->nid); ?>&amp;description=<?php print $node->title; ?>" class="_3">
    <i class="fa fa-pinterest-square"></i>
</a>

我尝试添加此代码:

&media=<?php render($content['product:field_product_gallery']); ?>

但我仍然无法在 pinterest 上分享此内容。我认为图像渲染有问题,但我不是程序员,所以我不知道如何解决这个问题。 任何帮助,将不胜感激! 提前谢谢!

【问题讨论】:

  • 我建议使用 Pinterest 的集成脚本。这会让事情变得更容易。 Documentation
  • 感谢您的回答...太好了!有用!我可以像 class="fa fa-pinterest-square" 这样自定义 pin it 图像,以便与其他图像(fb、twitter)具有相同的大小吗?再次感谢您!
  • 当然。查看Widget Builder。您可以使用custom 标签来使用您自己的样式。

标签: php e-commerce pinterest


【解决方案1】:

我认为您需要urlencode() urlmediadescription,这些在您的代码中不存在。 因此,在您的情况下,href 变为:

http://pinterest.com/pin/create/button/?url=<?php print urlencode($base_url . "/" . drupal_get_path_alias('node/' . $node->nid)); ?>&amp;description=<?php print urlencode($node->title); ?>

【讨论】:

    猜你喜欢
    • 2011-02-02
    • 1970-01-01
    • 2023-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-04
    • 2021-09-09
    • 1970-01-01
    相关资源
    最近更新 更多