HTML Input Tag Functions

Ok, in my previous post I started explaining what YaPHPfter is, and how it is all about recognizing patterns and reducing work for you, the coder. I also talked about how HTML input tags containt patterns, and how we can explout these patterns.

I went ahead and coded a HTML library which exploits these patterns, which can eventually be used in dynamically generating HTML forms from predefined meta-data.

It contains the following functions:

  • add_attributes
    This is an auxiliary function, which, once again, exploits patterns, and is used by all of the tag functions. It is passed an array of attributes with their values, and returns a string which can is then used in the creating of an HTML tag.
  • select_options
    This function is used by select_tag to generate the options for a select tag. It can also be used by the coder to generate the options for a select tag by passing down the options as an array. The value for the options can either be passed down as the keys of the array, or the text that is placed inside the tag will be used. A selected value can also be passed down.
  • input_tag
    The basic input tag. This function is basically the one I discussed in the previous post, but with some improvements!
  • textarea_tag
    As the textarea tag is basically another tag, it deserves it's own function. Although the value for a textarea isn't an attribute, it is passed in the attributes array with the key value. The function stores the value in another variable, and then removes the value attribute from the function.
  • select_tag
    Another input type. It uses the select_options function.
ByvoegingGroote
html.inc.php2.6 KB