How to return the path of typo3conf?

时间:2016-04-15 11:02:07

标签: php path typo3

In my file 'class.tx_freephpcoders_pi1.php' I am using the code require_once('contents/page_683.php');. Anyway, this is not working for me. I guess I have to return the path of my extension.

This is how my FTP looks like:

FTP

So how can I get the path of the directory typo3conf?

1 个答案:

答案 0 :(得分:6)

您可以使用TYPO3常量之一,如:

require_once(PATH_typo3conf.'ext/free_php_code_rs/pi1/contents/foo.php');

但最好使用TYPO3的方法,它使用扩展键(在检查之后)返回扩展名的绝对路径,如:

require_once(t3lib_extMgm::extPath('free_php_code_rs').'pi1/contents/bar.php');

和TYPO3版本。 6+同样是:

require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('free_php_code_rs').'pi1/contents/baz.php');