#3 Native OO Interface.

open
Maxx
5
2003-06-05
2003-06-05
Sjon
No

Another thing I'd like to see is a native oo interface
for this extension. I've attached an php code example
of how such an interface would look (The extensions in
there can be disregarded).

eg:
<?php

$t = new tmpl();
$t->open('test.tpl');
$t->set_global('random', mt_rand());
for ($i = 0; $i < 4; $i++) {
$t->iterate('/row');
$t->set('/row', array('one' => '1', 'two' => '2'));
}
echo $t->parse();

?>

Regards, Sjon

Discussion

  • Sjon
    Sjon
    2003-06-05

    php code of oo interface

     
    Attachments
  • Sjon
    Sjon
    2003-06-05

    • assigned_to: nobody --> su1d
     
  • Logged In: NO

    Why would you do this in c? Why not write a simple class (as
    I have done) in php?

     
  • Jan Ptacek
    Jan Ptacek
    2005-02-22

    Logged In: YES
    user_id=217316

    >Sender: nobody
    >Logged In: NO

    >Why would you do this in c? Why not write a simple class (as
    >I have done) in php?

    reason is simple: think of speed
    anyway, i think that parallell implementation in pure php
    would be handy for cases, where you have no access or powers
    to force web server admin into installing a C extension