PDA

Просмотр полной версии : Не цепляет значения piVars


SoulBurn
20.10.2008, 14:44
Собсно сабж...

Из инпутов должно вытягивать соответствующие значения в piVars, но не вытягивает...

Ниже пхп и хтмл-шаблон

Код:
function main($content,$conf) {

$this->conf = $conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
$this->pid_List();
$this->pi_USER_INT_obj=1;

$GLOBALS['TSFE']->additionalHeaderData['test'] .= '<link rel="stylesheet" type="text/css" href="'.t3lib_extMgm::siteRelPath('test').'res/css/test.css" />'.chr(10);

if($GLOBALS["TSFE"]->id==$this->pidList) $content = $this->displayList();
if($GLOBALS["TSFE"]->id==$this->pidSingle) $content = $this->displaySingle(t3lib_div::GPvar('uid'));
if($GLOBALS["TSFE"]->id==$this->pidReg) {
if (isset($this->piVars['submit_button'])) $this->saveData();
else $content = $this->regForm();
}
return $this->pi_wrapInBaseClass($content);
}
...
function regForm() {

$this->templateCode = $this->cObj->fileResource('EXT:test/res/test_template.html');
$template = $this->cObj->getSubpart($this->templateCode,'###TEST_REG###');

$labelMarker = array(
'###TEST_LABEL_HEAD###' => $this->pi_getLL('header'),
'###TEST_LABEL_NAME###' => $this->pi_getLL('name'),
'###TEST_LABEL_LNAME###' => $this->pi_getLL('lname'),
'###TEST_LABEL_EMAIL###' => $this->pi_getLL('email'),
'###REG_INPUT_VALUE###' => $this->pi_getLL('reg'),

'###VAL_NAME###' => $this->prefixId.'[name]',
'###VAL_LNAME###' => $this->prefixId.'[lname]',
'###VAL_EMAIL###' => $this->prefixId.'[email]',
'###REG_INPUT_NAME###' => $this->prefixId.'[submit_button]',

'###REG_ACTION###' => $this->pi_getPageLink($GLOBALS["TSFE"]->id)
);

$content = $this->cObj->substituteMarkerArrayCached($template,$labelMarker );

return $content;
}
...
function saveData() {

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid','tx_test_db_reg','','','uid DESC','1');

if($GLOBALS['TYPO3_DB']->sql_num_rows($res) == 0) $uid = 1;
else {
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);

if (!intval($row["uid"])) return 0;
$uid = $row["uid"]+1;
}

$insertArray = array(
'uid' => $uid,
'tstamp' => time(),
'crdate' => time(),
'name' => $this->piVars['name'],
'last_name' => $this->piVars['lname'],
'email' => $this->piVars['email']
);

$GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_test_db_reg',$insertArray);
header ('Location: '.t3lib_div::locationHeaderUrl('index.php?id='.$th is->pidList));

}


И шаблон:
<!-- ###TEST_REG### begin -->
<table class="table-single">
<tr class="table-single-header">
<th colspan="2">###TEST_LABEL_HEAD###</th>
</tr>
<tr>
<th class="table-single-body1">###TEST_LABEL_NAME###:</th>
<th class="table-single-body2">
<input name="###VAL_NAME###"/>
</th>
</tr>
<tr>
<th class="table-single-body1">###TEST_LABEL_LNAME###:</th>
<th class="table-single-body2">
<input name="###VAL_LNAME###"/>
</th>
</tr>
<tr>
<th class="table-single-body1">###TEST_LABEL_EMAIL###:</th>
<th class="table-single-body2">
<input name="###VAL_EMAIL###"/>
</th>
</tr>
<tr class="table-single-footer">
<th></th><th></th>
</tr>
<tr class="table-single-reg">
<form action="###REG_ACTION###" method="POST">
<th><input type=submit name="###REG_INPUT_NAME###" value="###REG_INPUT_VALUE###"></th>
</form>
</tr>
</table>
<!-- ###TEST_REG### end -->

SoulBurn
20.10.2008, 15:00
мдя....дурак....:o
включил эти инпуты в форму - всё заработало...
<!-- ###TEST_REG### begin -->
<form action="###REG_ACTION###" method="POST">
<table class="table-single">
<tr class="table-single-header">
<th colspan="2">###TEST_LABEL_HEAD###</th>
</tr>
<tr>
<th class="table-single-body1">###TEST_LABEL_NAME###:</th>
<th class="table-single-body2"><input name="###VAL_NAME###"/></th>
</tr>
<tr>
<th class="table-single-body1">###TEST_LABEL_LNAME###:</th>
<th class="table-single-body2"><input name="###VAL_LNAME###"/></th>
</tr>
<tr>
<th class="table-single-body1">###TEST_LABEL_EMAIL###:</th>
<th class="table-single-body2"><input name="###VAL_EMAIL###"/></th>
</tr>
<tr class="table-single-footer">
<th></th><th></th>
</tr>
<tr class="table-single-reg">
<th><input type=submit name="###REG_INPUT_NAME###" value="###REG_INPUT_VALUE###"></th>
</tr>
</table>
</form>
<!-- ###TEST_REG### end -->