Design Themes Modification When Updating from CNCat 4.1.2 to CNCat 4.1.3
item.tpl
Modifications:
Ability to display additional fields has been added.
New Elements:
- {DISPLAY EXTFIELDS} – place to display expanded fields. It uses item_ext_field template (see below).
- Template item_ext_field
- $CNCAT[extfield][type] – field type (1 - int, 2 - double, 3 - varchar(255), 4 - datetime, 5 – text)
- $CNCAT[extfield][title] – field name
- $CNCAT[extfield][value] – field value
Apply Modifications:
- Insert the code for displaying additional fields into the item template:
{DISPLAY EXTFIELDS}
for example, you can insert it below the following code:
<tr><td colspan="1" class="url">
{IF $CNCAT[config][links_broken_notify]}
{cn_str($CNCAT[item][link_url])} <a href="javascript:baditem('{$CNCAT[item][item_id]}')" title="{$CNCAT[lang][broken_notify]}"><img src="{$THEMEURL}images/badlink.gif" alt="{$CNCAT[lang][broken_notify]}" /></a>
{ENDIF}
</td></tr>
- Add the template for displaying expanded fields. This template is one and the same for links and articles. To do this, above the following code line:
{TEMPLATE admin_rating_top}{/TEMPLATE}
insert code
<!--
1 - int,
2 - double,
3 - varchar(255),
4 - datetime,
5 - text
-->
{TEMPLATE item_ext_field}
{IF $CNCAT[extfield][type] == 1 || $CNCAT[extfield][type] == 2}
{IF is_numeric($CNCAT[extfield][value])}
<tr><td></td><td colspan="2">{cn_str($CNCAT[extfield][title])}: {cn_str($CNCAT[extfield][value])}</td></tr>
{ENDIF}
{ELSE}
{IF $CNCAT[extfield][value]}
{IF $CNCAT[extfield][type] == 3}
<tr><td></td><td colspan="2">{cn_str($CNCAT[extfield][title])}: {cn_str($CNCAT[extfield][value])}</td></tr>
{ENDIF}
{IF $CNCAT[extfield][type] == 4}
<tr><td></td><td colspan="2">{cn_str($CNCAT[extfield][title])}: {cn_date($CNCAT[extfield][value])}</td></tr>
{ENDIF}
{IF $CNCAT[extfield][type] == 5}
<tr><td></td><td colspan="2">{cn_str($CNCAT[extfield][title])}: {cn_str($CNCAT[extfield][value])}</td></tr>
{ENDIF}
{ENDIF}
{ENDIF}
{/TEMPLATE}