I am putting together many different modules for use in my Codeigniter application. Also included in this application are many different themes. What I would like to know how to do is if I have instead of having to continue to make the same forms for example the login has the same structure across all themes and just the look is obviously different. I want to know what I can do so that I only have to create one login form view inside of the user modules folder and have them current theme know how to handle it.
To explain further. Lets say the forms have the same text fields but maybe there's something added by a theme that isn't included on the other themes such as the following. In this example this is from one of my themes where there may be a class or something that is added to a div or maybe another theme doesn't have divs surrounding the input tags. Any ideas on what could possibly be done.
<form id="login_form" action="" role="form">
<div class="form-group relative-w">
<input type="email" name="email_address" class="form-control" placeholder="Email Address">
<i class="fa fa-user input-abs-icon"></i>
</div>
<div class="form-group relative-w">
<input type="password" name="password" class="form-control" placeholder="Password">
<i class="fa fa-lock input-abs-icon"></i>
</div>
<button class="btn btn-primary btn-rounded btn-iconed"> <span>Log me in</span> <i class="fa fa-arrow-right"></i> </button>
</form>
You can do this with CSS.
echo '<link rel="stylesheet" type="text/css" href="css/'.$style.'.css">';
or
$this->load->helper('html');
echo link_tag("css/$style.css");
Update
You say
...for example the login has the same structure across all themes and just the look is obviously different. I want to know what I can do so that I only have to create one login form view inside of the user modules folder and have them current theme know how to handle it.
Then you say
...of my themes where there may be a class or something that is added to a div or maybe another theme doesn't have divs surrounding the input tags
I think you need to first figure out what you want.
If all of the themes have the same HTML structure, you can use different CSS files to change the look.
If the structure will NOT be the same, the question may be moot because you will need to create separate versions of the login forms anyway.*
That all said, there is some template stuff out there that may be worth looking into:
http://ellislab.com/codeigniter%20/user-guide/libraries/parser.html
https://github.com/philsturgeon/codeigniter-template
*This isn't to say you couldn't have a bunch of if/else
statements in your view to accommodate changes in HTML based on theme...but that doesn't seem right.