Search the FirstSpirit Knowledge Base
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:
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
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
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
Hi Felix,
No. So basically, I have something like this:
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
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
Hi Felix,
Thank you very much. That is very good.
Best regards,
Dragan