他のプラグインの本体からtypo3プラグインを呼び出し、その結果をテンプレートに渡す必要があります。これは、これを実行して達成したいことを説明する擬似コードです。
$data['###SOME_VARIABLE###'] = $someOtherPlugin->main();
$this->cObj->substituteMarkerArray($someTemplate, $data);
出来ますか?
ありがとう!
他のプラグインの本体からtypo3プラグインを呼び出し、その結果をテンプレートに渡す必要があります。これは、これを実行して達成したいことを説明する擬似コードです。
$data['###SOME_VARIABLE###'] = $someOtherPlugin->main();
$this->cObj->substituteMarkerArray($someTemplate, $data);
出来ますか?
ありがとう!
リンクやマーカー関数など、円周率構造全体を使用すると機能し、TSFEデータが破損する可能性があります。
ドミトリーは言った:http: //lists.typo3.org/pipermail/typo3-english/2008-August/052259.html
$cObjType = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_rgsmoothgallery_pi1'];
$conf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_rgsmoothgallery_pi1.'];
$cObj = t3lib_div::makeInstance('tslib_cObj');
$cObj->start(array(), '_NO_TABLE');
$conf['val'] = 1;
$content = $cObj->cObjGetSingle($cObjType, $conf); //calling the main method
t3lib_div:makeInstanceメソッドを使用する必要があります。
TYPO3の「powermail」拡張からの実用的な例があります。
function getGeo() {
// use geo ip if loaded
if (t3lib_extMgm::isLoaded('geoip')) {
require_once( t3lib_extMgm::extPath('geoip').'/pi1/class.tx_geoip_pi1.php');
$this->media = t3lib_div::makeInstance('tx_geoip_pi1');
if ($this->conf['geoip.']['file']) { // only if file for geoip is set
$this->media->init($this->conf['geoip.']['file']); // Initialize the geoip Ext
$this->GEOinfos = $this->media->getGeoIP($this->ipOverride ? $this->ipOverride : t3lib_div::getIndpEnv('REMOTE_ADDR')); // get all the infos of current user ip
}
}
}
@mitchiruの答えは素晴らしく、基本的に正しいです。
Kickstarterで外部拡張機能を作成し、pi_baseを使用している場合は、すでにtslib_cObjのインスタンスがあり、構成全体がより単純になります。
// get type of inner extension, eg. USER or USER_INT
$cObjType = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_innerextension_pi1'];
// get configuration array of inner extension
$cObjConf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_innerextension_pi1.'];
// add own parameters to configuration array if needed - otherwise skip this line
$cObjConf['myparam'] = 'myvalue';
// call main method of inner extension, using cObj of outer extension
$content = $this->cObj->cObjGetSingle($cObjType, $cObjConf);
まず、使用する前に、またはクラスの外部に、プラグインクラスを含める必要があります。
include_once(t3lib_extMgm::extPath('myext').'pi1/class.tx_myext_pi1.php');
第二にあなたのコードで(例としてメインで)
$res = tx_myext_pi1::myMethod();
これは確かに機能します(私はこれをチェックしました):http://lists.typo3.org/pipermail/typo3-english/2008-August/052259.html。
おそらくフェディールの答えも正しいのですが、私はそれを試す機会がありませんでした。
乾杯!