Search code examples
phpcodeignitercodeigniter-2codeigniter-3

i use a variable to echo the different title of different pages but i got an error


[i got an error on using a variable ( $page_title ) for echo the page title but it does not work and show me an error ] [here is the code of header.php file]

<head>
    <meta charset="UTF-8">
    <title><?php echo $page_title; ?></title>
    <meta name="description" content="sodalitesolutions">
    <meta name="author" content="sodalitesolutions">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/bootstrap/css/bootstrap.css'); ?>">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/font-awesome/css/font-awesome.css'); ?>">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/style/slider.css'); ?>">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/style/mystyle.css'); ?>">
</head>

[Error :: function: _error_handler]


Solution

  • Try to add this :

    $this->data['title'] = 'test';
    $this->load->view('view_name',$this->data);