Set different page title for every other page. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Set different page title for every other page. (/showthread.php?tid=20004) |
Set different page title for every other page. - El Forum - 06-25-2009 [eluser]zombica[/eluser] Hey Guys is there any support in CI that we can set different page title for each view page. I have looked for this in threads and all they say, their is some support in helper classes but i couldn't find any thing over their. Regards Set different page title for every other page. - El Forum - 06-25-2009 [eluser]Thorpe Obazee[/eluser] Errmm... of course there's a way to set different page title for each view page. What exactly is preventing you from doing it? Set different page title for every other page. - El Forum - 06-25-2009 [eluser]zombica[/eluser] Nothing preventing me, but for what i m looking for is not the right answer i m getting for it. I need to change my page title for every view page by specific controller class. Is their any possibility for this. Regards, Thanks...... Set different page title for every other page. - El Forum - 06-25-2009 [eluser]Thorpe Obazee[/eluser] You can always set the value in your Controller constructor. Code: function Courses() Code: // View Set different page title for every other page. - El Forum - 06-25-2009 [eluser]huzzi[/eluser] This is how I do it. Extend the default controller as shown, this file goes inside the libraries folder. MY_Controller.php Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); Now in the controller set the page title. Code: <?php Code: <html > Hope this helps. Set different page title for every other page. - El Forum - 06-25-2009 [eluser]zombica[/eluser] Thanx guys for the help. actually may be i am unable to explain my problem i have a common header file which i am including on my each view page now say if i have a controller class "Users" under which i have created multiple view pages for CRUD operation how i can differentiate them regarding title page. The technique you both told me i have applied it is throwing following error. some kind of HTML is displayed on the title bar like this"<div style=borderolid 1px #99000;padding:5px"><H4>A PHP error.... Regards, Thanx............ Set different page title for every other page. - El Forum - 06-25-2009 [eluser]Thorpe Obazee[/eluser] Code: function Courses() Code: // View use $this->load->vars(); so that it's set in all views. Set different page title for every other page. - El Forum - 06-25-2009 [eluser]zombica[/eluser] Thanx Buddy it works. but still i am confused say if i load a view page for add user or update user or say view user from different function under same controller class although the "$this->load->vars($this->data);" call will be given separately to each function but in the controller class constructor the definition of $this->data['title']='title_goes_here' is defined only once and every time we will get same value on each view page. Sorry for disturbing you all. Regards, Thanx Set different page title for every other page. - El Forum - 06-25-2009 [eluser]zombica[/eluser] Thanx guys i find he solution i have defined the $this->data="title" w.r.t each CRUD function in it self. Thanx a lot for cooperation. Regards. Zombica. |