Some where I have read that we should use views template xxxxx.tpl.php file to not implement complex logic. I want to show a search results message to the user. The message is not made of mere row count but it has little bit of logic depending on what options he has selected.
I have implemented this logic in my view mymodule-view-grid--apartments--listing-row-filtered.tpltemplate.tpl.
I don't think this is complicated logic that's why I went on and implemented this logic but a question always bothers me is that where should I implement this logic if at all I have to implement it outside and how to pass this variable to this template.
<?php $view = views_get_current_view(); $rowCount = $view->total_rows; isset($view->exposed_input['field_location_tid'])?$ltid = $view->exposed_input['field_location_tid']:$ltid = 'All'; //force to all if landing directly $city = taxonomy_term_load($view->exposed_input['field_city_tr_tid'])->name; $locationName = $ltid == 'All'?'':' in ' . taxonomy_term_load($view->exposed_input['field_location_tid'])->name; // $resultText = "Properties in $city: Your search criteria matched $rowCount properties$locationName"; ?> <h3><?php print($resultText);?></h3> ... and rest of the template follows unchanged