On the LISE Project summary page i would like to display how many reports is attached to each project, and this summary template works but is very very slow:
Code: Select all
{* Module: LISEProjects Layout: listProjects *}
{if $items|@count > 0}
<div class="table-responsive overview">
<table class="table table-striped">
<thead>
<tr>
<th class="border-top-0">Project Number</th>
<th class="border-top-0">Project Name</th>
<th class="border-top-0">Weight Reports</th>
<th class="border-top-0"></th>
</tr>
</thead>
<tbody>
{foreach from=$items item=item}
<tr>
<td class="fw-bold"><a class="link-dark" href="{$item->url}">{$item->project_number}</a></td>
<td class="fw-bold"><a class="link-dark" href="{$item->url}">{$item->title}</a></td>
<td>{LISEWeightReports template_summary='total' xs_project=$item->item_id}</td>
<td class="text-center"><a href="{$item->url}" class="button button-mini button-circle button-blumine">View</a></td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{/if}
Code: Select all
{* Module: LISEWeightReports Layout: total*}
{$totalcount}
Code: Select all
$id = isset($params['id']) ? $params['id'] : '14';
$db = cmsms()->GetDb();
$query = "SELECT * FROM " . cms_db_prefix() . "module_liseweightreports_fieldval WHERE fielddef_id = '7' AND value LIKE" . $id;
$result = $db->Execute($query);
$num_rows = mysqli_num_rows($result);
echo $num_rows;