[FLOW3-general] subpackages
Robert Lemke
robert at typo3.org
Tue Feb 2 11:11:49 CET 2010
Hi Georg,
Am 01.02.2010 um 13:40 schrieb Georg Ortner:
> I'm trying to create a package with two subpackages. Is there any standard how the directory layout should look like? How is my directory layout for the resources supposed to look like? And is there any info to routing about subpackages?
>
> An easy example would be a webshop which is separated in a "shop" subpackage and a "admin" subpackage.
>
> With mydomain.org/ I want to get to the shop subpackage and call the HomepageController of no other controller is given.
>
> With mydomain.org/admin I want to get to the admin subpackage.
While there are no fixed rules yet, I recommend the following structure:
WebShop/
Classes/
Controller/
Admin/
AccountController.php
...
Shop/
OrderController.php
Domain/
Model/
Customer.php
Order.php
...
Resources/
Private/
Templates/
Admin/
Account/
index.html
new.html
Shop/
Order/
...
The structure below "Domain" is just up to you, you can put all models into the same directory (if they are shared by multiple sub packages) or organize them in sub namespaces.
Something you need to know is that the controller name which you specify in a route now includes the sub package name! Here's an example:
- name: 'Account - Login'
uriPattern: 'admin/account(/{@action})'
defaults:
'@package': 'WebShop'
'@controller': 'Admin\Account'
'@action': 'index'
I hope that helps ...
Cheers,
robert
--
Robert Lemke
Fluent Code Artisan
Lead Developer TYPO3 5.0 and FLOW3
TYPO3 Association co-founder
http://typo3.org
http://flow3.typo3.org
http://association.typo3.org
More information about the FLOW3-general
mailing list