4

他のプラグインの本体からtypo3プラグインを呼び出し、その結果をテンプレートに渡す必要があります。これは、これを実行して達成したいことを説明する擬似コードです。

$data['###SOME_VARIABLE###'] = $someOtherPlugin->main();
$this->cObj->substituteMarkerArray($someTemplate, $data);

出来ますか?

ありがとう!

4

5 に答える 5

6

リンクやマーカー関数など、円周率構造全体を使用すると機能し、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
于 2012-12-04T11:58:50.133 に答える
4

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
        }
    }

}
于 2011-08-29T09:26:45.400 に答える
1

@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);
于 2014-03-21T14:02:54.743 に答える
0

まず、使用する前に、またはクラスの外部に、プラグインクラスを含める必要があります。

include_once(t3lib_extMgm::extPath('myext').'pi1/class.tx_myext_pi1.php');

第二にあなたのコードで(例としてメインで)

$res = tx_myext_pi1::myMethod();
于 2011-08-26T13:53:27.953 に答える
0

これは確かに機能します(私はこれをチェックしました):http://lists.typo3.org/pipermail/typo3-english/2008-August/052259.html

おそらくフェディールの答えも正しいのですが、私はそれを試す機会がありませんでした。

乾杯!

于 2011-08-29T09:50:13.987 に答える