Now I just know I'm being a newbie here! |
[eluser]deadfrog[/eluser]
Hi! I've noticed I'm calling a lot of the same things in my controller, for example I'm creating a data array which passes title,meta keywords & descriptions, and loads in my 'includes'. What I thought I could do would be to create a new controller, which the other controllers could inherit from. This main controller would store (for example) a default title,meta keywords & description and also enable me to pass new 'includes' to every page in one go. It doesn't work (no error, just a blank page) and I'm sure the reason for that is my lack of expertise and failure to connect it up properly - if someone could advise me that would be terrific. Here's my application controller: Code: <?php And here's my home controller: Code: <?php
[eluser]Seppo[/eluser]
Are you including the Application controller file? You can use a hook (to do it automaticly), or just include it in each file Code: <?php
[eluser]Clooner[/eluser]
I do it this way. I create a library my_controller.php Code: class MY_Controller extends Controller { and then use in my controllers Code: class Home extends MY_Controller {
[eluser]deadfrog[/eluser]
Thanks for the replies guys. I didn't have application.php included, but now I have it still isn't working. In fact neither way works which suggests something else is up here.. Gah if I can just crack this I'll be sorted!
[eluser]Seppo[/eluser]
Why don't you enable display_errors using .htaccess or setting it in the codeigniter index.php so you can find out what's wrong easier?
[eluser]deadfrog[/eluser]
Well this is why I think it's just something daft I'm doing - my errors are set to error_reporting(E_ALL);!
[eluser]Seppo[/eluser]
but display_errors can be off and the errors are only logged and not display. Try creating a .htaccess file with Quote:php_flag display_errors On
[eluser]deadfrog[/eluser]
I just kinda started from scratch and it still isn't working. Here's my new 'main' controller: Code: <?php And here's the controller that's calling it. Code: <?php The errors I'm getting are undefined variables, so nothing in that data array in main is being received by the calling controller. |
Welcome Guest, Not a member yet? Register Sign In |