File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,12 @@ class Html {
99
1010 /**
1111 * Returns the opening tag with the given attributes.
12- * @param string $tagName - the name of the tag
12+ * @param string $tagName - the name of the tag
1313 * @param array $attributes - the attributes to be rendered (values will be encoded accordingly)
14+ * @param array $closeTag - close the tag immediately by including the slash, e.g. <br/>
1415 * @return string the opening HTML tag rendered
1516 */
16- public static function renderStartTag ($ tagName , $ attributes = array ()) {
17+ public static function renderStartTag ($ tagName , $ attributes = array (), $ closeTag = FALSE ) {
1718 $ rc = '< ' .$ tagName ;
1819 foreach ($ attributes AS $ name => $ value ) {
1920 if (is_array ($ value )) $ value = implode (' ' , $ value );
@@ -22,6 +23,7 @@ public static function renderStartTag($tagName, $attributes = array()) {
2223 }
2324 }
2425
26+ if ($ closeTag ) $ rc .= '/ ' ;
2527 $ rc .= '> ' ;
2628 return $ rc ;
2729 }
@@ -34,4 +36,4 @@ public static function renderStartTag($tagName, $attributes = array()) {
3436 public static function renderEndTag ($ tagName ) {
3537 return '</ ' .$ tagName . '> ' ;
3638 }
37- }
39+ }
You can’t perform that action at this time.
0 commit comments