Welcome Guest, Not a member yet? Register   Sign In
URI Routing with folders
#1

[eluser]sqwk[/eluser]
I have the current folder structure inside Controllers:

Code:
- controllers
    - admin
        -main.php
        -static.php
        -blog.php
    - …
    - main.php
    - …
    -all other controllers not in a folder
    - …

Using routes this works:
Code:
$route['default_controller'] = "main";
$route['admin'] = "admin";


However this will produce an error:

Code:
$route['admin/statischeseiten'] = "admin/static";

There is no controller called admin, just the folder called admin with a controller called static.

The error is this:

Code:
Parse error: syntax error, unexpected T_STATIC, expecting T_STRING in /home/lorem/ipsum/system/application/controllers/admin/static.php on line 3

where line 3 has the Class declaration:

Code:
<?php

class Static extends Controller {

    function __construct() {
        parent::Controller();
    }
}?>

What am I doing wrong here?
#2

[eluser]danmontgomery[/eluser]
Static is a reserved php keyword, you can't use it as the name for your class.
#3

[eluser]sqwk[/eluser]
Ah, that simple, eh? Thanks, that worked…
#4

[eluser]danmontgomery[/eluser]
Yep... You can see the full list at http://www.php.net/manual/en/reserved.keywords.php




Theme © iAndrew 2016 - Forum software by © MyBB