|
The URI and naming scheme is actually not really that different, the only difference is on the backend usually. Let’s say that you create a namespace and module named LC_News. The url to access on the frontend would be:
Frontend:
www.example.com/news/
Backend:
www.example.com/index.php/news/adminhtml_news/
The reason being for the backend is the necessity to tell Magento to look to the sub-directory in controllers and Block in the adminhtml directory. We put the files there so that we can have all of the files in one place (all in the custom module) but in doing so it means we have to call it correctly in the backend, so it doesn’t quite follow the exact Magento naming convention. Now their may be a way to rewrite it using the Routers (look up Zend Framework Router’s) which is a PHP interface to mod_rewrite in a sense. Also note that you see index.php in the backend and not the frontend after calling it, that is because on the frontend we are using a .htaccess rule to remove the index.php. Due to generally accepted programming practices using index.php as the entry way is a good way to help secure the overall platform. You can write a similar .htaccess rule for the backend.
A lesson I learned in trying to access anything other than the default indexAction is where to go. Let’s say you have these functions defined in your Adminhtml controller (IndexController.php):
public function indexAction() { ... }
public function viewAction() { ... }
One might logically think that you would go to:
www.example.com/index.php/news/adminhtml_news/view/
In reality you want to go to:
www.example.com/index.php/news/adminhtml_news/index/view/
The different sections of the Customer module are different blocks controlled by different controllers. You can clearly see the structure by looking in Adminhtml at the Customer sections of Block and controllers.
-Adam
|