Forum Discussion

bhakti's avatar
bhakti
Guide
7 years ago

How to pass user defined parameters to text key?

Hi all,

when I am passing user defined value to text key I am getting null value.

for example:

<#assign responseCat=rest('/categories/id/${catID}?restapi.format_detail=full_list_element&restapi.response_style=view').category/>
<#assign catIdTitle=responseCat.title/>
<#assign catHref=responseCat.@view_href/>           
<li id="product-category-link" title="${text.format("product-category-navigation",catIdTitle)}">
   <a href="${catHref}">${text.format("product-category-navigation",catIdTitle)}</a>
</li>

Is there any other way to pass parameter to text key??

 

Thanks,

Bhakti.

  • bhakti -  Below is the updated code which is working fine now. 

     

    <#assign responseCat=rest('/categories/id/${catID}?restapi.format_detail=full_list_element&restapi.response_style=view').category/>
    <#assign catIdTitle=responseCat.title/>
    <#assign catHref=responseCat.@view_href/>           
    <li id="product-category-link" title="${text.format('product-category-navigation','${catIdTitle}')}">
       <a href="${catHref}">${text.format('product-category-navigation','${catIdTitle}')}</a>
    </li>

     

    • bhakti's avatar
      bhakti
      Guide

      I have created following text key

      product-category-navigation = Back to {0} Category

      Expected result:

      Back to [category_name] Category

       

      Thanks,

      Bhakti

      • bhakti -  Below is the updated code which is working fine now. 

         

        <#assign responseCat=rest('/categories/id/${catID}?restapi.format_detail=full_list_element&restapi.response_style=view').category/>
        <#assign catIdTitle=responseCat.title/>
        <#assign catHref=responseCat.@view_href/>           
        <li id="product-category-link" title="${text.format('product-category-navigation','${catIdTitle}')}">
           <a href="${catHref}">${text.format('product-category-navigation','${catIdTitle}')}</a>
        </li>