Приветствую, помогите решить задачку:
$idlink = '{id}'; // здесь данные вставляются в переменную из json
$idcalc = $idlink + 3;
echo $idcalc;
Страница шаблона:
<?php
/*
* ------------------------------------------------------------------------
* JA Filter Plugin - Docman
* ------------------------------------------------------------------------
* Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
* @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
* Author: J.O.O.M Solutions Co., Ltd
* Websites: http://www.joomlart.com - http://www.joomlancers.com
* This file may not be redistributed in whole or significant part.
* ------------------------------------------------------------------------
*/
defined('_JEXEC') or die;
?>
{#data}
<div class="item product product-item">
<div data-container="product-grid" onclick="window.location='{url}';" class="product-item-info {?thumbnail}{:else} no-image {/thumbnail} {@eq key=featured value="1"} featured {/eq}">
<div class="product-item-details item-{id}" data-id="{id}">
{@info:data}
<div class="row {._class} {render_class}">
{?.key}<div class="col-md-6 {label_render_class}">{.key}</div>{/.key}
<div class="col-md-{?.key}6{:else}12{/.key} {.val_class}">
{@select key=._class}
{@eq value="name"}
<h4 class="product-item-name">
<a href="{url}" class="product-item-link">
<span class="k-icon-document-{icon|s}"> </span>
{name|s}
</a>
</h4>
{/eq}
{@eq value="thumb"}
<?
$idlink = '{id}'; // здесь данные вставляются в переменную из json
$idcalc = $idlink + 3;
echo $idcalc;
?>
{/eq}
{@eq value="desc"}
{desc|s}
{/eq}
{@eq value="author"}
{?ucf.avatar}
<img src="<?php echo JUri::base(true) ?>/{ucf.avatar}" />
{:else}
{.value|s}
{/ucf.avatar}
{/eq}
{@none}
{.value|s}
{/none}
{/select}
</div>
</div>
{/info}
</div>
<div class="product-item-actions">
<a class="btn btn-default" href="{url}"><?php echo JText::_('COM_JAMEGAFILTER_VIEW_DETAIL'); ?></a>
</div>
</div>
</div>
{/data}
Сам JSON:
{"item_57":{"id":"57","lang":"ru-RU","hits":0,"name":"\u041a\u0432\u0430\u0440\u0442\u0438\u0440\u0430 \u0434\u0432\u0443\u0448\u043a\u0430","thumbnail":"","desc":"5 rooms, 2 bathrooms, garage, door, window.High quality design near be sea. ","url":"\/items\/apartments\/15-alaniya\/center\/57-kvartira-dvushka","attr":{"name":{"frontend_value":"\u041a\u0432\u0430\u0440\u0442\u0438\u0440\u0430 \u0434\u0432\u0443\u0448\u043a\u0430","title":["Title"],"type":"value"},"cat":{"value":["15","12"],"frontend_value":["\u0410\u043b\u0430\u043d\u0438\u044f » \u0426\u0435\u043d\u0442\u0440","\u0410\u043b\u0430\u043d\u0438\u044f"],"title":["\u041b\u043e\u043a\u0430\u0446\u0438\u044f"],"type":"dropdown"},"ct6":{"value":"45","frontend_value":"45","title":["Area"],"type":"numberrange"},"ct7":{"value":"30000","frontend_value":"30000","title":["\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c"],"type":"numberrange"},"ct13":{"value":["rent"],"frontend_value":["\u0414\u0430"],"title":["\u0413\u0440\u0430\u0436\u0434\u0430\u043d\u0441\u0442\u0432\u043e"],"type":"dropdown"},"ct18":{"value":["%D0%94%D1%83%D0%BF%D0%BB%D0%B5%D0%BA%D1%81"],"frontend_value":["\u0414\u0443\u043f\u043b\u0435\u043a\u0441"],"title":["\u041a\u043e\u043c\u043d\u0430\u0442\u044b"],"type":"select"},"ct19":{"value":["%D0%92%D0%B8%D0%BB%D0%BB%D0%B0"],"frontend_value":["\u0412\u0438\u043b\u043b\u0430"],"title":["\u0410\u043f\u043f\u0430\u0440\u0442\u0430\u043c\u0435\u043d\u0442\u044b"],"type":"dropdown"},"ct21":{"value":"1542322","frontend_value":"1542322","title":["ID"],"type":"value"},"ct22":{"value":["50.000%20-%20100.000","100.000%20-%20200.000","200.000%20-%20300.000"],"frontend_value":["50.000 - 100.000","100.000 - 200.000","200.000 - 300.000"],"title":["Price"],"type":"dropdown"},"ct26":{"value":["%D0%9D%D0%BE%D0%B2%D0%BE%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0"],"frontend_value":["\u041d\u043e\u0432\u043e\u0441\u0442\u0440\u043e\u0439\u043a\u0430"],"title":["\u0422\u0438\u043f \u0436\u0438\u043b\u044c\u044f"],"type":"dropdown"}},"featured":"1","access":"1","ucf":{"avatar":"images\/joomlart\/team\/item-1.jpg"},"cmt_gallery":{"src":["images\/11\/20210408193043834296329o.jpg","images\/11\/27173286512962220648konak-city-towers-in-alanya (13).jpg"],"class":["",""],"caption":["",""]}},"item_56":{"id":"56","lang":"ru-RU","hits":0,"name":"Vip Room","thumbnail":"images\/mahmutlar-alanya-271356_.jpg","desc":"5 rooms, 2 bathrooms, garage, door, window.High quality design near be sea. ","url":"\/items\/apartments\/41-alaniya\/oba\/56-kvartira-vozle-morya-3","attr":{"name":{"frontend_value":"Vip Room","title":["Title"],"type":"value"},"cat":{"value":["41","12"],"frontend_value":["\u0410\u043b\u0430\u043d\u0438\u044f » \u041e\u0431\u0430","\u0410\u043b\u0430\u043d\u0438\u044f"],"title":["\u041b\u043e\u043a\u0430\u0446\u0438\u044f"],"type":"dropdown"},"ct6":{"value":"65","frontend_value":"65","title":["Area"],"type":"numberrange"},"ct7":{"value":"47000","frontend_value":"47000","title":["\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c"],"type":"numberrange"},"ct13":{"value":["sale"],"frontend_value":["\u041d\u0435\u0442"],"title":["\u0413\u0440\u0430\u0436\u0434\u0430\u043d\u0441\u0442\u0432\u043e"],"type":"dropdown"},"ct18":{"value":["2%2B1","3%2B1","%D0%94%D1%83%D0%BF%D0%BB%D0%B5%D0%BA%D1%81"],"frontend_value":["2+1","3+1","\u0414\u0443\u043f\u043b\u0435\u043a\u0441"],"title":["\u041a\u043e\u043c\u043d\u0430\u0442\u044b"],"type":"select"},"ct19":{"value":["%D0%A0%D0%B5%D0%B7%D0%B8%D0%B4%D0%B5%D0%BD%D1%86%D0%B8%D1%8F"],"frontend_value":["\u0420\u0435\u0437\u0438\u0434\u0435\u043d\u0446\u0438\u044f"],"title":["\u0410\u043f\u043f\u0430\u0440\u0442\u0430\u043c\u0435\u043d\u0442\u044b"],"type":"dropdown"},"ct21":{"value":"1456456","frontend_value":"1456456","title":["ID"],"type":"value"},"ct22":{"value":["200.000%20-%20300.000"],"frontend_value":["200.000 - 300.000"],"title":["Price"],"type":"dropdown"},"ct26":{"value":["%D0%9D%D0%BE%D0%B2%D0%BE%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0"],"frontend_value":["\u041d\u043e\u0432\u043e\u0441\u0442\u0440\u043e\u0439\u043a\u0430"],"title":["\u0422\u0438\u043f \u0436\u0438\u043b\u044c\u044f"],"type":"dropdown"}},"featured":"1","access":"1","ucf":{"avatar":"images\/joomlart\/team\/item-1.jpg"},"cmt_gallery":{"src":["images\/CEI-TR-17-20.jpg","images\/376e2e826ef05422273ec4ce4aeea6a7.jpg","images\/CEI-TR-17-20.jpg","images\/mahmutlar-alanya-271356_.jpg"],"class":["","","",""],"caption":["","","",""]}}
Результат вывода будет равен 3, т.е. сложения не происходит.
'{id}' - всегда равна числу, например 57
$idlink - имеет тип строки, я так понимаю из-за этого и не происходит правильного расчета. Но если я преобразую строку в integer, то $idlink у меня равен 0. Возможно я делаю это не правильно.
Спасибо.