Tag and rate for static pages


Overview

To add tagging or rating to static pages, you add the tagging or rating widget to the HTML code.

the following examples show how you add tagging and rating to static pages.


Add the widgets programmatically

The following example shows how you integrate tag and rating widgets to programming code:

<div>
    <script type="text/javascript">
 
   // Create inline widgets programmatically
      function showInlineTagWidget(uri, title, domNode)
      {
          var widget = new com.ibm.widgets.InlineTag({resourceID: uri, resourceTitle: title});
          dojo.place(widget.domNode, domNode, "last");
          return true;
      }
 
      function showInlineRatingWidget(uri, title, domNode)
      {
          var widget = new com.ibm.widgets.InlineRating({resourceID: uri, resourceTitle: title});
          dojo.place(widget.domNode, domNode, "last");
          return true;
      }
 
      showInlineTagWidget("mycustomcontent:001", "MyCustomContent 001", dojo.byId("inlineTagWidget"));
      showInlineRatingWidget("mycustomcontent:002", "MyCustomContent 001", dojo.byId("inlineTagWidget"));
  
   // Create dialog widget programmatically
      function showTagWidget(uri, title)
      {
          var widget = new com.ibm.widgets.AddTag({resourceID: uri, resourceTitle: title});
          return true;
      } 
 
   // Create dialog widget programmatically
      function showRatingWidget(uri, title)
      {
          var widget = new com.ibm.widgets.AddRating({resourceID: uri, resourceTitle: title});
          return true;
      }   
 
</script>
 
 
<!-- Programmatic approach for including the dialog widgets -->
     Some content to be tagged and rated goes here...
     <a href="#" onClick="javascript:showTagWidget('mycustomcontent:001', 'MyCustomContent 002');">Tag</a>
     <a href="#" onClick="javascript:showRatingWidget('mycustomcontent:002', 'MyCustomContent 002');">Rate</a>
     <br/><br/>
 
<!-- Programmatic approach for including the inline widgets -->
     Some content to be tagged and rated goes here...
     <div id="inlineTagWidget"/>
     <div id="inlineRatingWidget"/>
 
</div>


Add the widgets declaratively

The following example shows how you integrate an inline tag and rating widgets by declaration:

<!-- Declarative approach for including the inline widgets -->
     Some content to be tagged and rated goes here...
 
     <script type="text/javascript">
     dojo.addOnLoad(function()
          {
               dojo.forEach( ["inlineWidgets"], dojo.parser.parse, dojo.parser);
          });
     </script>
 
     <div id="inlineWidgets">
          <div dojoType="com.ibm.widgets.InlineTag" resourceId="mycustomuri:003" 
               resourceTitle="MyCustomContent 003" displayTwisty="expanded"></div>	
          <div dojoType="com.ibm.widgets.InlineRating" resourceId="mycustomuri:003" 
               resourceTitle="MyCustomContent 003" displayTwisty="expanded"></div>	
     </div>


Parent

Tagging and rating
Search for tagged content
How tagging and rating works in the portal
The tagging and rating user interface
Allow own custom content to be tagged and rated
Configuration reference
Security for tagging and rating
Use xmlaccess.sh to administer tags and ratings
Hints and tips for tagging and rating

 


+

Search Tips   |   Advanced Search