Static variable not showing |
[eluser]Pellens[/eluser]
Hi! I'm having 3 controllers: index.php about.php contact.php I have a model called seo_model.php: Code: <? In my controller about.php I user the following code: Code: <? In my view file index.php I just need to do this: Code: <meta name="keywords" content="<?=$this->seo_model->keywords();?>"/> (The seo_model.php is autoloaded in autoload.php) THE PROBLEM The seo model works: it adds the new keywords, BUT Code: <?=$this->seo_model->keywords();?> I hope I'm being clear here... I don't want to add /index at every controller. Anyone knows the solution? Thanks!
[eluser]Narkboy[/eluser]
Ok, couple of points: - I'm not seeing an explict load model call in the controller; auto-loaded? - In about.php you insert_keywords using a direct call rather than a CI call ($this->Seo_model->insert_keywords("foo)). Try to use the same calling method throughout. - You declared all the Seo_model methods as static, which is useful if you're not creating an instance of the class, but you are. When you call the model CI instances the class as $this->Seo_model. I think that this is the reason you're getting patchy results, but I'm guessing. I avoid static with CI - private is always useful though! /B |
Welcome Guest, Not a member yet? Register Sign In |