CodeIgniter Forums

Full Version: Help for how to show the title in browser title
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]margsot[/eluser]
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.

Code:
<?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
Code:
$data['title'] = 'Post Details page';
and in the browser title appears "Post Details page"

I tried to change the code above from
Code:
$data['title'] = 'Post Details page';
to
Code:
$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?

Thanks

El Forum

[eluser]Ckirk[/eluser]
Assuming that
Code:
$postDetails->description
does have a value and in your view you are doing something like
Code:
<title><?php echo $title;?></title>


then it should work.

El Forum

[eluser]margsot[/eluser]
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

??????????

El Forum

[eluser]noideawhattotypehere[/eluser]
Code:
<title>  <?php echo $postDetails->description;?>  </title>

El Forum

[eluser]margsot[/eluser]
Just tried your solution and i have the same results. I cant understand what i am doing wrong.


El Forum

[eluser]noideawhattotypehere[/eluser]
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??

El Forum

[eluser]margsot[/eluser]
this is what exactly i cant understand. Yes i put it in the head section.!!!!

Sad

El Forum

[eluser]davidMC1982[/eluser]
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.