Welcome Guest, Not a member yet? Register   Sign In
Templating App Forms
#1

[eluser]xtremer360[/eluser]
I'm trying to develop a series of forms with my template that I am using for my Codeigniter application. I am using the form helper to put together my forms. I would like to cut down on a lot of code that is similar on all forms by making some sort of function that will run when a form is to be created.

For example:

Code:
<?php echo form_open('register', array('id' => 'register_form')); ?>
    <div class="row">
        <div class="col-md-12 padding-none border-right">
            <div class="innerLR">
                <div class="form-group">
                    &lt;?php
                    $attributes = array('class' => 'strong');
                    echo form_label('Username', 'username', $attributes);
                    $data = array('class' => 'input-block-level form-control', 'name' => 'username', 'placeholder' => 'Your Username');
                    echo form_input($data);
                    ?&gt;
                </div>
                <div class="form-group">
                    &lt;?php
                    $attributes = array('class' => 'strong');
                    echo form_label('Email', 'email', $attributes);
                    $data = array('class' => 'input-block-level form-control', 'name' => 'email_address', 'placeholder' => 'Your Email Address');
                    echo form_input($data);
                    ?&gt;
                </div>
                <div class="form-group">
                    &lt;?php
                    $attributes = array('class' => 'strong');
                    echo form_label('Password', 'password', $attributes);
                    $data = array('class' => 'input-block-level form-control', 'name' => 'password', 'placeholder' => 'Your Password');
                    echo form_password($data);
                    ?&gt;
                </div>
                <button class="btn btn-block btn-inverse" type="submit">Submit</button>
            </div>
        </div>
    </div>
&lt;?php echo form_close(); ?&gt;

What I want to figure out is how I can use a helper function to help create my forms. All forms include the divs that has classes and and forms with form inputs and labels that share the same classes.

Can someone show me the right direction as to how this could be accomplished?


Messages In This Thread
Templating App Forms - by El Forum - 12-10-2013, 12:36 PM
Templating App Forms - by El Forum - 12-10-2013, 01:09 PM
Templating App Forms - by El Forum - 12-10-2013, 01:16 PM
Templating App Forms - by El Forum - 12-10-2013, 01:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB