0

根据 gigya评论插件开发者文档..

模板是插件中一组相关图形元素的布局定义。该插件包括五个可自定义的模板。您可以为每个模板分配一个重新定义其图形布局的 HTML 字符串。socialize.showCommentsUI 方法的 'templates' 参数接收具有以下字段的对象:

  • 评论
  • 评论框
  • loginCanvas_loggedIn
  • loginCanvas_loggedIn_guest
  • loginCanvas_loggedOut
每个字段都是一个可自定义的模板。每个字段都有一个您可以覆盖的默认值。在下面的 ...

这些模板的默认值是什么?

4

1 回答 1

1

如您在此示例中所见:

http://wikifiles.gigya.com/Socialize/CommentsUI_Example_Templates.htm

您只需构建 html 模板,将它们分配给 json 对象并将它们作为参数的一部分传递给 gigya 注释函数:

var templates = {

    commentBox: '<span style="color:blue;">This is the Login Canvas: </span><br>$loginCanvas<br><br>' +

                '<span style="color:blue;">This is the Close Icon: </span>$closeIcon<br>' +

                '<span style="color:blue;">This is the Add Comment text box: </span>$addComment',

    comment:'Hello!<br>' +

            '<span style="color:blue;">This is the username: </span>$username<br>' +

            '<span style="color:blue;">This is the Photo Div: </span>$photoDiv<br><br><br>' +

            '<span style="color:blue;">This is the Date String: </span>$dateString<br>' +

            '<span style="color:blue;">This is the Comment Body: </span>$body<br>' +

            '<span style="color:blue;">This is the Replies Count: </span>$repliesCountPlaceholder<br>' +

            '<span style="color:blue;">This is the Reply Button: </span>$replyButton<br><br>' +

            '<span style="color:blue;">This is the Flagging option: </span>$flag<br>' +

            '<span style="color:blue;">This is the Voting option: </span>$vote<br><br>',

    loginCanvas_loggedIn: '<span style="color:blue;">Login Canvas - Logged in state! </span><br>$photoDiv<br>$username<br>$logoutLink',

    loginCanvas_loggedIn_guest: '<span style="color:blue;">Login Canvas - Guest user state! </span><br>$photoDiv<br>$username<br>$logoutLink',

    loginCanvas_loggedOut: '<span style="color:blue;">Login Canvas - Logged Out state!<br></span>$photoDiv<br>$loginDropdown<br>$guestDropdown'

}



var params =

{

    // Required parameters:

    categoryID: 7623701,

    containerID: 'commentsDiv',



    // Optional parameters:

    templates: templates,

    streamID: 'foo6',

    cid: ''

}

// Load the Comments Plugin

gigya.socialize.showCommentsUI(params);
于 2012-06-18T05:42:22.793 回答