[eluser]roj[/eluser]
Well, you could use it that way or else to keep all logic out of view files you could put the <?php if($entries) : ?> in the controller and then have a view file for if there are results and another for if there are non. That way removing the problem of the variable names showing up altogether....
So you would then have
Controller:
Code:
if ($entries)
{
$page = $this->parser->parse('search_results', $data, TRUE);
}
else
{
$page = $this->parser->parse('search_results', $data, TRUE)
}
$page .= $this->parser->parse('commons/'.$this->config->item('set_front_lang').'/_search_form', TRUE);
// Now output the page
$this->output->set_output($page);
With a View file for search results
Code:
<div class="primary results">
<h2 class="title">Ricerca</h2>
<div class="info-results">
<div>{content_title}</div>
</div>
{entries}
<div class="apartment{list_class}">
<a class="image" href="{entry_url}"><img src="{photo_url}" alt="{entry_title}" /></a>
<div class="details">
<strong><a href="{entry_url}">{entry_title}</a></strong>
<span class="price">{entry_price}</span>
{entry_expert}
<a class="button" href="{entry_url}">vedi scheda</a>
<br class="clearer" />
</div>
<br class="clearer" />
</div>
</div>
And a view file for no search results
Code:
<div class="primary results">
<h2 class="title">Ricerca</h2>
<div>No</div>
</div>
By doing the above you'll keep all logic separate including the loading of the sidebar view...