Answer the question
In order to leave comments, you need to log in
How to fix Undefined index: ActiveForm error in compiled Smarty template in Yii2?
The Smarty template renders a form:
{use class='yii\widgets\ActiveForm' type='block'}
{ActiveForm assign='form' id='login-form' action='/form-handler' options=['class' => 'form-horizontal']}
{$form->field($model, 'firstName')}
<div class="form-group">
<div class="col-lg-offset-1 col-lg-11">
<input type="submit" value="Login" class="btn btn-primary" />
</div>
</div>
{/ActiveForm}
<?php
$_smarty_tpl->getGlobal('_viewRenderer')->widgets['blocks']['ActiveForm'] = 'yii\widgets\ActiveForm';
try {
$_smarty_tpl->registerPlugin('block', 'ActiveForm', [$_smarty_tpl->getGlobal('_viewRenderer'), '_widget_block__ActiveForm']);
} catch (SmartyException $e) {
/* Ignore already registered exception during first execution after compilation */
}
?>
<?php $_smarty_tpl->smarty->_tag_stack[] = array('ActiveForm', array('assign' => 'form', 'id' => 'login-form', 'action' => '/backend/login/', 'options' => array('class' => 'uk-panel uk-panel-box uk-form')));
$_block_repeat = true;
echo $_smarty_tpl->smarty->registered_plugins['block']['ActiveForm'][0][0]->_widget_block__ActiveForm(array('assign' => 'form', 'id' => 'login-form', 'action' => '/backend/login/2', 'options' => array('class' => 'uk-panel uk-panel-box uk-form')), null, $_smarty_tpl, $_block_repeat);
while ($_block_repeat) {
ob_start(); ?>
<?php echo $_smarty_tpl->tpl_vars['form']->value->field($_smarty_tpl->tpl_vars['model']->value, 'username')->textInput(array('placeholder' => $_smarty_tpl->tpl_vars['model']->value->getAttributeLabel('username'), 'class' => 'form-group5'))->label(false); ?>
<?php echo $_smarty_tpl->tpl_vars['form']->value->field($_smarty_tpl->tpl_vars['model']->value, 'password')->passwordInput(array('placeholder' => $_smarty_tpl->tpl_vars['model']->value->getAttributeLabel('password')))->label(false); ?>
Answer the question
In order to leave comments, you need to log in
off-topic.
what a quiet horror. why do you complicate your life with third-party template engines? php is great as a template engine. in conjunction with yii even more so. if you have already learned the smart workbench, then it is even easier for him to learn php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question