RE: [PEAR-DEV] yet another template
| From: | Naoki Shima | Date: | Tue, 06 Nov 2001 17:00:13 +0000 |
| Subject: | RE: [PEAR-DEV] yet another template | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-2584@lists.php.net to get a copy of this message | ||
Hello Jean-Michel,
>1) Yes,something like smarty's get_template_vars would be useful. It
>returns the list of variables and enables automatic processing, for example
>via a database repository.
You told me that you were going to submit me the code that enables to do
that.
I will include the code after testing.
>2) Basically I would like to be able to work with UTF-8 template and
>generate SJIS files or whatever.
>Have you thought about using mb_http_output('SJIS') to convert file output?
>Or shall we use recode_file (string request, resource input, resource
>output)? What is your opinion?
I use mb_convert_encoding() to convert encoding of string. You can convert
processed contents
right before the output by this method, but this would make your code
troublesome to maintain.
I've never used mb_http_output(), so I am not sure if it is stable.
My class uses mb* functions to parse the template file
and these functions are called without encoding option. This result in these
mb_* functions to use
encoding set by mbstring.internal_encoding in php.ini file.
If you set this option to UTF-8, used UTF-8 template and UTF-8 database,
there would be no problem.
You should ask this kind of question in PHP-I18N mailing-list. I think
they'd better know these things.
>3) Why not pearize smarty with multi-byte support and other enhancements. I
>can help you if my help is welcome.
I never used smarty, so I read through FAQ and QUICKSTART at their web site.
It is very feature rich, and template file compiling is something I have
been trying to implement in AT.php.
However, I think template engine should leave anything that it doesn't have
to do.
I am not trying to offend anybody. It's just that my goal is slightly
different from theirs.
Like I said, I have no experience with smarty, so I talked mostly with
assumptions.
Addtionally, smarty's template syntax requires use of regex and my way of
implementing multi-byte safe
template file parsing cannot handle their somewhat loose syntax.
I could utilize multi-byte safe regex "mbregex", but users have to fetch the
module and recompile PHP with it.
Maybe, we wait for another PHP release with its regex function handle
multi-byte string safely.
*Note: If you are developing Japanese web site, you should convert encoding
of email headers and body
to "JIS". (It's 7bit safe)
Anyway, give me your opinion.
Naoki Shima