string getTagName(
string
&$tag)
|
|
returns the name of the tag.
example: for <bs_form name="name" what="element"/> it returns 'bs_form'. may return an empty string if the tag is '<>'. if the tag is <!something/> it returns 'something', as it should.
Tags:
Parameters:
bool isCommentedOut(
string
&$tag, [bool
$lousy = FALSE])
|
|
tells if the tag is commented out.
example: <!--sometag key=param--/> there is a lousy typed version, example: <!sometag key=param/> especially used in html. if you set the param $lousy to true then this will be threated as "commented out" aswell.
note that the '!' or '!--' has to be right after the '<', no spacec allowed.
Tags:
Parameters:
array parseProperties(
mixed
$propertyString, [bool
$debug = FALSE], string
&$propertyString)
|
|
same as parseTag() but takes a tag string instead of a full tag.
example: "type=\"formelement\" type='formelement' type=formelement formelement>" instead of: "<bs type=\"formelement\" type='formelement' type=formelement formelement>"
Tags:
Parameters:
array parseTag(
mixed
$tag, [bool
$debug = FALSE], string
&$tag)
|
|
takes a tag (something like <bs_form name="name" what="element"/>) and parses its properties into a hash.
example: $tag = <bs type="formelement" name="name" multiple value='sam's pizzaland'/> $return = parseTag($tag); //now $return = array('type'=>'formelement', 'name'=>'name', 'multiple'=>TRUE, 'value'=>"sam's pizzaland");
tag properties may look different. as in html, the following versions are allowed: <bs type="formelement" type='formelement' type=formelement formelement> So properties can stand alone or can have a value, and the value can be in single quotes, double quotes or none at all. If a prop stands alone, it is treated like 'property=true' (bool). Cause in the hash we cannot set an undefined value like NULL. We'd have to make something up like 'bs_unset' which i don't want to.
The characters documented in Bs_HtmlUtil->filterForHtml() need to be translated to their html equivalents, not escaped. thus the following writings are *not* allowed: <bs value="my name is \"tom\"" value='sam\' pizzaland'>
Not allowed, as in html, is the writing <bs value=hello world> because 'world' would be a single property and does not belong to the value=hello.
Please be a bit careful when you write your tags. Things to avoid:
- tags that use more than 1 line (cr/lf)
- < tag name = hello / > <tag name = hello> (note the extra spaces)
As you can see in the example above, html special chars (&something) are converted for you.
Tags:
Parameters: