draganr
I'm new here

How to get a format template name that is used in a table cell

Jump to solution

Hi all,

Is it possible to get the name of a format template, or a reference name, that is used inside a cell in a table template?

      <CMS_INPUT_DOMTABLE name="st_table" hFill="yes" height="10" useLanguages="yes">

        <FORMATS>

          <TEMPLATE name="table"/>

          <TEMPLATE name="table_icon"/>

        </FORMATS>

        <LANGINFOS>

          <LANGINFO lang="*" label="Table" description="Fill the table with your data."/>

          <LANGINFO lang="DE" label="Tabelle" description="Befüllen Sie die Tabelle mit Daten."/>

        </LANGINFOS>

        <LINKEDITORS>

          <LINKEDITOR name="lt_link"/>

        </LINKEDITORS>

      </CMS_INPUT_DOMTABLE>

so i used table_icon inside a cell:

219610_pastedImage_1.png

i get the value through the

$CMS_VALUE(#content)$


But i want to export "table_icon" to my HTML as well.


Something like #content.formatTemplateNameThatIsUsedForACell

Is it possible?

Kind regards,

Dragan

0 Kudos
1 Solution

Accepted Solutions
felix_reinhold
Returning Responder

Hi Dragan,

I don't know if a good approach exists for this case.

If I need get information from childnodes in a dom I do it like this:

td-template:

$CMS_SET(set_iconClass,"")$

$CMS_SET(set_content)$

$CMS_VALUE(#content)$

$CMS_END_SET$

$CMS_SET(set_content, set_content.toString())$

<td$--

     --$$CMS_VALUE(if(set_iconClass != "", " class='" + set_iconClass + "'"))$$--

--$>$--

     --$$CMS_VALUE(set_content)$$--

--$</td>

In template table_icon:

$CMS_SET(set_iconClass,"is-icon")$

$-- then your normal html-output for the icon: --$

<span class="icon">ICON</span>

Basically I'm prerendering the contents and I provide a variable that can be used by the child-nodes.

Best regards

Felix

View solution in original post

0 Kudos
4 Replies
felix_reinhold
Returning Responder

Hello Dragan,

I don't know if I really undertood what you need, but can't you just do what you want to do by editing the table_icon Formattemplate?

Just adjust the html channel of the template to generate an output of the table_icon.

Best regards

Felix

0 Kudos

Hi Felix,

No. So basically, I have something like this:

221140_pastedImage_0.png

And then, because I used that format template table_icon I need to add to the TD tag the following class: -is-icon

I have found out the following this morning:

$CMS_IF(#content.toString().indexOf("a-icon") > 0)$ -is-icon$CMS_END_IF$

Is that a good approach? Or if there is another one?

Regards,

Dragan

0 Kudos
felix_reinhold
Returning Responder

Hi Dragan,

I don't know if a good approach exists for this case.

If I need get information from childnodes in a dom I do it like this:

td-template:

$CMS_SET(set_iconClass,"")$

$CMS_SET(set_content)$

$CMS_VALUE(#content)$

$CMS_END_SET$

$CMS_SET(set_content, set_content.toString())$

<td$--

     --$$CMS_VALUE(if(set_iconClass != "", " class='" + set_iconClass + "'"))$$--

--$>$--

     --$$CMS_VALUE(set_content)$$--

--$</td>

In template table_icon:

$CMS_SET(set_iconClass,"is-icon")$

$-- then your normal html-output for the icon: --$

<span class="icon">ICON</span>

Basically I'm prerendering the contents and I provide a variable that can be used by the child-nodes.

Best regards

Felix

0 Kudos

Hi Felix,

Thank you very much. That is very good.

Best regards,

Dragan

0 Kudos