Welcome Guest, Not a member yet? Register   Sign In
Tutorial Issue?
#1

Hi.  I setup a raspberry pi as a test server running nginx, php and mysql.  I downloaded codeigniter and installed it to my web root, and started running through the CI tutorial, as I'm new to MVC.

Everything seemed to be running smooth, I got through the first steps in the http://www.codeigniter.com/user_guide/tu...pages.html page, and then ran into a problem at the beginning of the "Routing" section:

Quote:The controller is now functioning! Point your browser to [your-site-url]index.php/pages/view to see your page. When you visit index.php/pages/view/about you’ll see the about page, again including the header and footer.

If I point my browser to index.php/pages/view I get a 404.  If I visit index.php/pages/view/about I get a 404.  Something, a step perhaps, seems to be missing?
Reply
#2

(This post was last modified: 04-27-2015, 08:01 AM by n2fole00.)

Hi, I'm also new at this, but from my understanding, the page in [your-site-url]index.php/pages/view would have to be an index.php for you to skip the declaration of the page (the argument of the view method). (The index of the view is currently the 404 page).
The tutorial seems to specify it's home.php (in the controller), so you have to do something like [your-site-url]index.php/pages/view/home and make sure there is a home.php in the view folder.

I quickly tested with this...

PHP Code:
   public function view($page 'home')
   {
    
   $this->load->view('test/'$page); // I put home.php in a folder called test
   

...and it seemed to work.
Reply
#3

(This post was last modified: 04-27-2015, 01:56 PM by qkzoo. Edit Reason: Updated )

Yes, I realize that.  There is a home.php, as it told me to create a home.php and an about.php in the tutorial.  Unfortunately, the routing just doesn't seem to work.  Am I supposed to do something specific to get the index.php/ url thing to work properly?

EDIT:

Further digging and even http://192.168.1.2/index.php/welcome doesn't work, which is the built in sample. If this url isn't working, something has got to be off.
Reply
#4

What server are you using? The easiest thing I found to get CI to work was to run php -S localhost:8000 from the CI directory.
Reply
#5

(04-27-2015, 09:28 PM)n2fole00 Wrote: What server are you using? The easiest thing I found to get CI to work was to run php -S localhost:8000 from the CI directory.

I figured it out! I am running Nginx, anwill post my d had to add a rewrite line to my config. I will post my exact solution tonight when I get home.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB