|
Posted by Evert | Rooftop Solutions on 10/12/02 11:15
Joe Wollard wrote:
> Evert,
>
> Have you looked at smarty (http://smarty.php.net) ? It doesn't do
> exactly what you're talking about but it seems to be the "Fastest
> templating mechanism" that I've tested; probably one of the most
> versatile as well.
>
> Cheers!
> -Joe
>
> www.joewollard.com
>
> Evert | Rooftop Solutions wrote:
>
>> Hi all,
>>
>> I'm working on a template system which works a bit like a text
>> translation block. The data looks for example like:
>>
>> beginblock <div class="block">
>> endblock </div>
>> beginauthor <span class="author">
>> endauthor </div>
>>
>>
>> The list is going to be very large, it will have several overlays and
>> not all pages need all items in the list. (usually just a fraction)
>>
>> What will be the smartest way to implement this? I need a low-memory
>> cost and fast solution
>> I can do it with a php script, like:
>>
>> $list = array(
>> 'beginblock' => '<div class="block">',
>>
>> etc.
>>
>> );
>>
>> but this will use up too much memory. I could additionally do it with
>> a textfile, but if I need to loop through it at every lookup it will
>> be slow..
>>
>> What are your suggestions?
>>
>> regards,
>> Evert
>>
Hi everyone,
Thanks for your replies. I Think I haven't been very clear about what I
really need. First of all, I don't need an existing templating system,
because I am working on my own templating system.
And regarding Satyam's post. This looks a lot like what I'm developing
right now, but also not my issue =)
What I really need is a fast lookup mechanism, to 'translate' statements.
For example:
setOutputType('xhtml');
echo(translate('authorstart'));
the function translate opens xhtml.data, which contains:
authorstart : <span class="author">
authorend : </span>
so, the translate function looks 'authorstart' up and returns '<span
class="author">'
or if you had specified 'wml' as the outputtype, the file could like like:
authorstart : <b>
authorend : </b>
and the function would return '<b>'
This is all no problem, except that these lists can be pretty big. And I
wouldn't like to load them all into the memory, or have to loop through
the file every time translate is called.
So I need a very fast mechanism to overcome this problem.
Any ideas?
grt,
Evert
Navigation:
[Reply to this message]
|