gigya~评论插件〜默认模板?

时间:2012-01-24 20:16:37

标签: templates gigya

根据gigya Comments plugin developer documentation ..

  

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

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

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

1 个答案:

答案 0 :(得分:1)

你可以在这个例子中看到

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

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

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);