Kochani,
mam zrobiony raport wyciągający kończące się umowy w danym okresie. Nie mogę sobie poradzić z wariantowym wyświetlaniem przez smarty.
Robię to tak:
{if $endofconntract.tar_value neq 0} {$endofconntract.tar_value[endofconntract]|money_format}<BR> {$endofconntract.tar_name[endofconntract]}<br>{/if}
{if $endofconntract.lia_value neq 0} {$endofconntract.lia_value[endofconntract]|money_format}<BR> {$endofconntract.lia_name[endofconntract]}<br>{/if}
Wyciągam jednym zapytaniem: if($tslist = $DB->GetAll('select assignments.tariffid as ass_tariffid, assignments.customerid as ass_customerid, assignments.period as ass_perios, assignments.at as ass_at, assignments.datefrom as ass_datefrom, assignments.dateto as ass_dateto, customers.id as cus_id, customers.name as cus_name, customers.lastname as cus_lastname, customers.address as cus_address, customers.zip as cus_zip, customers.city as cus_city, tariffs.name as tar_name, tariffs.value as tar_value, liabilities.value as lia_value, liabilities.name as lia_name from assignments left join tariffs on tariffs.id = assignments.tariffid left join customers on assignments.customerid = customers.id left join liabilities on assignments.liabilityid = liabilities.id where assignments.dateto >= ' . $date['from'] .' and assignments.dateto <= ' . $date['to'] .' order by customers.id', array($id))
gdzie albo lia_value, lia_name albo tar_value, tar_name są wartościami NULL.
Jak napisać warunek dla smarty?