Tag libraries
Posted: Fri Aug 10, 2007 4:46 pm
Does anyone know if the equivalent of JSP tag libraries has been written for PHP?
It's just XML which invokes tag handling classes as it's parsed. For example:
Would be parsed by a class like (in Java of course):
I could write something myself, but the logic gets complex when you start dealing with nested tags and re-evaluating markup so I'm just curious if anyone knows of anything like this already?
It's just XML which invokes tag handling classes as it's parsed. For example:
Code: Select all
<mytag:foo thing="bar" />Code: Select all
class FooTag extends SomeAbstractTag {
protected $thing;
public function setThing($thing) {
$this->thing = $thing;
}
public function getThing() {
return $this->thing;
}
public function doStartTag() {
echo "Tag encounted with thing=" . $this->getThing();
}
public function doEndTag() {
echo "Tag closed";
}
}