The Tagger Module has an API available to other modules, so if you're building a DNN Module and want to create tags with that module, then you're in luck.
The API works using the 'IModuleCommunicator' interface in DotNetNuke, which is a way of letting two modules on the same DNN page talk to each other through a programming interface.
The tagger module is already set up as a 'listener', but you need to define your 'sender' module.
Here's how to do it, in code. All this code should be in the page-behind code of your Module, on the page where the 'save' action is - the point at which you know you want to set up some tags for the page.
//handler
public event ModuleCommunicatioEventHandler ModuleCommunication;
Then create a function to save the tags for the current page - normally located in the page-behind code for the control that is doing the 'saving'. You'll need to reference 'iFinity.Tagger.dll' in your code to get an early-bound call.
private void SaveTags(NameValueCollection queryString)
{
string header, line1, line2;
List<string> tags;
//get your tags
tags = <YourLogicToSetTheTags>
// now set the header, line1 and line2 to show information about this
// page when it shows in the tag list
header = <YourLogicToDecideTheTagHeader>
line1 = <YourLogicToDecideTheFirstLine>
line2 = <YourLogicToDecideTheSecondLine>
TaggerModuleOptions options = new TaggerModuleOptions(tags.ToArray(), this.PortalId, true, queryString, TagSummaryDataAction.ForceOverwriteHeaderOnly, header, line1, line2);
TaggerModuleCommunicationEventArgs args = new TaggerModuleCommunicationEventArgs(options, this.GetType().ToString(), TagTarget.ModuleTags);
if (ModuleCommunication != null)
ModuleCommunication(this, args);}
This code would be called somethign like this :
private void cmdSave_Click(object sender, eventargs e)
{
//save my stuff
Save();
//tag my stuff
SaveTags(Request.QueryString);
}
It looks quite complicated but is actually pretty simple.