Question

I'm trying to work on a website and would like to know how to display the category name in the page title, favicon next to the page?

Example: Mysite - Category 1, Mysite - Category 2

Hello everyone, I'm trying to work on a website and would like to know how to display the category name in the page title, favicon next to the page?

function cat() {

        $offset = (int) $this->uri->segment(4);

        $appcat_nome = xss_clean($this->uri->segment(3));

        $categoria = $this->appcat->get(array('appcat_url' => $appcat_nome, 'appcat_status' => 1, ));

        $this->data['titulo'] = 'Digital Feed';

        $cond = array('app_on' => 1);

        $this->data['apps2'] = $this->apps->getAll($cond, '', 1000, '', 'app_view DESC');

        // Configurações do site.
        $this->data['config_site'] = $this->config_site->getAll(array('conCod' => 1))->row();

        if (count($categoria) == 1)
            {
                $where = array('A.appcat_id' => $categoria[0]['appcat_id']);

                $total_rows = $this->apps->getAll($where)->num_rows();

                $this->data['apps'] = $this->apps->getAll($where, $offset, $this->limit, '');

                $this->load->library('pagination');

                $config['base_url'] = base_url() . 'apps/cat/'. $appcat_nome . '/';
                $config['total_rows'] = $total_rows;
                $config['per_page'] = $this->limit;
                $config['uri_segment'] = 4;
                $config['full_tag_open'] = "<ul class='pagination'>";
                $config['full_tag_close'] ="</ul>";
                $config['num_tag_open'] = '<li>';
                $config['num_tag_close'] = '</li>';
                $config['cur_tag_open'] = "<li class='disabled'><li class='active'><a href='#'>";
                $config['cur_tag_close'] = "<span class='sr-only'></span></a></li>";
                $config['next_tag_open'] = "<li>";
                $config['next_tagl_close'] = "</li>";
                $config['prev_tag_open'] = "<li>";
                $config['prev_tagl_close'] = "</li>";
                $config['first_tag_open'] = "<li>";
                $config['first_tagl_close'] = "</li>";
                $config['last_tag_open'] = "<li>";
                $config['last_tagl_close'] = "</li>";

                $this->data['total_rows'] = $total_rows;

                $this->pagination->initialize($config);

                $this->data['pagination'] = $this->pagination->create_links();

                $this->load->view('site/apps/index', $this->data);

            }else{
                redirect(base_url().'apps');
            }
        }
Was it helpful?

Solution

To set title to pages, pass title from controller.

$data["page_title"] = "Category 1";

In view file:

<?php
  $title = "Mysite";
  if(!empty($page_title))
      $title .= " - ".$page_title;
?>
<title><?php echo $title;?></title>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top