Hello all.
I have the following Smarty XHTML code which is loaded by the PHP preceding it. There are over 2000 queries on the page using this code. With the Smarty code in place, the page takes about 16 seconds to load. Without the Smarty code, but the PHP code still in place, the page loads in about 1.5 seconds. Is my code inefficient or is it Smarty? Should I just move the select option building into the PHP and pass a big string to Smarty instead?
TIA!
/** nav search bar variables **/
$years = array();
for($i=date("Y")+1; $i>=1950; $i--)
$years[] = $i;
$tpl->assign('yearLoop', $years);
$makes = $db->rows("SELECT DISTINCT m.makerID, m.makerName FROM makers AS m, listings AS l WHERE m.makerID=l.make");
$tpl->assign('makes', $makes);
$modelsSQL = "SELECT DISTINCT model FROM listings WHERE (status LIKE '$status')";
$models = $db->rows($modelsSQL);
$tpl->assign('models', $models);
/** end nav search bar variables **/
<select name="narrow[make]" class="select" onchange="document.narrowResults.submit();">
<option value="">{$LISTINGS_MAKE}</option>
{if $makes|@count > 0}
{section name="makesLoop" loop=$makes}
<option value="{$makes[makesLoop].makerID}"{if $makes[makesLoop].makerID == $smarty.session.narrow.make} selected="selected"{/if}>{$makes[makesLoop].makerName}</option>
{/section}
{/if}
</select>
<select name="narrow[model]" class="select" onchange="document.narrowResults.submit();">
<option value="">{$LISTINGS_MODEL}</option>
{if $models|@count > 0}
{section name="modelsLoop" loop=$models}
<option value="{$models[modelsLoop].model}"{if $models[modelsLoop].model == $smarty.session.narrow.model} selected="selected"{/if}>{$models[modelsLoop].model}</option>
{/section}
{/if}
</select>