我看到一些擴展文件在TYPO3 4.5中。 (class.tx_ajaxsearch_pi1.php
...),看起來像這樣:typo3:擴展類在typo3中的問題
class tx_ajaxsearch_pi1 extends tslib_pibase {
...
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/ajax_search/pi1/class.tx_ajaxsearch_pi1.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/ajax_search/pi1/class.tx_ajaxsearch_pi1.php']);
}
我檢查這個文件約XCLASS
:http://typo3.org/documentation/document-library/core-documentation/doc_core_api/4.1.0/view/3/8/
問題:
1。根據此文件:http://typo3.org/documentation/document-library/core-documentation/doc_core_api/4.1.0/view/3/8/
Extending TYPO3s PHP classes is recommended mostly for special needs in individual projects. This is due to the limitation that a class can only be extended once. Thus, if many extensions try to extend the same class, only one of them will succeed and in turn the others will not function correctly
但爲什麼類tslib_pibase
可以被不同的擴展類多次擴展?
2.是否在每個擴展腳本中放置以下代碼是一種好習慣?以防將來的擴展類需要擴展?
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/ajax_search/pi1/class.tx_ajaxsearch_pi1.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/ajax_search/pi1/class.tx_ajaxsearch_pi1.php']);