Welcome Guest, Not a member yet? Register   Sign In
First Time Template Parser. Need an help.
#6

[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...


Messages In This Thread
First Time Template Parser. Need an help. - by El Forum - 01-31-2009, 07:22 AM
First Time Template Parser. Need an help. - by El Forum - 01-31-2009, 10:48 AM
First Time Template Parser. Need an help. - by El Forum - 01-31-2009, 10:57 AM
First Time Template Parser. Need an help. - by El Forum - 01-31-2009, 11:00 AM
First Time Template Parser. Need an help. - by El Forum - 02-02-2009, 04:47 AM
First Time Template Parser. Need an help. - by El Forum - 02-02-2009, 01:32 PM
First Time Template Parser. Need an help. - by El Forum - 02-03-2009, 02:10 AM
First Time Template Parser. Need an help. - by El Forum - 02-03-2009, 05:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB