• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help for how to show the title in browser title

Hi i am using code igniter for my website and i have a little problem.

In my view file userpost.php i am using this code to show the description of the users uploaded image.

<?php echo $postDetails->description;?>

Due to SEO reasons i want this description to appear on the browser title.

Inside the controller file board.php i use this code
$data['title'] = 'Post Details page';
and in the browser title appears "Post Details page"

I tried to change the code above from
$data['title'] = 'Post Details page';
$data['title'] =$postDetails->description;
and i thought that the browser title will now get the description of the image but didn't work.

I cant understand why this isnt working !!!
Can someone please help me?


Assuming that
does have a value and in your view you are doing something like
<title><?php echo $title;?></title>

then it should work.

Hi Chris and thanks for your response. I made what exactly what you said but didnt work. Now the Browser title gets the url value for example mysite.com/category1/posts/12345


<title>  <?php echo $postDetails->description;?>  </title>

Just tried your solution and i have the same results. I cant understand what i am doing wrong.

if you are using this in your view
<?php echo $postDetails->description;?>
how this
<title><?php echo $postDetails->description;?> </title>
can be not working? are you putting this into head section of your html??

this is what exactly i cant understand. Yes i put it in the head section.!!!!


Copy and paste your actual controller and view code and maybe someone can help. At the moment you're asking people to debug your code with their eyes shut.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.