List Info

Thread: HTMP Template Proposal




HTMP Template Proposal
user name
2007-03-22 06:02:18
Hello,

I was looking for a PHP replacement for the php_template
extension.
The extension is able to parse a nested array in one go.

I have written a PEAR class to do this.

Usage example:

Template file 'page.tpl.htm':

<h1></h1>
<table>
  <tmpl:contacts>
  <tr>
    <td></td>
    <td></td>
  </tr></tmpl:contacts>
</table>


// Set up data array for the page
$data = array(
  'title' => 'Contacts List',
  'contacts' => array(
    array('name' => 'Doe', 'firstname' => 'John',
    array('name' => 'Smith', 'firstname' => 'Jane'
  )
);
// Create an instance of HTML_Template_DD
$oTpl = new HTML_Template_DD( );
// Set the template file
$res = $oTpl->getTplFile( 'page.tpl.htm' );
// Parse the template
$oTpl->parse( $data );
$oTpl->show();

The class has ca. 280 lines of code.

I wonder if this is worth proposing as a PEAR class?

More infos and download here:

https://www
.diggin-data.de/wiki/wiki/run.php?iRequest=wiki/ViewPage&
;iPage=PhpPearHTML_Template_DD

Thanks in advance,

--
Joachim Werner
Wiesbaden, Germany

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: HTMP Template Proposal
user name
2007-03-22 06:00:46
Joachim,

> More infos and download here:
> 
> https://www
.diggin-data.de/wiki/wiki/run.php?iRequest=wiki/ViewPage&
;iPage=PhpPearHTML_Template_DD

It seems only authorized people (username/password) may see
this page.

-- 
Regards/Mit freundlichen Grüßen
Christian Weiske

Re: HTMP Template Proposal
user name
2007-03-22 06:05:10
Sorry, the link is wrong.

Please use

http://www.diggin-data.de/wiki/static/PhpPearH
TML_Template_DD.html

Best Regards,

Joachim Werner

> Hello,
>
> I was looking for a PHP replacement for the
php_template extension.
> The extension is able to parse a nested array in one
go.
>
> I have written a PEAR class to do this.
>
> Usage example:
>
> Template file 'page.tpl.htm':
>
> <h1></h1>
> <table>
>   <tmpl:contacts>
>   <tr>
>     <td></td>
>     <td></td>
>   </tr></tmpl:contacts>
> </table>
>
>
> // Set up data array for the page
> $data = array(
>   'title' => 'Contacts List',
>   'contacts' => array(
>     array('name' => 'Doe', 'firstname' =>
'John',
>     array('name' => 'Smith', 'firstname' =>
'Jane'
>   )
> );
> // Create an instance of HTML_Template_DD
> $oTpl = new HTML_Template_DD( );
> // Set the template file
> $res = $oTpl->getTplFile( 'page.tpl.htm' );
> // Parse the template
> $oTpl->parse( $data );
> $oTpl->show();
>
> The class has ca. 280 lines of code.
>
> I wonder if this is worth proposing as a PEAR class?
>
> More infos and download here:
>
> https://www
.diggin-data.de/wiki/wiki/run.php?iRequest=wiki/ViewPage&
;iPage=PhpPearHTML_Template_DD
>
> Thanks in advance,
>
> --
> Joachim Werner
> Wiesbaden, Germany
>
> --
> PEAR Development Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub
.php
>
>

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: HTMP Template Proposal
user name
2007-03-22 08:13:47
I"m gonna put that under some stress tests and load
tests today.
However I must admit that the simplicity of the file makes
me like it.

Looks very clean so far, I'll just make couple of tests and
get back
to you on this one 

Thanks,

On 3/22/07, Joachim.wernerdiggin-data.de
<Joachim.wernerdiggin-data.de> wrote:
> Sorry, the link is wrong.
>
> Please use
>
> http://www.diggin-data.de/wiki/static/PhpPearH
TML_Template_DD.html
>
> Best Regards,
>
> Joachim Werner
>
> > Hello,
> >
> > I was looking for a PHP replacement for the
php_template extension.
> > The extension is able to parse a nested array in
one go.
> >
> > I have written a PEAR class to do this.
> >
> > Usage example:
> >
> > Template file 'page.tpl.htm':
> >
> > <h1></h1>
> > <table>
> >   <tmpl:contacts>
> >   <tr>
> >     <td></td>
> >     <td></td>
> >   </tr></tmpl:contacts>
> > </table>
> >
> >
> > // Set up data array for the page
> > $data = array(
> >   'title' => 'Contacts List',
> >   'contacts' => array(
> >     array('name' => 'Doe', 'firstname' =>
'John',
> >     array('name' => 'Smith', 'firstname' =>
'Jane'
> >   )
> > );
> > // Create an instance of HTML_Template_DD
> > $oTpl = new HTML_Template_DD( );
> > // Set the template file
> > $res = $oTpl->getTplFile( 'page.tpl.htm' );
> > // Parse the template
> > $oTpl->parse( $data );
> > $oTpl->show();
> >
> > The class has ca. 280 lines of code.
> >
> > I wonder if this is worth proposing as a PEAR
class?
> >
> > More infos and download here:
> >
> > https://www
.diggin-data.de/wiki/wiki/run.php?iRequest=wiki/ViewPage&
;iPage=PhpPearHTML_Template_DD
> >
> > Thanks in advance,
> >
> > --
> > Joachim Werner
> > Wiesbaden, Germany
> >
> > --
> > PEAR Development Mailing List (http://pear.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub
.php
> >
> >
>
> --
> PEAR Development Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub
.php
>
>


-- 
David Coallier,
Founder & Software Architect,
Agora Production (http://agoraproduction.com
)
51.42.06.70.18

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: HTMP Template Proposal
user name
2007-03-22 11:05:00
+1 ;)

IMHO we should be able to specify the template when
instantiating the class:

// Create an instance of HTML_Template_DD
$oTpl = new HTML_Template_DD('page.tpl.htm');

PS: where the 'DD' comes from ?

regards,
Igor.

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: HTMP Template Proposal
user name
2007-03-22 11:47:45
Igor,

thanks for the tipp; I have modified the constructor to set
the template
file as you suggested (see
http://www.diggin-data.de/wiki/static
/PhpPearHTML_Template_DD.html#Download).

Best regards,

Joachim

PS: DD is for "Diggin' Data"

On Thu, March 22, 2007 17:05, Igor Feghali wrote:
> +1 ;)
>
> IMHO we should be able to specify the template when
instantiating the
> class:
>
> // Create an instance of HTML_Template_DD
> $oTpl = new HTML_Template_DD('page.tpl.htm');
>
> PS: where the 'DD' comes from ?
>
> regards,
> Igor.
>
> --
> PEAR Development Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub
.php
>
>

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: HTMP Template Proposal
user name
2007-03-22 11:45:15
Took 299 seconds to process 192,233 rows of data on a
MacBook Core 2
Duo 2GHz, 1GB DDR2 PHP 4.4.4.

on line 153 you should add:

$oldKey = '';

to avoid a warning.

regards,
Igor.

On 3/22/07, David Coallier <davidcphp.net> wrote:
> I"m gonna put that under some stress tests and
load tests today.
> However I must admit that the simplicity of the file
makes me like it.
>
> Looks very clean so far, I'll just make couple of tests
and get back
> to you on this one 
>
> Thanks,
>
> On 3/22/07, Joachim.wernerdiggin-data.de
<Joachim.wernerdiggin-data.de> wrote:
> > Sorry, the link is wrong.
> >
> > Please use
> >
> > http://www.diggin-data.de/wiki/static/PhpPearH
TML_Template_DD.html
> >
> > Best Regards,
> >
> > Joachim Werner
> >
> > > Hello,
> > >
> > > I was looking for a PHP replacement for the
php_template extension.
> > > The extension is able to parse a nested array
in one go.
> > >
> > > I have written a PEAR class to do this.
> > >
> > > Usage example:
> > >
> > > Template file 'page.tpl.htm':
> > >
> > > <h1></h1>
> > > <table>
> > >   <tmpl:contacts>
> > >   <tr>
> > >     <td></td>
> > >     <td></td>
> > >   </tr></tmpl:contacts>
> > > </table>
> > >
> > >
> > > // Set up data array for the page
> > > $data = array(
> > >   'title' => 'Contacts List',
> > >   'contacts' => array(
> > >     array('name' => 'Doe', 'firstname'
=> 'John',
> > >     array('name' => 'Smith', 'firstname'
=> 'Jane'
> > >   )
> > > );
> > > // Create an instance of HTML_Template_DD
> > > $oTpl = new HTML_Template_DD( );
> > > // Set the template file
> > > $res = $oTpl->getTplFile( 'page.tpl.htm'
);
> > > // Parse the template
> > > $oTpl->parse( $data );
> > > $oTpl->show();
> > >
> > > The class has ca. 280 lines of code.
> > >
> > > I wonder if this is worth proposing as a PEAR
class?
> > >
> > > More infos and download here:
> > >
> > > https://www
.diggin-data.de/wiki/wiki/run.php?iRequest=wiki/ViewPage&
;iPage=PhpPearHTML_Template_DD
> > >
> > > Thanks in advance,
> > >
> > > --
> > > Joachim Werner
> > > Wiesbaden, Germany
> > >
> > > --
> > > PEAR Development Mailing List (http://pear.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub
.php
> > >
> > >
> >
> > --
> > PEAR Development Mailing List (http://pear.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub
.php
> >
> >
>
>
> --
> David Coallier,
> Founder & Software Architect,
> Agora Production (http://agoraproduction.com
)
> 51.42.06.70.18
>
> --
> PEAR Development Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub
.php
>
>

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1-7]

about | contact  Other archives ( Real Estate discussion Medical topics )