在 Facebook 对话框弹出窗口中渲染 FBML

发布于 2024-09-15 02:25:08 字数 1125 浏览 0 评论 0原文

我正在开发一个 Facebook 页面,其中有一个个人资料图片表。单击这些图像中的每一个,我使用 Facebook 对话框在弹出窗口中显示名称、图片和描述。

名称存储在 name 属性中。 描述存储在 title 属性中。 img src 存储在 src 属性中。

因此,在单击时,所有这些数据都是从单击的图像中收集的,并且应该在对话框中吐出。

问题是我无法让对话框渲染 FBML,它只是将其显示为纯文本。

这是 FBJS 的一部分:

function showDialog(element) {
    var img_src = element.getFirstChild().getSrc();
    var name = element.getFirstChild().getName();
    var desc = element.getFirstChild().getTitle();
    var msg = '<img src="' + img_src + '" width="160" alt="' + name + '"> ' + desc;
    new Dialog().showMessage(name, msg);
}

以及调用该函数的 FBML:

<a href="#" onclick="showDialog(this);"><img src="http://mydomain.com/path/to/my/image.jpg" border="0" name="myName" title="My Description" width="160"></a>

例如,在本例中,对话框将显示以下纯文本,而不是我试图显示的渲染的 FBML:

<img src="http://mydomain.com/path/to/my/image.jpg" width="160" alt="myName"> My Description

如何获取要渲染的对话框FBML 而不仅仅是纯文本?

I'm working on a facebook page where there is a table of profile images. Onclick for each of these images, I'm using a facebook dialog to show the name, a picture and a description in a popup.

The name is stored in the <img> name attribute.
The description is stored in the <img> title attribute.
The img src is stored in the <img> src attribute.

So onclick, all of this data is gathered from the image that was clicked on and should be spit out in a dialog.

The problem is I can't get the dialog to render FBML, it just shows it as plain text.

Here's a portion of the FBJS:

function showDialog(element) {
    var img_src = element.getFirstChild().getSrc();
    var name = element.getFirstChild().getName();
    var desc = element.getFirstChild().getTitle();
    var msg = '<img src="' + img_src + '" width="160" alt="' + name + '"> ' + desc;
    new Dialog().showMessage(name, msg);
}

and the FBML where the function is called:

<a href="#" onclick="showDialog(this);"><img src="http://mydomain.com/path/to/my/image.jpg" border="0" name="myName" title="My Description" width="160"></a>

For example, in this case the dialog would display the following plain text, rather than the rendered FBML I am trying to display:

<img src="http://mydomain.com/path/to/my/image.jpg" width="160" alt="myName"> My Description

How can I get the dialog to render FBML rather than just plain text?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不打扰别人 2024-09-22 02:25:08

Facebook 开发者页面表示“标题和内容可以是字符串或预渲染的 FBML 块”。我不太确定“预渲染”是什么意思。它可以是 。不幸的是,由于 Facebook 错误(我认为),fb:js-string 在静态 FBML 页面中不起作用。

The Facebook Developer Page says "title and content can be either strings or pre-rendered FBML blocks". I'm not really sure what is meant by "pre-rendered". It could be an <fb:js-string>. Unfortunately the fb:js-string does not work in static FBML pages due to a Facebook bug (I think).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文