2016-02-29 69 views
0

我想和大家分享我的產品我的e店,但我收到此錯誤:參數「IMAGE_URL」(值HTTP:空)不是有效的URL格式

Parameter 'image_url' (value http:null) is not a valid URL format.

我看過以前關於這個話題的答案,但我還是沒有解決這個問題的能力...... 我的模板有此代碼node-product.tpl.php,這是節點的產品模板:

<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。我相信圖像渲染有些問題,但我不是程序員,所以我不知道如何解決這個問題。 任何幫助,將不勝感激! 提前謝謝!

+0

我會建議使用Pinterest的的集成腳本。它會使它更容易。 [文檔](https://developers.pinterest.com/docs/widgets/getting-started/) –

+0

謝謝你的回答...太棒了!有用!我是否可以自定義針類圖像像class =「fa fa-pinterest-square」以便與其他人(fb,twitter)具有相同的尺寸?再次感謝你! – kpatsali

+0

當然。查看[Widget Builder](https://developers.pinterest.com/tools/widget-builder/)。您可以使用'custom'標籤來使用自己的風格。 –

回答

0

我認爲你需要urlencode()網址媒體描述,這是不是在你的代碼存在。 所以你的情況的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); ?>