Issue
I want to create keywords in HelpNDoc using api script editor. But, I could not find how to define parameter of function HndKeywords.CreateKeyword
. Without passing any value to function, it create New keyword. But, I want to set text, href
and data-related
object informations.
HndKeywords.CreateKeyword;
Output:_keywords.json
[{ "id": "B3BF561185624A4685FB01E93FE5ED87", "parent" : "#", "text": "New keyword", "a_attr": {"href": "#", "data-related": "[]"} }]
Solution
I found that, there is no way to add caption and data-related information when we are creating the keyword.
function SetKeywordCaption(const aKeywordId: string; const sNewCaption: string): string; function AssociateTopicWithKeyword(const aTopicId: string; const aKeywordId:string): Boolean;
In order to edit the keyword caption, I have to use the function SetKeywordCaption
, which needs keyword id. For that, I get the keyword list using function GetKeywordList();
and it returns an array. I get the last element numeric id from that array which is a newly inserted keyword. Then, access the aKeywordList
array using last element array id and add .Id
which will retrieve id of that keyword. Then, Using keyword id with function SetKeywordCaption
, able to edit keyword caption.
In order to add data-related information, I have use function AssociateTopicWithKeyword
which needs the topic id
and keyword id
. I get topic list using function GetTopicList
. I get topic id of five(topic_array[(5-1)].ID
) and sixth topic(topic_array[(6-1)].ID
). Then, have used function AssociateTopicWithKeyword
to link keyword to topics.
Call helpndoc function:
Object.function
ex (HndKeywords.CreateKeyword;
)
var new_keyword :=HndKeywords.CreateKeyword;
var aKeywordList =HndKeywords.GetKeywordList() ;
//get keyword added last
var newlyaddedkeyword_array_id =length(aKeywordList) - 1 ;
var newlyaddedkeyword__id =aKeywordList[newlyaddedkeyword_array_id].Id;
var edit_keywordcaption =HndKeywords.SetKeywordCaption(newlyaddedkeyword__id, "Edited keyword");
var topic_array=HndTopics.GetTopicList;
var keywordtopics =HndTopicsKeywords.AssociateTopicWithKeyword(topic_array[4].ID,newlyaddedkeyword__id);//parameter : topic id and keyword id
var keywordtopics2 =HndTopicsKeywords.AssociateTopicWithKeyword(topic_array[5].ID,newlyaddedkeyword__id);
See: HndKeywords
- Properties and methods for keywords
Answered By - Premlatha Answer Checked By - Marie Seifert (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.