Welcome Guest, Not a member yet? Register   Sign In
Template Lib/Parser question
#1

[eluser]the_unforgiven[/eluser]
Using Phil Sturgeons library for templating i have
Code:
$this->template
     ->set_layout('default')
     ->build('admin/clientlist', $data);
in my controller, so oif i wanted to say if clientlist template is used do this how would i acheive this?

like
Code:
$template['clientlist']
#2

[eluser]the_unforgiven[/eluser]
Anyone?

This will be what i should write in my view file to say if the template is a specific page/template then do this else do this.
#3

[eluser]Aken[/eluser]
After a quick glance through the source, I don't see anything that passes the view name to the template content. You'd have to add that, either to your $data array, or modify the Template library to do it automatically.
#4

[eluser]the_unforgiven[/eluser]
My full controller
Code:
$total = $this->client_model->client_count();
  $per_pg = 20;
  $offset = $this->uri->segment(3);

  $config['base_url'] = $data['base'].'/admin/clientlist/';
  $config['total_rows'] = $total;
  $config['per_page'] = $per_pg;
  $config['full_tag_open'] = '<div id="pagination">';
  $config['full_tag_close'] = '</div>';
        $this->pagination->initialize($config);
        $data['pagination'] = $this->pagination->create_links();
        $data['total_rows'] = $config['total_rows'];
  $data['show_from'] = $offset + 1;
  $data['show_to'] = $offset + $per_pg;
  if($data['show_to'] > $total) {
   $data['show_to'] = $total;
  }
        $data['query'] = $this->client_model->get_all($per_pg,$offset);
  
  $this->template
   ->enable_parser(TRUE)
   ->title(lang('client_title'));

  $this->template
   ->set_layout('default')
   ->build('admin/clientlist', $data);

So now i need to know how to get in my view file, if the template is set to clientlist for example so this, else show this...
#5

[eluser]Phil Sturgeon[/eluser]
Code:
$this->template
     ->set_layout('default')
     ->set('is_client_list', true)
     ->build('admin/clientlist', $data);

TADAAAA! Smile
#6

[eluser]the_unforgiven[/eluser]
Gracias great one!

Thanks Phil
#7

[eluser]the_unforgiven[/eluser]
So would just do in view right:

?php if ($template['is_client_list'] == TRUE) { ?&gt;

blah blah




Theme © iAndrew 2016 - Forum software by © MyBB