• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Different Meta Title for each Page

#1
[eluser]Unknown[/eluser]
I am very new with CodeIgniter and I am having difficulty in making few things work. I want to have different meta title for each static pages and dynamic pages. Below is the code which I am using for meta title.

Code:
<?php if($title){ echo $title.' - '; } ?><?php echo $settings->sitename;?>

I want to echo $title only on dynamic page and sitename to other pages like home, about and contact us. Is there any way to do it by using if else Statements?

#2
[eluser]boltsabre[/eluser]
Firstly, if you want any kind of traffic from the search engines, you don't want to just echo "sitename", you really should have meaningful titles like "Contact Us" (or Contact "sitename").

Even if you don't want search engine traffic remember that the title displays on the browser tabs, so if it's for an intranet or something you still want something meaningful for the users of the site.

As for your question "Is there any way to do it by using if else Statements?", if your static pages do NOT have a $title (aka $data['title']) set in them then it's an easy

Code:
if(isset($title) && $title != ''){
   // echo your title
}else{
  // echo your sitename
}


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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