Re[2]: [PEAR-DEV] Package proposal - HTML_FormPersister, HTML_SemiParser
| From: | Dmitry Koteroff | Date: | Tue, 18 Feb 2003 02:38:18 +0000 |
| Subject: | Re[2]: [PEAR-DEV] Package proposal - HTML_FormPersister, HTML_SemiParser | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-13434@lists.php.net to get a copy of this message | ||
Äîáðûé âå÷åð.
18.02.2003 2:43. Âû íàïèñàëè:
>> I'd like to propose 2 new packages:
>> HTML_FormPersister
> have you had a look at the existing packages: HTML_Quickform and
> HTML_OOH_Form ??
> What´s your package´s advantage over them, or what are the major
> differences in its implementation?
Of course I have had a look at HTML_Quickform. Now I see
HTML_OOH_Form too (it is not in PEAR repository now?).
I can say, that these packages are NOT universal enough. Example.
I want to improve phpBB (http://phpbb.org) - add persistent forms
there. How can I do it?
With HTML_FormPersister:
<?include_once "HTML/FormPersister.php";
ob_start("ob_formpersisterhandler")?>
<!-- that's all we need! -->
With other classes:
??? I cannot do that ???
Moreover, I develop HTML_FormPersister to find EASY way to
improve exist scripts. Yet another example about phpBB. I do not
like, that all the <img> tags in phpBB do not have width/height
attributes. It's terrible seen in browser (while loading). But I
CANNOT correct it by hand, because ALL the <img> tags is formed
in code, not in templates. HTML_FormPersister does not care about
it - it just works.
>> HTML_SemiParser
> I didn´t really get what this thing actually does from your description
> (sorry, didn´t have time to look at the code yet... it´s late and I´ve
> just seen a sneak preview of maybe the worst Angelina Jolie film ever
> :-( ... I´m in the mood for a nice little nap)
This packages is short analog of Perl's HTML::Parse class. Short
example:
<?
include_once "HTML/SemiParser.php";
class A extends HTML_SemiParser {
function A() { $this->HTML_SemiParser(); }
// automatic called while parsing ("tag_" prefix)
function tag_img() { }
// automatic called while parsing ("container_" prefix)
function container_textarea() { }
// custom (see below)
function Test($attr) {
$attr['some'] = 123;
return $attr;
}
}
// another custom function
function Test($attr) {
$attr['other'] = 456;
}
$p =& new A();
// Add more custom tags - tag chain
$p->addTag("test", array(&$p, "Test1")); // add method
$p->addTag("test", "Test"); // add static function
// Parse all - call callbacks & return result
echo htmlspecialchars($p->process("aaa <test a=1> bbb"));
P.S.
how to answer using this mail list? should I duplicate mail
to pear-dev@lists.php.net? does it correctly handle references?
--
Ñ óâàæåíèåì,
Äìèòðèé Êîòåðîâ (dk@dklab.ru), «Ëàáîðàòîðèÿ dk» (http://www.dklab.ru).