Welcome Guest, Not a member yet? Register   Sign In
how dynamic titles
#1

How can I show dynamic titles for my application posts? I already red the docs. But I cant achive that for exampe I created a blog but in every post does not change the title. I wrote this config['page_title'] = "my title", but that title is showing in every post.
Reply
#2

(This post was last modified: 12-24-2016, 01:13 AM by Wouter60.)

Make sure the page title is in the data array your controller passes to the view.
PHP Code:
$data['page_title'] = 'The title of this page' //assign dynamically
$this->load->view('post-view-file',$data); 

In the head section of your view (or the header part of your template:
PHP Code:
<head>
 
 <title>
 
    <?php if (!empty($page_title)) echo $page_title;?>
  </title>
</head> 
Reply
#3

(12-24-2016, 01:12 AM)Wouter60 Wrote: Make sure the page title is in the data array your controller passes to the view.
PHP Code:
$data['page_title'] = 'The title of this page' //assign dynamically
$this->load->view('post-view-file',$data); 

In the head section of your view (or the header part of your template:
PHP Code:
<head>
 
 <title>
 
    <?php if (!empty($page_title)) echo $page_title;?>
  </title>
</head> 

Thanks for the response I already did that. But I want that title to change on every post dynamically for exemple im creating this movie review blog but when i go in every movie the title does not change. http://blog.codigero.com/
Reply
#4

You haven't given us much to go on.  If you have the field 'movie_title' in your database table you can do something like:

PHP Code:
// pseudo-code
$result $query->row_array();

$data['page_title'] = $result['movie_title'];
$this->load->view('post-view-file'$data); 

 then continue with Wouter60's answer.

If you need more specific help, you'll need to post your code.
Reply
#5

(12-24-2016, 07:39 AM)enlivenapp Wrote: You haven't given us much to go on.  If you have the field 'movie_title' in your database table you can do something like:

PHP Code:
// pseudo-code
$result $query->row_array();

$data['page_title'] = $result['movie_title'];
$this->load->view('post-view-file'$data); 

 then continue with Wouter60's answer.

If you need more specific help, you'll need to post your code.

Thanks enlivenapp !! it works...
Reply




Theme © iAndrew 2016 - Forum software by © MyBB