Welcome Guest, Not a member yet? Register   Sign In
Form Helper: input image
#1

[eluser]Unknown[/eluser]
This might help you folks!

Extend Form Helper:
Code:
function form_img($data = '', $src = '', $extra = '')
{
  $defaults = array('type' => 'image', 'name' => (( ! is_array($data)) ? $data :

  return "<input "._parse_form_attributes($data, $defaults).$extra." />";
}

Sample Output:
Code:
<input name="some_name" src="path/to/picture.jpg" type="image">
#2

[eluser]j√°quer[/eluser]
I did come in looking for just this, but I believe your code got cut off. It's supposed to be:

Code:
function form_img($data = '', $src = '', $extra = '')
{
  $defaults = array('type' => 'image', 'name' => (( ! is_array($data)) ? $data : ''), 'src' => $src);

  return "<input "._parse_form_attributes($data, $defaults).$extra." />";
}

And to help people that don't know how to apply this, you have to create an "application/helpers/MY_form_helper.php" with the above code.
#3

[eluser]Unknown[/eluser]
Oops, I overlooked that. Thanks for spotting and fixing it! Smile




Theme © iAndrew 2016 - Forum software by © MyBB