15 |
|
|
16 |
/** |
/** |
17 |
* build an href with content and attributes. |
* build an href with content and attributes. |
18 |
|
* |
19 |
|
* @tutorial HTMLTagClass.cls#helper |
20 |
* |
* |
21 |
* @author Walt A. Boring |
* @author Walt A. Boring |
22 |
* @param string $url - the url to go to. |
* @param string $url - the url to go to. |
25 |
* @param string $target - the target browser |
* @param string $target - the target browser |
26 |
* window/frame for the url. |
* window/frame for the url. |
27 |
* @param string $title - the title attribute |
* @param string $title - the title attribute |
28 |
* @return BRtag object. |
* @return Atag object. |
29 |
*/ |
*/ |
30 |
function html_a($url, $content, $class=NULL, $target=NULL, $title=NULL) { |
function html_a($url, $content, $class=NULL, $target=NULL, $title=NULL) { |
31 |
|
|
121 |
* @param string - the alt text |
* @param string - the alt text |
122 |
* @param string - the target |
* @param string - the target |
123 |
* _blank, _parent, _self, _top |
* _blank, _parent, _self, _top |
124 |
|
* @param string - the title text |
125 |
* |
* |
126 |
* @return AREAtag object. |
* @return AREAtag object. |
127 |
*/ |
*/ |
128 |
function html_area($href, $coords, $shape="rect", |
function html_area($href, $coords, $shape="rect", |
129 |
$alt="", $target="") { |
$alt="", $target="", $title="") { |
130 |
|
|
131 |
$attributes = array("href" => $href, |
$attributes = array("href" => $href, |
132 |
"coords" => $coords, |
"coords" => $coords, |
139 |
$attributes["target"] = $target; |
$attributes["target"] = $target; |
140 |
} |
} |
141 |
|
|
142 |
|
if ($title != "") { |
143 |
|
$attributes["title"] = $title; |
144 |
|
} |
145 |
|
|
146 |
$tag = new AREAtag( $attributes ); |
$tag = new AREAtag( $attributes ); |
147 |
return $tag; |
return $tag; |
148 |
} |
} |
703 |
* @param int - $border - border flag. |
* @param int - $border - border flag. |
704 |
* @param string - $alt - alt tag for the image |
* @param string - $alt - alt tag for the image |
705 |
* @param string - $usemap - the image map name |
* @param string - $usemap - the image map name |
706 |
|
* @param string - $align - the align attribute |
707 |
* @return IMGtag object. |
* @return IMGtag object. |
708 |
*/ |
*/ |
709 |
function html_img( $image, $width='', $height='', $border=0, |
function html_img( $image, $width='', $height='', $border=0, |
710 |
$alt="", $usemap=NULL, $title=NULL ) { |
$alt="", $usemap=NULL, $title=NULL, |
711 |
|
$align=NULL ) { |
712 |
$attributes = array( "src" => $image, |
$attributes = array( "src" => $image, |
713 |
"border" => $border, |
"border" => $border, |
714 |
"alt" => $alt); |
"alt" => $alt); |
729 |
$attributes["title"] = $title; |
$attributes["title"] = $title; |
730 |
} |
} |
731 |
|
|
732 |
|
if ($align != NULL) { |
733 |
|
$attributes["align"] = $align; |
734 |
|
} |
735 |
|
|
736 |
return new IMGtag( $attributes ); |
return new IMGtag( $attributes ); |
737 |
} |
} |
738 |
|
|
751 |
* @param string - $usemap - the image map name |
* @param string - $usemap - the image map name |
752 |
* @param string - $target - the <a target="blah"> |
* @param string - $target - the <a target="blah"> |
753 |
* @param string - $title - the title attribute |
* @param string - $title - the title attribute |
754 |
|
* @param string - $align - the align attribute |
755 |
* @return Atag object with <img> as content |
* @return Atag object with <img> as content |
756 |
* |
* |
757 |
*/ |
*/ |
758 |
function html_img_href( $url, $image, $width='', $height='', $border=0, |
function html_img_href( $url, $image, $width='', $height='', $border=0, |
759 |
$alt="", $usemap=NULL, $target=NULL, $title=NULL) { |
$alt="", $usemap=NULL, $target=NULL, $title=NULL, $align=NULL) { |
760 |
$img = html_img($image, $width, $height, $border, $alt, $usemap, $title); |
$img = html_img($image, $width, $height, $border, $alt, $usemap, $title, $align); |
761 |
$a = html_a($url, $img, NULL, $target); |
$a = html_a($url, $img, NULL, $target); |
762 |
return $a; |
return $a; |
763 |
} |
} |
987 |
* as content for the tag. |
* as content for the tag. |
988 |
* @return OPTGROUPtag object. |
* @return OPTGROUPtag object. |
989 |
*/ |
*/ |
990 |
function html_optgroup( ) { |
function html_optgroup($label) { |
991 |
$tag = new OPTGROUPtag; |
$tag = new OPTGROUPtag( array("label" => $label)); |
992 |
$args = func_get_args(); |
$num_args = func_num_args(); |
993 |
call_user_func_array( array(&$tag, "add"), $args); |
for ($i=1;$i<$num_args;$i++) { |
994 |
|
$tag->add(func_get_arg($i)); |
995 |
|
} |
996 |
return $tag; |
return $tag; |
997 |
} |
} |
998 |
|
|
1004 |
* |
* |
1005 |
* @return OPTIONtag object. |
* @return OPTIONtag object. |
1006 |
*/ |
*/ |
1007 |
function html_option($value, $content) { |
function html_option($value, $content, $selected=FALSE) { |
1008 |
$tag = new OPTIONtag( array("value"=> $value) ); |
$tag = new OPTIONtag( array("value"=> $value) ); |
1009 |
|
if ($selected) { |
1010 |
|
$tag->set_tag_attribute("SELECTED"); |
1011 |
|
} |
1012 |
$tag->add( $content ); |
$tag->add( $content ); |
1013 |
return $tag; |
return $tag; |
1014 |
} |
} |