[Frage] yoububeapi: Fatal error: Call to a member function get() on a non-object [Gelöst] TYPO3-Version: 6.1.7

  • freeatweb freeatweb
    Jedi-Meister
    0 x
    267 Beiträge
    4 Hilfreiche Beiträge
    10. 04. 2014, 14:58

    Hallo,
    ich möchte die Extension youtubeapi auf einer TYPO3 6.1.7-Installation verwenden.

    Youtubeapi benötigt die Ext. div und lib.
    Um lib auf 6.1.7 funktionsfähig zu machen, habe ich folgende Änderungen vorgenommen:

    File class.tx_lib_t3loader.php:

    1. function makeInstanceClassName($class, $alternativeKey='', $prefix = 'class.', $suffix = '.php') {
    2. if(tx_lib_t3Loader::load($class, $alternativeKey, $prefix, $suffix)) {
    3. // diese Zeile return t3lib_div::makeInstanceClassName($class);
    4.  
    5. // ersetzt durch: return t3lib_div::makeInstance($class);
    6. } else {
    7. return false;
    8. }
    9. }

    class.tx_lib_parameters.php:
    [code]function tx_lib_parameters ($controller) {
    parent::tx_lib_object($controller);

    // diese Zeile ersetzt
    $this->setArray(t3lib_div::GParrayMerged($controller->getDesignator()));

    // durch
    $this->setArray(t3lib_div::_GPmerged($controller));

    // Initialize the cHash system if there are parameters available
    if ($GLOBALS['TSFE'] && count($parameters)) {
    $GLOBALS['TSFE']->reqCHash();
    }
    }
    [/code]

    Die Extension lib funktioniert nun soweit.
    Nur bekomme ich im Frontend den PHP-Error:

    Fatal error: Call to a member function get() on a non-object in \ext\youtubeapi\models\class.tx_youtubeapi_models_retrieve.php on line 39

    Hier ein Auszug aus dem PHP-File:

    1. tx_div::load('tx_lib_controller');
    2. tx_div::load('tx_lib_link');
    3.  
    4. class tx_youtubeapi_models_retrieve extends tx_lib_object {
    5. var $className = 'tx_youtubeapi_models_retrieve';
    6. var $extensionKey = 'tx_youtubeapi';
    7.  
    8. // constructor
    9. function tx_youtubeapi_models_retrieve($controller = null, $parameter = null) {
    10.  
    11. parent::tx_lib_object($controller,$parameter);
    12.  
    13. // get flexform-data
    14. --> LINE 38: $this->baseUrl = $this->controller->configurations->get('baseURL');

    Leider weiß ich jetzt nicht wie ich das lösen könnte bzw. durch was ich $this->controller->configurations->get()
    ersetzen könnte.

    Ich freue mich auf Ideen und Rückmeldungen

    Beste Grüße

  • freeatweb freeatweb
    Jedi-Meister
    0 x
    267 Beiträge
    4 Hilfreiche Beiträge
    15. 04. 2014, 21:31 - Lösung

    die controller aus der Ext. "lib" liefern keine Werte mehr :/
    ich hab zeitgründen eine "russische" Lösung programmiert:

    EXT: youtubeapi/models/class.tx_youtubeapi_models_retrieve.php

    1. // get flexform-data
    2. $this->baseUrl = $this->controller->configurations->get('baseURL');
    3. $this->maxResults = $this->controller->configurations->get('maxResults');
    4. if(!$this->maxResults) $this->maxResults = 5;
    5. $this->orderBy = $this->controller->configurations->get('orderBy');
    6. $this->startIndex = 1;
    7.  
    8. //$user = $this->controller->configurations->get('user');
    9. $this->channel = $this->controller->configurations->get('channel');
    10. $this->favorites = $this->controller->configurations->get('favorites');
    11. $this->searchTerm = $this->_searchable( $this->controller->configurations->get('searchTerm') );
    12. $this->category = $this->_categorized( $this->controller->configurations->get('category') );
    13. $this->keywords = $this->_keyworded( $this->controller->configurations->get('keywords') );
    14. $this->playlist = $this->controller->configurations->get('playList');

    ersetzt durch:

    1. $select = 'content.pi_flexform';
    2. $from = 'tt_content as content';
    3. $where = 'content.list_type = "tx_youtubeapi"';
    4. $where .= ' AND content.pid = ' . $GLOBALS['TSFE']->id;
    5.  
    6. $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where);
    7.  
    8. while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
    9. $xml = t3lib_div::xml2array($row['pi_flexform']);
    10.  
    11. $baseURL = 'http://gdata.youtube.com/feeds/api/';
    12. $maxResults = $xml['data']['listParams']['lDEF']['maxResults'];
    13. $orderBy = $xml['data']['listParams']['lDEF']['orderBy']['vDEF'];
    14.  
    15. $channel = $xml['data']['userRelated']['lDEF']['channel']['vDEF'];
    16. // $favorites = $xml['data']['userRelated']['lDEF']['channel']['vDEF'];
    17. $searchTerm = $xml['data']['userRelated']['lDEF']['searchTerm']['vDEF'];
    18. $category = $xml['data']['userRelated']['lDEF']['category']['vDEF'];
    19. $keywords = $xml['data']['userRelated']['lDEF']['keywords']['vDEF'];
    20. $playlist = $xml['data']['userRelated']['lDEF']['playList']['vDEF'];
    21. }
    22.  
    23. $this->baseUrl = $baseURL;
    24. $this->maxResults = $maxResults;
    25. if(empty($maxResults)) $this->maxResults = 5;
    26. $this->orderBy = $orderBy;
    27. $this->startIndex = 1;
    28. $this->channel = $channel;
    29. // $this->favorites = $this->controller->configurations->get('favorites');
    30. $this->searchTerm = $searchTerm;
    31. $this->category = $category;
    32. $this->keywords = $keywords;
    33. $this->playlist = $playlist;

    Über elegantere Lösungswege bin ich natürlich sehr froh ;)


  • 1
  • freeatweb freeatweb
    Jedi-Meister
    0 x
    267 Beiträge
    4 Hilfreiche Beiträge
    15. 04. 2014, 21:31

    die controller aus der Ext. "lib" liefern keine Werte mehr :/
    ich hab zeitgründen eine "russische" Lösung programmiert:

    EXT: youtubeapi/models/class.tx_youtubeapi_models_retrieve.php

    1. // get flexform-data
    2. $this->baseUrl = $this->controller->configurations->get('baseURL');
    3. $this->maxResults = $this->controller->configurations->get('maxResults');
    4. if(!$this->maxResults) $this->maxResults = 5;
    5. $this->orderBy = $this->controller->configurations->get('orderBy');
    6. $this->startIndex = 1;
    7.  
    8. //$user = $this->controller->configurations->get('user');
    9. $this->channel = $this->controller->configurations->get('channel');
    10. $this->favorites = $this->controller->configurations->get('favorites');
    11. $this->searchTerm = $this->_searchable( $this->controller->configurations->get('searchTerm') );
    12. $this->category = $this->_categorized( $this->controller->configurations->get('category') );
    13. $this->keywords = $this->_keyworded( $this->controller->configurations->get('keywords') );
    14. $this->playlist = $this->controller->configurations->get('playList');

    ersetzt durch:

    1. $select = 'content.pi_flexform';
    2. $from = 'tt_content as content';
    3. $where = 'content.list_type = "tx_youtubeapi"';
    4. $where .= ' AND content.pid = ' . $GLOBALS['TSFE']->id;
    5.  
    6. $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where);
    7.  
    8. while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
    9. $xml = t3lib_div::xml2array($row['pi_flexform']);
    10.  
    11. $baseURL = 'http://gdata.youtube.com/feeds/api/';
    12. $maxResults = $xml['data']['listParams']['lDEF']['maxResults'];
    13. $orderBy = $xml['data']['listParams']['lDEF']['orderBy']['vDEF'];
    14.  
    15. $channel = $xml['data']['userRelated']['lDEF']['channel']['vDEF'];
    16. // $favorites = $xml['data']['userRelated']['lDEF']['channel']['vDEF'];
    17. $searchTerm = $xml['data']['userRelated']['lDEF']['searchTerm']['vDEF'];
    18. $category = $xml['data']['userRelated']['lDEF']['category']['vDEF'];
    19. $keywords = $xml['data']['userRelated']['lDEF']['keywords']['vDEF'];
    20. $playlist = $xml['data']['userRelated']['lDEF']['playList']['vDEF'];
    21. }
    22.  
    23. $this->baseUrl = $baseURL;
    24. $this->maxResults = $maxResults;
    25. if(empty($maxResults)) $this->maxResults = 5;
    26. $this->orderBy = $orderBy;
    27. $this->startIndex = 1;
    28. $this->channel = $channel;
    29. // $this->favorites = $this->controller->configurations->get('favorites');
    30. $this->searchTerm = $searchTerm;
    31. $this->category = $category;
    32. $this->keywords = $keywords;
    33. $this->playlist = $playlist;

    Über elegantere Lösungswege bin ich natürlich sehr froh ;)

  • 1