sivaprasad9394
Occasional Collector

How to get the label value of the inpage navigation templates added?

Jump to solution

Hello ,

I would like to get the label for the components added in the section.?

Server version: 5.2.2109

$CMS_SET(renderTocEntry)$

    $CMS_IF(set_headline != null && !set_headline.isEmpty)$

        <li>

            <a href="#$CMS_VALUE(pageSection.id)$" class="A-11-001_Links_PrimaryLink_normal dark_blue$--

            --$$CMS_IF(tocCounter == 0)$$--

                --$ linkFirst$--

            --$$CMS_END_IF$$--

            --$">$CMS_VALUE(set_headline.convert2)$</a>

        </li>

        $CMS_SET(tocCounter, tocCounter + 1)$

        $CMS_SET(set_headline, null)$

    $CMS_END_IF$                       

$CMS_END_SET$

$CMS_SET(tocCounter, 0)$

                           

$CMS_FOR(section, pt_toc)$

    $CMS_FOR(pageSection, #global.page.children(class("de.espirit.firstspirit.access.store.pagestore.Section"), true))$

        $CMS_IF(section.uid.equals(pageSection.name))$

        $-- TESTING:$CMS_VALUE(section.label)$ --$ -- THIS ONE WORKS AND DISPLAYS LABEL

        $-- $CMS_SET(set_headline, pageSection.displayName(#global.language))$ --$

        $CMS_SET(set_headline, pageSection.label)$ -- NOT WORKING

        $--$CMS_SET(set_headline)$$CMS_VALUE(section.label, default: section.label)$$CMS_END_SET$--$ -- NOTWORKING

        $CMS_VALUE(renderTocEntry, default:"")$                                       

            $CMS_SET(void, #for.BREAK)$

        $CMS_END_IF$

    $CMS_END_FOR$

$CMS_END_FOR$

label.png

Thank you,

Regards,

Siva

0 Kudos
1 Solution

Accepted Solutions
felix_reinhold
Returning Responder

Hello SIva,

I don't really understand your problem because you already have the working code in your example. If you want to display the label defined in the FS_LIST use section.label, if you want to use the displayname of the section then use pageSection.getDisplayName(language):

Sets the headline to the label defined in the FS_LIST              

$CMS_FOR(section, pt_toc)$

    $CMS_FOR(pageSection, #global.page.children(class("de.espirit.firstspirit.access.store.pagestore.Section"), true))$

      $CMS_IF(section.uid.equals(pageSection.name))$

        $CMS_SET(set_headline, section.label)$

        $CMS_VALUE(renderTocEntry, default:"")$                                        

            $CMS_SET(void, #for.BREAK)$

        $CMS_END_IF$

    $CMS_END_FOR$

$CMS_END_FOR$

Sets the headline to the display-name of the section:

$CMS_FOR(section, pt_toc)$

    $CMS_FOR(pageSection, #global.page.children(class("de.espirit.firstspirit.access.store.pagestore.Section"), true))$

      $CMS_IF(section.uid.equals(pageSection.name))$

        $CMS_SET(set_headline, pageSection.displayName(#global.language))$

        $CMS_VALUE(renderTocEntry, default:"")$                                        

            $CMS_SET(void, #for.BREAK)$

        $CMS_END_IF$

    $CMS_END_FOR$

$CMS_END_FOR$

Both works for me.

Best regards

Felix

View solution in original post

0 Kudos
2 Replies
felix_reinhold
Returning Responder

Hello SIva,

I don't really understand your problem because you already have the working code in your example. If you want to display the label defined in the FS_LIST use section.label, if you want to use the displayname of the section then use pageSection.getDisplayName(language):

Sets the headline to the label defined in the FS_LIST              

$CMS_FOR(section, pt_toc)$

    $CMS_FOR(pageSection, #global.page.children(class("de.espirit.firstspirit.access.store.pagestore.Section"), true))$

      $CMS_IF(section.uid.equals(pageSection.name))$

        $CMS_SET(set_headline, section.label)$

        $CMS_VALUE(renderTocEntry, default:"")$                                        

            $CMS_SET(void, #for.BREAK)$

        $CMS_END_IF$

    $CMS_END_FOR$

$CMS_END_FOR$

Sets the headline to the display-name of the section:

$CMS_FOR(section, pt_toc)$

    $CMS_FOR(pageSection, #global.page.children(class("de.espirit.firstspirit.access.store.pagestore.Section"), true))$

      $CMS_IF(section.uid.equals(pageSection.name))$

        $CMS_SET(set_headline, pageSection.displayName(#global.language))$

        $CMS_VALUE(renderTocEntry, default:"")$                                        

            $CMS_SET(void, #for.BREAK)$

        $CMS_END_IF$

    $CMS_END_FOR$

$CMS_END_FOR$

Both works for me.

Best regards

Felix

0 Kudos

Hello Felix,

Thank you for your reply. Yea Its something like caching issue.

$CMS_SET(set_headline, section.label)$ works fine.

Regards,

Siva

0 Kudos