简体   繁体   English

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

[英]Render FBML in Facebook Dialog Popup

I'm working on a facebook page where there is a table of profile images. 我正在一个Facebook页面上,那里有一张个人资料图片表。 Onclick for each of these images, I'm using a facebook dialog to show the name, a picture and a description in a popup. 对于每个图像的onclick,我正在使用一个Facebook对话框在弹出窗口中显示名称,图片和描述。

The name is stored in the <img> name attribute. 该名称存储在<img> name属性中。 The description is stored in the <img> title attribute. 描述存储在<img> title属性中。 The img src is stored in the <img> src attribute. img src存储在<img> src属性中。

So onclick, all of this data is gathered from the image that was clicked on and should be spit out in a dialog. 因此,onclick时,所有这些数据都是从单击的图像中收集的,应该在对话框中吐出。

The problem is I can't get the dialog to render FBML, it just shows it as plain text. 问题是我无法获得呈现FBML的对话框,它只是将其显示为纯文本。

Here's a portion of the FBJS: 这是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: 以及调用该函数的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>

For example, in this case the dialog would display the following plain text, rather than the rendered FBML I am trying to display: 例如,在这种情况下,对话框将显示以下纯文本,而不是我尝试显示的呈现的FBML:

<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? 如何获取对话框来呈现FBML而不是纯文本?

The Facebook Developer Page says "title and content can be either strings or pre-rendered FBML blocks". Facebook开发人员页面说:“标题和内容可以是字符串,也可以是预渲染的FBML块”。 I'm not really sure what is meant by "pre-rendered". 我不太确定“预渲染”是什么意思。 It could be an <fb:js-string> . 可能是<fb:js-string> Unfortunately the fb:js-string does not work in static FBML pages due to a Facebook bug (I think). 不幸的是,由于Facebook错误,fb:js-string在静态FBML页面中不起作用(我认为)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM