简体   繁体   English

锂表单助手HTML模板

[英]Lithium form helper HTML template

I want to generate a) When writing b) I believe That Is possible with form helpers / templates . 我想生成a)在编写b)时,我相信使用表单助手/模板是可能的。

a) 一种)

<div class="SomeClass">
    <span>
        <i class="some OtherClass "></i>
    </span>
    <input type="text" ... >
</div>
<h4 class="error">Validation Message Goes Here</h4>

b ) b)

<?= $this->form->field('name',array('label'=>false, 'placeholder'=>'someHolder')); ? >

Lithium form class have amazing comments. 锂电池成型类有惊人的评论。

You should try something like this: 您应该尝试这样的事情:

<?php
echo $this->form->create(null);
echo $this->form->field(
    'name',
    [
        'template' => '<div{:wrap}><span><i class="some OtherClass"></i></span>{:input}</div>',
        'wrap' => ['class' => 'SomeClass'],
    ]
);
echo $this->form->error('name', null, ['template' => '<h4 class="error">{:content}</h4>']);
echo $this->form->end();
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM