Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions

  




 

 

Ruby Programming
Previous Page Home Next Page

HTML Output Methods

In addition, CGI supports the following HTML output methods. Each of these methods is named after the corresponding HTML feature (or close to it). Those tags that require content (such as blockquote) take an optional block; the block should return a String that will be used as the content for the feature. These methods may take arguments as indicated, or as a hash with the given names as keys.

\

a( url )
a( HREF => )


base( url )
base( HREF => )


blockquote( cite="" ) { aString }
blockquote( CITE => ) { aString }


caption( align=nil ) { aString }
caption( ALIGN => ) { aString }


checkbox( name=nil, value=nil, checked=nil )
checkbox( NAME, VALUE, CHECKED => )


checkbox_group( name=nil, [ items ]+ )
checkbox_group( NAME, VALUES => )

Items may be individual String names, or any of: an array of [ namechecked ], an array of [ valuename ], or an array of [ valuenamechecked ]. The value for the hash key VALUES should be an array of these items.


file_field( name="", size=20, maxlength=nil )
file_field( NAME, SIZE, MAXLENGTH => )


form( method="post", action=nil, enctype="application/x-www-form-urlencoded" ) { aStr }
form( METHOD, ACTION, ENCTYPE => ) { aStr }


hidden( name="", value=nil )
hidden( NAME, VALUE => )


html( ) { aString }
html( PRETTY, DOCTYPE => ) { aString }


img_button( src="", name=nil, alt=nil )
img_button( SRC, NAME, ALT => )


img( src="", alt="", width=nil, height=nil )
img( SRC, ALT, WIDTH, HEIGHT => )


multipart_form( action=nil, enctype="multipart/form-data" ) { aString }
multipart_form( METHOD, ACTION, ENCTYPE => ) { aString }


password_field( name="", value=nil, size=40, maxlength=nil )
password_field( NAME, VALUE, SIZE, MAXLENGTH => )


popup_menu( name="", items )
popup_menu( NAME, SIZE, MULTIPLE, VALUES (array of items) => )

Items may be individual String names, or any of: an array of [ nameselected ], an array of [ valuename ], or an array of [ valuenameselected ]. The value for the hash key VALUES should be an array of these items.


radio_button( name="", value=nil, checked=nil )
radio_button( NAME, VALUE, CHECKED => )


radio_group( name="", items )
radio_group( NAME, VALUES (array of items) => )

Items may be individual String names, or any of: an array of [ nameselected ], an array of [ valuename ], or an array of [ valuenameselected ]. The value for the hash key VALUES should be an array of these items.


reset( value=nil, name=nil )
reset( VALUE, NAME => )


scrolling_list( alias for popup_menu )
scrolling_list( => )


submit( value=nil, name=nil )
submit( VALUE, NAME => )


text_field( name="", value=nil, size=40, maxlength=nil )
text_field( NAME, VALUE, SIZE, MAXLENGTH => )


textarea( name="", cols=70, rows=10 )
textarea( NAME, COLS, ROWS => )

\

In addition, all HTML tags are supported as methods, including title, head, body, br, pre, and so on. The block given to the method must return a String, which will be used as the content for that tag type. Not all tags require content: <P>, for example, does not. The available tags vary according to the supported HTML level---Table 26.1 on page 503 lists the complete set. For these methods, you can pass in a hash with attributes for the given tag. For instance, you might pass in 'BORDER'=>'5' to the table method to set the border width of the table.
HTML tags available as methods
{HTML 3}
a address applet area b base basefont big blockquote body br caption center cite code dd dfn dir div dl dt em font form h1 h2 h3 h4 h5 h6 head hr html i img input isindex kbd li link listing map menu meta ol option p param plaintext pre samp script select small strike strong style sub sup table td textarea th title tr tt u ul var xmp
{HTML 4}
a abbr acronym address area b base bdo big blockquote body br button caption cite code col colgroup dd del dfn div dl dt em fieldset form h1 h2 h3 h4 h5 h6 head hr html i img input ins kbd label legend li link map meta noscript object ol optgroup option p param pre q samp script select small span strong style sub sup table tbody td textarea tfoot th thead title tr tt ul var
{HTML 4 Transitional}
a abbr acronym address applet area b base basefont bdo big blockquote body br button caption center cite code col colgroup dd del dfn dir div dl dt em fieldset font form h1 h2 h3 h4 h5 h6 head hr html i iframe img input ins isindex kbd label legend li link map menu meta noframes noscript object ol optgroup option p param pre q s samp script select small span strike strong style sub sup table tbody td textarea tfoot th thead title tr tt u ul var
frame frameset

Ruby Programming
Previous Page Home Next Page

 
 
  Published under the terms of the Open Publication License Design by Interspire