[TYPO3-dev] Extend extension's class

Hraklis Karvasonis Hkarvasonis at customit.com
Thu Oct 26 15:44:15 CEST 2006


Hi again.

I would like to make my question simpler on that.

I have created an extension that has the default class 
class.tx_myextension_pi1.php

I would like to have another class within the extension, for example 
class.tx_myextension_newclass.php

Which files do i have to change and how, so that i will be able in the 
new class to write an insert query into the database like i do in the 
extension's original class?

Any document that describes exactly how i can do this will really 
appreciated.

Thanks a lot.

Hraklis Karvasonis.


Hraklis Karvasonis wrote:
> Hi.
> 
> I have the following code:
> 
> define('TYPO3_MOD_PATH', '../typo3conf/ext/my_extension/');
> $BACK_PATH = '../../../typo3/';
> require_once($BACK_PATH.'init.php');
> require_once(PATH_t3lib.'class.t3lib_extmgm.php');
> require_once(t3lib_extMgm::extPath('my_extension').'pi1/class.tx_myextension_pi1.php'); 
> 
> 
> class apply_form extends tx_myextension_pi1{
> 
>      function apply_form() {..}
> }
> if (defined('TYPO3_MODE') && 
> $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/my_extension/pi1/class.apply_form.php']) 
> {
>     include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/my_extension/pi1/class.apply_form.php']); 
> 
> }
> 
> I am creating a new class that extends the tx_myextension_pi1 class 
> (which is generated by Kickstarter).
> 
> I want to do, among other things, an insert query.
> $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_citjoboffers_jobapply',$field_values); 
> 
> 
> I can't make it work.
> 
> Error/Warning:
> Warning: main(../../../typo3/init.php): failed to open stream: No such 
> file or directory in 
> /home/webadmin/site.com/html/home/typo3conf/ext/my_extension/pi1/class.apply_form.php 
> on line 4
> 
> Fatal error: main(): Failed opening required '../../../typo3/init.php' 
> (include_path='.:/usr/share/pear') in 
> /home/webadmin/site.com/html/home/typo3conf/ext/my_extension/pi1/class.apply_form.php 
> on line 4
> 
> The new class is loaded in an iframe at the same page (I am not sure if 
> this is a problem).
> 
> 
> Any help would be appreciated!
> Thanks




More information about the TYPO3-dev mailing list