Slug from database available on all pages through lang CodeIgniter |
I have a table on my database from where I get some slug texts:
art_and_culture business_and_financial auto_and_moto and display on my website through PHP Code: <?php echo lang($slug_from_database); ?> http://www.sitepoint.com/multi-language-...deigniter/ So in My_Controller.php I have in construct: PHP Code: $this->categories_list = $this->categories_model->entries(); and all the categories are available on all pages from my website. The problem is when I send the categories to the view, the language is not fired up from the LanguageLoader.php controller. LanguageLoader is initialised in hooks.php (post_controller_constructor - see the link example) BEFORE the my_controller construct. If no language no text on echo $slug_from_database. How do you suggest to do?
You did not read my problem.
I found one solution: Created: PHP Code: public function LanguageLoader() { in MY_Controller.php and call it in the constructor: PHP Code: $this->LanguageLoader(); and delete PHP Code: $hook['post_controller_constructor'] = array( from hooks.php so now I load the language in controller`s construct not with hook. What can you tell me about this? |
Welcome Guest, Not a member yet? Register Sign In |