![]() |
Title, Description, and Keyword best practice - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Title, Description, and Keyword best practice (/showthread.php?tid=39122) |
Title, Description, and Keyword best practice - El Forum - 03-01-2011 [eluser]xerosis[/eluser] I am creating a site which has many pages, each page has its own: - title - description - keyword Now I have been reading that is is not good practice to call a model from a view. I have a file called header.php where title, description, and keywords are saved. What I am currently doing is on each function of each controller I am creating below: Code: $seo = array('title' => 'Title of Site', 'keywords' => 'Keywords', 'description' => 'Something about the site'); and when I call the view I call the $seo like: Code: $this->load->view('main/main_index', $seo); Is this the right way to do this? I have a page where I have products and title needs to be dynamic and I don't know what to do there. Basically if someone can explain to me what is the proper method of doing this, would appreciate it. Title, Description, and Keyword best practice - El Forum - 03-01-2011 [eluser]InsiteFX[/eluser] Code: private $data = array(); InsiteFX Title, Description, and Keyword best practice - El Forum - 03-01-2011 [eluser]xerosis[/eluser] Thanks. So Basically this is the right approach and I have to send the private $data in every single function through the controller? I thought there may be a way that all the metadata handling can be done separately in another file. Thanks. Title, Description, and Keyword best practice - El Forum - 03-02-2011 [eluser]Julio Fagundes[/eluser] Code: Class MY_Controller extends CI_Controller Code: Class Home extends MY_Controller I dont tested, but I think that way works fine, test and tell us! :cheese: Title, Description, and Keyword best practice - El Forum - 03-02-2011 [eluser]InsiteFX[/eluser] Julio Fagundes, Your method will give you a big performace hit! Becuase it will have to access the database everytime it switches pages! InsiteFX Title, Description, and Keyword best practice - El Forum - 03-02-2011 [eluser]Julio Fagundes[/eluser] I Agree, but just only showing the logic. Another way: Code: Class MY_Controller extends CI_Controller |