#1
  1. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,664
    Rep Power
    171

    Routing issue wth CI


    Hello;
    Trying to get it to go to div_share_accommodation if the user goes to div-share-accommodation but I get 404.


    http://test.com/div-share-accommodation/

    Route in config
    PHP Code:

    $route
    ['div-share-accommodation'] = "div_share_accommodation"
    PHP Code:
    class div_share_accommodation extends CI_Controller {
    public function 
    __construct($id)
    {
    parent::__construct();
    $this->index($id);

    htaccess
    Code:
    <IfModule mod_rewrite.c>
      RewriteEngine On
      
    
      RewriteCond %{REQUEST_URI} ^system.*
      RewriteRule ^(.*)$ /index.php?/$1 [L]
    
      RewriteCond %{REQUEST_URI} ^application.*
      RewriteRule ^(.*)$ /index.php?/$1 [L]
    
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?/$1 [L]
    </IfModule>
    
    <IfModule !mod_rewrite.c>
      ErrorDocument 404 /index.php
    </IfModule>
    If I go directly to div_share_accommodation it works fine.
    What am I doing wrong?
    Thanks
    Last edited by English Breakfast Tea; September 7th, 2013 at 09:49 PM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,469
    Rep Power
    594
    Your syntax is bad. You need to add a space.
    PHP Code:
    public function __construct($id); 
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,664
    Rep Power
    171
    Originally Posted by gw1500se
    Your syntax is bad. You need to add a space.
    PHP Code:
    public function __construct($id); 
    The manual
    PHP Code:
    class Blog extends CI_Controller {

           public function 
    __construct()
           {
                
    parent::__construct();
                
    // Your own constructor code
           
    }

  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,469
    Rep Power
    594
    Correct. Exactly the correction I gave you.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  8. #5
  9. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,664
    Rep Power
    171
    Originally Posted by gw1500se
    Correct. Exactly the correction I gave you.
    Oh!

    Copy from
    Dreamweaver->text-edit->Devshed = Fail
    Removes spaces.

  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2004
    Posts
    2,990
    Rep Power
    375
    Originally Posted by English Breakfast Tea
    Oh!

    Copy from
    Dreamweaver->text-edit->Devshed = Fail
    Removes spaces.

    had you been using a proper editor with php syntax checking, this would have been flagged up
  12. #7
  13. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,664
    Rep Power
    171
    Hi; Can anyone answer this?

    Thank you
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,469
    Rep Power
    594
    I thought we did when we fixed your syntax error.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,449
    Rep Power
    1751
    If 'spaces' disappear when you copy/paste I would hazard a guess they might be tab characters or other white space charaters instead. Not sure why that'd be an issue, though,
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc

IMN logo majestic logo threadwatch logo seochat tools logo