Search code examples
phphelperlithiumform-helpers

Lithium form helper HTML template


I want to generate a) When writing b) I believe That Is possible with form helpers / templates .

a)

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

b )

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

Solution

  • 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();
    ?>