Welcome Guest, Not a member yet? Register   Sign In
Help for how to show the title in browser title
#1

[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

#2

[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.

#3

[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

??????????
#4

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

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


#6

[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??
#7

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

Sad
#8

[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.




Theme © iAndrew 2016 - Forum software by © MyBB