Model code loading into browser |
[eluser]sday[/eluser]
When I load my model, the model code shows up in the browser as if it's just loading a text file to display to the user!? What is going on. CI v2.1.2 Code: class Admin extends CI_Controller { this is what shows up in the browser when I browse to: http://myserver.com/index.php/admin/migrate_user Code: class Admin_model3 extends CI_Model { function __construct() { parent::_contstruct(); } function migrate_user() { return "done 3b"; } } The answer is probably so obvious, but with the bruises on my head from repeated smacking, I can no longer think. Thanks for any help -Steve
[eluser]sday[/eluser]
Just tried it with CI 2.1.3 same results. I must be doing something wrong. It's such a simple example and I can't figure it out.
[eluser]Aken[/eluser]
Well, according to the output being shown in the browser, there are a lot of things wrong. I'd start by checking if the document actually starts with the <?php opening tag and go from there.
[eluser]sday[/eluser]
I started over with a basic example with new files to make sure I didn't have some strange characters in there. Still the same thing and yes it does have the <?php Here is the exact code: controllers/test.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); models/test_model.php Code: class Test_model extends CI_Model { browser output: (all bunched together on one line in the browser, tried Chrome,Firefox,Safari in case it was something with the browser? ) Code: class Test_model extends CI_Model { function migrate_user() { return "We should see this"; } }
[eluser]sday[/eluser]
oh geeze. Like you said, <?php my model isn't wrapped in <?php ?> I need to "step away from the computer" lol thanks
[eluser]Aken[/eluser]
You can skip the closing ?> PHP tag in files that are strictly PHP (like controllers and models).
[eluser]sday[/eluser]
thanks. I'll probably never have a handle on all the little things like that. I switch between too many languages, I'm bound to get it wrong again next time. thanks again |
Welcome Guest, Not a member yet? Register Sign In |