Доброе время суток. Сейчас я пытаюсь создать простейшее расширение, которое просто отоброжает калькулятор (извините, за примитивность), но почему то не получается с входными параметрами. Подскажите, как мне взять значение из текстовых полей и каким образом мне выводить потом результат? вот пример кода рнр:
Код:
class tx_nkcalc_pi1 extends tslib_pibase {
var $prefixId = 'tx_nkcalc_pi1'; // Same as class name
var $scriptRelPath = 'pi1/class.tx_nkcalc_pi1.php'; // Path to this script relative to the extension dir.
var $extKey = 'nk_calc'; // The extension key.
/**
* The main method of the PlugIn
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
* @return The content that is displayed on the website
*/
function main($content,$conf) {
$this->conf=$conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
$this->pi_USER_INT_obj=1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
if(isset($this->piVars['submit_button'])) {
t3lib_div::debug($this->piVars);
$result=$this->piVars['x']+ $this->piVars['y'];
}
else {
$content='
<h3>This is a form:</h3>
<form action="'.$this->pi_getPageLink($GLOBALS[" TSFE?]->id).'"' method="POST">
<input type="hidden" name="no_cache" value="1">
Первое число <input type="text" name="'.$this->prefixId.'[x]" value=""> <br />
Второе число <input type="text" name="'.$this->prefixId.'[y]" value=""><br />
<input type="submit" name="'.$this->prefixId.'[submit_button]" value="Расчитать">
</form>
<br />
<p>Результат <br/> </p>';
}
return $this->pi_wrapInBaseClass($content);
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/nk_calc/pi1/class.tx_nkcalc_pi1.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/nk_calc/pi1/class.tx_nkcalc_pi1.php']);
}
Но потом на странице, где в содержании размещено это расширение, потом ничего вообще не отображаеться. Помогите пожалуйста, вроде элементарное, но ничего не получается ((
Расширение создавала с помощью кикстартера, редактирую файл pi1/class.tx_nkcalc_pi1.php, пока не хочу использовать шаблоны.