Welcome Guest, Not a member yet? Register   Sign In
Any CodeIgniter Expert Gurus out here?
#4

(08-31-2015, 01:28 AM)rtorralba Wrote:
(08-31-2015, 12:14 AM)davidgv88 Wrote: Hi jjalvi.

For dynamically change the Page title of your product pages:

In your view you can send the title from your controller.

In controller:






Code:
$data = array();
$data['page_title] = 'The Page title';
$this->load->view('your_view',$data);



In your_view.php






Code:
<?php
if(empty($page_title)){
     $page_title = 'Default Title';
}
<html>
.....
<title><?php echo $page_title; ?></title>
</html>
?>

I prefer in view to use a ternary operator, but is just a preference:



Code:
<title><?= empty($page_title) ? $page_title : 'Default Title' ?></title>


Thanks heaps rtorralba and [b]davidgv88 .[/b]


I managed to implement the code successfully. 

Now I am just trying to figure out how to put the title of my product automatically as the title of my page. For emaple if you follow this page http://www.webuyback.com.au/sell_your_phone/154 , The title of the page is "WeBuyback.com.au | Sell Your Phones and Tablets for Quick Cash" I would like it to be ," HTC One X 32GB" . 

Is there any way to achieve this?
Reply


Messages In This Thread
RE: Any CodeIgniter Expert Gurus out here? - by jjalvi - 08-31-2015, 09:56 PM



Theme © iAndrew 2016 - Forum software by © MyBB