Socialid.templateCache.put
From Social ID Developers
Contents |
Description
Inserts or replaces a HTML template into the cache, for automatic use with render methods.
Usage
socialid.templateCache.put(templateName, templateHtml, safe)
Parameters
templateName | required | name of the template. | templateHtml | required | template in HTML format. | safe | optional | boolean indicating if the template shouldn't replace an existing one. Default: false. |
---|
List of Comments & Reviews template names
comments_badge_login | User badge for the post creation area when user is logged out. | comments_badge_login_popover | Login and popover button for the post creation area when user is logged out. | comments_badge_logout | User badge for the post creation area when user is logged in. | comments_create_comment | Post creation area (Comments widget). | comments_create_review | Post creation area (Ratings & Reviews widget). | comments_form_comment | Post creation form (Comments widget). | comments_form_login_popover | Login and popover button for the post creation form when user is logged out. | comments_form_review | Post creation form (Ratings & Reviews widget). | comments_post_comment | Single post display (Comments widget). | comments_post_review | Single post display (Ratings & Reviews widget). | comments_share_popover | Popover button for sharing dialog. | comments_widget | Widget main container. |
---|
Example
Replaces a template from the cache:
var templateName = "comments_post_comment";; var templateHtml = "<div><span>{{comment}}</span></div>"; socialid.templateCache.put(templateName, templateHtml);
Inserts a template into the cache only if a template with the same name doesn't exist:
var templateName = "comments_new_post_comment";; var templateHtml = "<div><span>{{comment}}</span></div>"; socialid.templateCache.put(templateName, templateHtml, true);