Attention
TYPO3 v6 has reached its end-of-life April 18th, 2017 and is not maintained by the community anymore. Looking for a stable version? Use the version switch on the top left.
There is no further ELTS support. It is strongly recommended updating your project.
Naming conventions¶
Based on the extension key of an extension these naming conventions should be followed:
General |
Example |
User-specific |
Example |
|
---|---|---|---|---|
Extension key (Lowercase "alnum" + underscores. ) |
Assigned by the TYPO3 Extension Repository. |
cool_shop |
Determined by yourself, but prefixed "user_" |
user_my_shop |
Database tables and fields |
Prefix with "tx_[ key ]_" where key is without underscores! |
Prefix: tx_coolshop_ Examples: tx_coolshop_products tx_coolshop_categories |
Prefix with "[ key ]_" |
Prefix: user_my_shop_ Examples: user_my_shop_products user_my_shop_categories |
Backend module (Names are always without underscores!) |
Name: The extension key name without underscores, prefixed "tx" |
txcoolshop |
Name: No underscores, prefixed "u" |
uMyShop or umyshop or ... |
For frontend PHP classes, follow the same conventions as for
database tables and field, but prepend class file names with class
.
You may also want to refer to the TYPO3 Core Coding Guidelines for more on general naming conventions in TYPO3.
Tip
If you study the naming conventions above closely you will find that they are complicated due to varying rules for underscores in key names. Sometimes the underscores are stripped off, sometimes not.
The best practice you can follow is to avoid using underscores in your extensions keys at all! That will make the rules simpler. This is highly encouraged.
Note on "old" extensions:¶
Some the "classic" extensions from before the extension structure came about do not comply with these naming conventions. That is an exception made for backwards compatibility. The assignment of new keys from the TYPO3 Extension Repository will make sure that any of these old names are not accidentially reassigned to new extensions.
Further, some of the classic plugins (tt_board, tt_guest etc) users the "user_" prefix for their classes as well.
Extending "extensions classes"¶
As a standard procedure you should include the "class extension code" even in your own extensions. This is placed at the bottom of every class file:
if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/myext/pi1/class.tx_myext_pi1.php'])) {
include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/myext/pi1/class.tx_myext_pi1.php']);
}
Normally the key used as example here ("ext/myext/pi1/class.tx_myext_pi1.php")
would be the full path to the script relative to the PATH_site
constant. However because modules are required to work from both
typo3/sysext/
, typo3/ext/
and typo3conf/ext/
it is a policy that any
path before "ext/" is omitted.