Generally, we strive to adhere to the Symfony directory structure.
Additional directories:
assets
- regular location for resources storage with a specific folder structure inside;classes
- the core code for code generation (see Modules system);docs
- support documentation, changelog;Includes
- shared code (legacy);lib
- libraries (legacy);modules
- add-ons code (see [Modules system);service-tool
- internal app for the X-Cart maintenance (add-ons installation and de-installation, updates, etc.);sql
- basic data for installation;templates
- regular location for templates storage with a specific folder structure inside.
Assets и Templates
Assets and templates are divided into zones and interfaces. Generally, there are three interfaces (web
, mail
, pdf
) and two zones (admin
and customer
). The common
zone is a parent for all other zones. The mail
and pdf
zones override the web
zone.
[todo перенести в отдельный док, это слишком подробная информация для этого раздела]
The general assets and templates folder structure:
{assets,templates}/
web/
admin/
common/
customer/
mail/
admin/
common/
customer/
pdf/
admin/
common/
customer/
If you need to find, e.g., the body.twig
template for the web
interface and admin
zone, the search order will be as follows:
templates/web/admin/body.twig
templates/web/common/body.twig
If you need to find the body.twig
template for the mail
interface and admin
zone, the search order will be as follows:
templates/mail/admin/body.twig
templates/mail/common/body.twig
templates/web/common/body.twig
The search will also be done through the resources’ and add-on templates’ paths in the following way. First, it will search through the skin
add-ons following the skin inheritance, then through the rest of the add-ons taking dependencies into account, and the last in the core.
Suppose you have two skins (XCExample-SkinChild and XCExample-SkinParent) and two add-ons (XCExample-Module1 and XCExample-Module2). The search for the body.twig template for the mail interface and admin zone, in this case, will be done as follows:
modules/XCExample/SkinChild/templates/mail/admin/body.twig
modules/XCExample/SkinParent/templates/mail/admin/body.twig
modules/XCExample/Module2/templates/mail/admin/body.twig
modules/XCExample/Module1/templates/mail/admin/body.twig
templates/mail/admin/body.twig
modules/XCExample/SkinChild/templates/mail/common/body.twig
modules/XCExample/SkinParent/templates/mail/common/body.twig
modules/XCExample/Module2/templates/mail/common/body.twig
modules/XCExample/Module1/templates/mail/common/body.twig
templates/mail/common/body.twig
modules/XCExample/SkinChild/templates/web/common/body.twig
modules/XCExample/SkinParent/templates/web/common/body.twig
modules/XCExample/Module2/templates/web/common/body.twig
modules/XCExample/Module1/templates/web/common/body.twig
templates/web/common/body.twig