/[cvs]/nfo/php/libs/com.newsblob.phphtmllib/tag_utils/html_utils.inc
ViewVC logotype

Diff of /nfo/php/libs/com.newsblob.phphtmllib/tag_utils/html_utils.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by jonen, Sat Sep 20 00:15:57 2003 UTC revision 1.4 by jonen, Thu May 6 16:27:37 2004 UTC
# Line 15  Line 15 
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.
# Line 23  Line 25 
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    
# Line 119  function html_applet() { Line 121  function html_applet() {
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,
# Line 136  function html_area($href, $coords, $shap Line 139  function html_area($href, $coords, $shap
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  }  }
# Line 696  function html_iframe($src, $width="", $h Line 703  function html_iframe($src, $width="", $h
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);
# Line 720  function html_img( $image, $width='', $h Line 729  function html_img( $image, $width='', $h
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    
# Line 738  function html_img( $image, $width='', $h Line 751  function html_img( $image, $width='', $h
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  }  }
# Line 973  function html_ol( ) { Line 987  function html_ol( ) {
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    
# Line 988  function html_optgroup( ) { Line 1004  function html_optgroup( ) {
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  }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed