I was able to create a .js array file from CMS that contains content needed to build a hierarchal tree menu. From this array, I needed to create an array that the tree menu uses to populate itself.
This is the .js file that comes from CMS. (below is what it needs to look like).
Also, some rules to help.
Rules
remove #p242_2393 framgments where the classes = chap or ahead. +-
if a chap has no ahead or bhead following it then we need to add {format:{isFolder:true}} (see introduction)
Also, notice the brakets ] and when they should or shouldn't close. Like if Ahead has B head you keep the Ahead open and close after bhead.
The highest level of the tree is bhead within Ahead, we don't need ahead under any bhead.
var pcor_sections = [ 0
,'<p class="chap"><a href="chf-ES.htm#P6_36" target="_top">Executive Summary</a></p>'
,'<p class="ahead"><a href="chf-ES-cmc-00.htm#P52_1438" target="_top">What are the key parameters of the CHF market?</a></p>'
,'<p class="chap"><a href="Pharmacor-Chapter-Head.htm#P89_11313" target="_top">Introduction</a></p>'
,'<p class="chap"><a href="CHF-EP-cmc.htm#P210_16143" target="_top">Etiology and Pathophysiology </a></p>'
,'<p class="ahead"><a href="CHF-EP-cmc-02.htm#P242_29404" target="_top">Etiology</a></p>'
,'<p class="bhead"><a href="CHF-EP-cmc-02.htm#P13_3767" target="_top">Causes of Chronic Heart Failure</a></p>'
,'<p class="bhead"><a href="CHF-EP-cmc-02.htm#P18_5924" target="_top">Clinical Characterization of Chronic Heart Failure</a></p>'
,'<p class="ahead"><a href="epi-mock-up-cmc-03.htm#P62_16890" target="_top">United States</a></p>'
,'<p class="chap"><a href="chf-ct.htm" target="_top">Current Therapies</a></p>'
,'<p class="ahead"><a href="chf-ct-cmc-00.htm" target="_top">Diuretics</a></p>'
];
Needs to be exactly like this…
var TREE_NODES = [
f(["Executive Summary", "chf-ES.htm", null,
f(["What are the key parameters of the CHF market?", "chf-ES-cmc-00.htm", null]),
]),
f(["Introduction", "Pharmacor-Chapter-Head.htm", null,{format:{isFolder:true}}]),
f(["Etiology & Pathophysiology", "CHF-EP-cmc.htm", null,
f(["Etiology", "CHF-EP-cmc-02.htm", null,
f(["Causes of Chronic Heart Failure", "CHF-EP-cmc-02.htm#P13_3767", null]),
f(["Clinical Characterization of Chronic Heart Failure", "CHF-EP-cmc-02.htm#P18_5924", null])
]),
f(["United States", "epi-mock-up-cmc-03.htm#P62_16890", null]),
]),
f(["Current Therapies", "chf-ct.htm", null,
f(["Diuretics", "chf-ct-cmc-00.htm", null]),
]),
];
This is the .js file that comes from CMS. (below is what it needs to look like).
Also, some rules to help.
Rules
remove #p242_2393 framgments where the classes = chap or ahead. +-
if a chap has no ahead or bhead following it then we need to add {format:{isFolder:true}} (see introduction)
Also, notice the brakets ] and when they should or shouldn't close. Like if Ahead has B head you keep the Ahead open and close after bhead.
The highest level of the tree is bhead within Ahead, we don't need ahead under any bhead.
var pcor_sections = [ 0
,'<p class="chap"><a href="chf-ES.htm#P6_36" target="_top">Executive Summary</a></p>'
,'<p class="ahead"><a href="chf-ES-cmc-00.htm#P52_1438" target="_top">What are the key parameters of the CHF market?</a></p>'
,'<p class="chap"><a href="Pharmacor-Chapter-Head.htm#P89_11313" target="_top">Introduction</a></p>'
,'<p class="chap"><a href="CHF-EP-cmc.htm#P210_16143" target="_top">Etiology and Pathophysiology </a></p>'
,'<p class="ahead"><a href="CHF-EP-cmc-02.htm#P242_29404" target="_top">Etiology</a></p>'
,'<p class="bhead"><a href="CHF-EP-cmc-02.htm#P13_3767" target="_top">Causes of Chronic Heart Failure</a></p>'
,'<p class="bhead"><a href="CHF-EP-cmc-02.htm#P18_5924" target="_top">Clinical Characterization of Chronic Heart Failure</a></p>'
,'<p class="ahead"><a href="epi-mock-up-cmc-03.htm#P62_16890" target="_top">United States</a></p>'
,'<p class="chap"><a href="chf-ct.htm" target="_top">Current Therapies</a></p>'
,'<p class="ahead"><a href="chf-ct-cmc-00.htm" target="_top">Diuretics</a></p>'
];
Needs to be exactly like this…
var TREE_NODES = [
f(["Executive Summary", "chf-ES.htm", null,
f(["What are the key parameters of the CHF market?", "chf-ES-cmc-00.htm", null]),
]),
f(["Introduction", "Pharmacor-Chapter-Head.htm", null,{format:{isFolder:true}}]),
f(["Etiology & Pathophysiology", "CHF-EP-cmc.htm", null,
f(["Etiology", "CHF-EP-cmc-02.htm", null,
f(["Causes of Chronic Heart Failure", "CHF-EP-cmc-02.htm#P13_3767", null]),
f(["Clinical Characterization of Chronic Heart Failure", "CHF-EP-cmc-02.htm#P18_5924", null])
]),
f(["United States", "epi-mock-up-cmc-03.htm#P62_16890", null]),
]),
f(["Current Therapies", "chf-ct.htm", null,
f(["Diuretics", "chf-ct-cmc-00.htm", null]),
]),
];