seth_w_jackson
I'm new here

Variables in Sitemap Function

Jump to solution

I'm trying to reference a site structure variable within the Navigation function but can't seem to get it to work correctly. I've referenced some other posts but those are working for me either. Here's what I have:

<CMS_HEADER>

<CMS_FUNCTION name="define" resultname="fr_getRoot">

<CMS_VALUE_PARAM name="source" value="ss_storeId" />

</CMS_FUNCTION>

<CMS_FUNCTION name="Navigation" resultname="fr_sitemap">

<CMS_PARAM name="expansionVisibility" value="all"/>

<CMS_PARAM name="siteMap" value="1" />

<CMS_VALUE_PARAM name="root" value="fr_getRoot.toString"/> 

<CMS_PARAM name="suppressEmptyFolders" value="1" />

   <CMS_ARRAY_PARAM name="beginHTML">

<CMS_ARRAY_ELEMENT><![CDATA[

<ul class="sitemap-section__list">

<li class="sitemap-section__list-li">

<a href="#">$CMS_VALUE(#nav.label)$</a>

<ul class="sitemap-section__sublist">

]]></CMS_ARRAY_ELEMENT>

</CMS_ARRAY_PARAM>

<CMS_ARRAY_PARAM name="unselectedHTML">

<CMS_ARRAY_ELEMENT index="0..9"><![CDATA[

<li class="sitemap-section__sublist-li">

<a href="$CMS_REF(#nav.ref)$">

$CMS_VALUE(#nav.label)$

</a>

$CMS_VALUE(fr_getRoot.toString)$

</li>

]]></CMS_ARRAY_ELEMENT>

   </CMS_ARRAY_PARAM>

<CMS_ARRAY_PARAM name="selectedHTML">

<CMS_ARRAY_ELEMENT index="0..9"><![CDATA[

<li class="sitemap-section__sublist-li">

<a href="$CMS_REF(#nav.ref)$">

$CMS_VALUE(#nav.label)$

</a>

$CMS_VALUE(fr_getRoot.toString)$

</li>

]]></CMS_ARRAY_ELEMENT>

</CMS_ARRAY_PARAM>

<CMS_ARRAY_PARAM name="endHTML">

<CMS_ARRAY_ELEMENT><![CDATA[

</ul>

</li>

</ul>

]]></CMS_ARRAY_ELEMENT>

</CMS_ARRAY_PARAM>

</CMS_FUNCTION>

</CMS_HEADER>

$CMS_TRIM(level:4)$

<div class="main-content__body">

<div class="content-main__wrapper">

<div class="sitemap-section">

<h2 class="site-sitemap__title">Sitemap</h2>

<button type="button" class="site-sitemap__mobile-toggle js-accordion--expandable">Sitemap</button>

<div class="sitemap-section__cols js-visuallyhidden clearfix"> 

<div class="sitemap-section__list">

$CMS_VALUE(fr_sitemap)$

</div>

</div>

</div>

</div>

</div>

$CMS_END_TRIM$

1 Solution

Accepted Solutions
seth_w_jackson
I'm new here

I found the solution.

Instead of using a CMS_VALUE_PARAM, I used the following:

<CMS_CDATA_PARAM name="root"><![CDATA[pagefolder:$CMS_VALUE(ss_storeId)$]]></CMS_CDATA_PARAM>

Not sure why the function didn't work though.

View solution in original post

1 Reply
seth_w_jackson
I'm new here

I found the solution.

Instead of using a CMS_VALUE_PARAM, I used the following:

<CMS_CDATA_PARAM name="root"><![CDATA[pagefolder:$CMS_VALUE(ss_storeId)$]]></CMS_CDATA_PARAM>

Not sure why the function didn't work though.