I can see two problems with your code -
1. You have not specified a 'scope' with <cms:put> - this is making it use its default setting and set a new variable *within* the local scope (i.e. within the <cms:related_pages ></cms:related_pages > block itself) and not in the array that is defined outside that block.
To make it target the outside array, please set the proper scope ('parent' in this case) as follows
To make sure the array has been populated as expected, use the following (after the <cms:related_pages ></cms:related_pages > block) temporarily to dump its contents -
2. In the code where you are trying to retrieve back the values through <cms:get>, you have used a single-quote to set the tag's parameter -
This will prevent the enclosed <cms:show> from being evaluated and will not result in the correct variable name.
Please change that part to use 'double-quotes' instead e.g. as follows -
Please see https://docs.couchcms.com/concepts/sett ... eters.html if you are unsure about the single-quote/double-quote thing.
With the two changes, I think your code should work as expected.
Do let me know.
1. You have not specified a 'scope' with <cms:put> - this is making it use its default setting and set a new variable *within* the local scope (i.e. within the <cms:related_pages ></cms:related_pages > block itself) and not in the array that is defined outside that block.
To make it target the outside array, please set the proper scope ('parent' in this case) as follows
- Code: Select all
<cms:put "activetags.<cms:show k_page_id />nr" value="active" scope='parent' />
To make sure the array has been populated as expected, use the following (after the <cms:related_pages ></cms:related_pages > block) temporarily to dump its contents -
- Code: Select all
<cms:show activetags as_json='1' />
2. In the code where you are trying to retrieve back the values through <cms:get>, you have used a single-quote to set the tag's parameter -
- Code: Select all
<cms:get 'activetags.<cms:show k_page_id />nr' />
This will prevent the enclosed <cms:show> from being evaluated and will not result in the correct variable name.
Please change that part to use 'double-quotes' instead e.g. as follows -
- Code: Select all
<a class="<cms:get "activetags.<cms:show k_page_id />nr" />" href="<cms:show k_page_link />"><cms:show one_tag /> </a>
Please see https://docs.couchcms.com/concepts/sett ... eters.html if you are unsure about the single-quote/double-quote thing.
With the two changes, I think your code should work as expected.
Do let me know.