|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
pk86 Smarty n00b
Joined: 14 Jan 2011 Posts: 4
|
Posted: Sun Mar 05, 2017 11:02 am Post subject: Smarty manage forms |
|
|
Hi all, i have a simply (I hope) question, but i can't find a response.
I need a method for manage a custom fields for a form, i don't known if there is an existing plugin, or i should create it for me.
For example, i want manage a boostrap fields. A best practies for me can be:
In php file:
Code: |
$inputs->addForm('text', 'name', 'example');
$inputs->addForm('text', 'name2', 'example2');
$inputs->addForm('text', 'name3', 'example3');
$smarty->assign('input_form', $inputs);
|
In tpl file:
Code: |
<form action="./insert.php" method="post">
{$input_form}
</form>
|
And i want to generate this in HTML:
Code: |
<form action="./insert.php" method="post">
<div class="form-group">
<label for="name">name</label>
<input class="form-control" id="name" name="name" value="example">
</div>
<div class="form-group">
<label for="name2">name2</label>
<input class="form-control" id="nam2e" name="name2" value="example2">
</div>
<div class="form-group">
<label for="name3">name3</label>
<input class="form-control" id="name3" name="name3" value="example3">
</div>
</form>
|
Thanks & regards |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sun Mar 05, 2017 12:28 pm Post subject: |
|
|
__toString() ? |
|
Back to top |
|
pk86 Smarty n00b
Joined: 14 Jan 2011 Posts: 4
|
Posted: Sun Mar 05, 2017 12:58 pm Post subject: |
|
|
What do you mean? A single class for each input type? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sun Mar 05, 2017 4:31 pm Post subject: |
|
|
A class for each form. |
|
Back to top |
|
pk86 Smarty n00b
Joined: 14 Jan 2011 Posts: 4
|
Posted: Sat Mar 18, 2017 8:20 am Post subject: |
|
|
Thanks.
I've created one class for each input type (that have html code) and after one class for each form (that include necessary form type) |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|