Russian TYPO3 community

Russian TYPO3 community (http://forum.typo3.ru/index.php)
-   Общие вопросы (http://forum.typo3.ru/forumdisplay.php?f=12)
-   -   Проблема с subclassing (http://forum.typo3.ru/showthread.php?t=1828)

Boris 22.09.2006 00:48

Проблема с subclassing
 
Не могу понять в чём проблема.
Раньше делал subclassing для плагинов и для t3lib

Сегодня надо было добавить свою дополнительную методу для mc_googlesitemap

Сделал как обычно, в ext_localconf.php прописал:
PHP код:

$TYPO3_CONF_VARS['FE']['XCLASS']['ext/mc_googlesitemap/class.tx_mcgooglesitemap_base.php'] = t3lib_extMgm::extPath($_EXTKEY,'class.ux_tx_mcgooglesitemap_base.php'); 

Создал ux_tx_mcgooglesitemap_base.php и в нем:
PHP код:

<?
class ux_tx_mcgooglesitemap_base extends tx_mcgooglesitemap_base {
 
//Изменённая метода базового класса
function sitemapContent($array=array()) { 
t3lib_div::debug('sitemapContent');
if ( 
count($array) == ) { $array=$this->cObj->data; }
if ( 
$array['tx_mcgooglesitemap_objective'] == "tt_ipcshop" ) { 
return 
$this->sitemapMyExt($array); 
}else{
parent::sitemapContent($array);
}
}
 
//Дополнительная метода 
function sitemapMyExt($array=array()) {
t3lib_div::debug('sitemapIPCshop');
}
}

Но методы моего класса вообще не вызываются.

Для теста изменяю название базового класса:
PHP код:

class ux_tx_mcgooglesitemap_base extends tx_mcgooglesitemap_base2 

Выдаётся ошибка - класс не найден

Может кто-нибудь подскажет, где собака зарыта? :)

Дмитрий Самойлов 22.09.2006 12:10

Попробуй в начале ( перед class ux_tx_mcgooglesitemap_base ...) дописать нечто следующее
require_once(t3lib_extMgm::extPath('mc_googlesitem ap').'class.tx_mcgooglesitemap_base.php');
или
require_once(t3lib_extMgm::extPath('mc_googlesitem ap').'pi1/class.tx_mcgooglesitemap_base.php');

в зависимости от того где находится class.tx_mcgooglesitemap_base.php

Boris 22.09.2006 12:35

не помогает

А вообще зачем ето прописывать?
Ведь в class.tx_mcgooglesitemap_base.php прописано:
PHP код:

if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/mc_googlesitemap/class.tx_mcgooglesitemap_base.php"])
{
include_once (
$TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/mc_googlesitemap/class.tx_mcgooglesitemap_base.php"]);




Часовой пояс GMT +4, время: 21:11.

Работает на vBulletin® версия 3.8.1.
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Перевод: zCarot