Re: [PHP] working on a template system...

2006-07-01 Thread Martin Marques

On Thu, 29 Jun 2006, Charlene Wroblewski wrote:


*joining the fray a little late*

What is the difference between this, Smarty and template.inc? 
I have found Smarty to be unusable in my situation where a graphic designer 
needs to be able to edit the html and is easily confused by non-html.


So, I am using template.inc which is apparently old (PHP 3) but seems to work 
great even with PHP 4.1.  Another question is whether it will work with PHP 
5?


Try HTML_Template_IT from PEAR. Excelente! We use it with web designers 
that know nothing about programming.


--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
-
Lic. Martín Marqués |   SELECT 'mmarques' || 
Centro de Telemática|   '@' || 'unl.edu.ar';

Universidad Nacional|   DBA, Programador,
del Litoral |   Administrador
-
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] working on a template system...

2006-06-29 Thread Charlene Wroblewski

*joining the fray a little late*

What is the difference between this, Smarty and template.inc? 

I have found Smarty to be unusable in my situation where a graphic 
designer needs to be able to edit the html and is easily confused by 
non-html.


So, I am using template.inc which is apparently old (PHP 3) but seems to 
work great even with PHP 4.1.  Another question is whether it will work 
with PHP 5?


Charlene

sempsteen wrote:


hi, i'm working on a template system. Basically i'm building raw
contents in arrays and then put them in templates by some special
tags.

for loop systems my basic array structure is like this:
$array['key'][]['keyword'] = ...

for example, for a bulletin board system, array structure for
categories is something like this:
$array['categories'][]['text_category_name'] = ...

it is looped through database recordset, so final array for 2 
categories can be:

$array['categories'][0]['text_category_name'] = 'programming'
$array['categories'][1]['text_category_name'] = 'life'

template file structure for loops is something like this (ex, 
categories):

!-- loop|categories:bof --
tr
  td[$text_category_name$]/td
/tr
!-- loop|categories:eof --

i can easily loop this template and replace [$text_category_name] for
every category set in the array. after removing the comment tags i get
the final content:

tr
  tdprogramming/td
/tr
tr
  tdlife/td
/tr

But i'm stuck with nested loops. For example i want to put related
forums after each categories.

array structure is:
$array['categories'][0]['text_category_name'] = programming
$array['categories'][0]['forums'][0]['text_forum_name'] = php
$array['categories'][0]['forums'][1]['text_forum_name'] = ruby

$array['categories'][1]['text_category_name'] = life
$array['categories'][1]['forums'][0]['text_forum_name'] = music
$array['categories'][1]['forums'][1]['text_forum_name'] = sports

template structure is:
!-- loop|categories:bof --
tr
  td[$text_category_name$]/td
/tr
!-- loop|forums:bof --
tr
  td[$text_forum_name$]/td
/tr
!-- loop|forums:eof --
!-- loop|categories:eof --

i've written some functions, used them recursively but it didn't work.
actually i couldn't find the true logic. note that it isn't a limited
array. it can have messages under each forums, peoples under each
messages, so on..

help me find the true approach to handle this. thank you.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread Martin Marques

On Wed, 28 Jun 2006, Ligaya Turmelle wrote:


Martin Marques wrote:
Why not try to use one of the template systems that already exist? 
HTML_Template_IT, Smarty, etc.



Or just use PHP...


Because it's a mess.

--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
-
Lic. Martín Marqués |   SELECT 'mmarques' || 
Centro de Telemática|   '@' || 'unl.edu.ar';

Universidad Nacional|   DBA, Programador,
del Litoral |   Administrador
-
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] working on a template system...

2006-06-28 Thread Robert Cummings
On Wed, 2006-06-28 at 07:32, Martin Marques wrote:
 On Wed, 28 Jun 2006, Ligaya Turmelle wrote:
 
  Martin Marques wrote:
  Why not try to use one of the template systems that already exist? 
  HTML_Template_IT, Smarty, etc.
  
  Or just use PHP...
 
 Because it's a mess.

Agreed. Mr. nail, come meet Mr. hammer :B

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread tedd
At 8:32 AM -0300 6/28/06, Martin Marques wrote:
On Wed, 28 Jun 2006, Ligaya Turmelle wrote:

Martin Marques wrote:
Why not try to use one of the template systems that already exist? 
HTML_Template_IT, Smarty, etc.

Or just use PHP...

Because it's a mess.


That's because it got out of hand. Now, practice the 3R's, regroup, rethink, 
and redo.

tedd

-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread Robert Cummings
On Wed, 2006-06-28 at 12:28, tedd wrote:
 At 8:32 AM -0300 6/28/06, Martin Marques wrote:
 On Wed, 28 Jun 2006, Ligaya Turmelle wrote:
 
 Martin Marques wrote:
 Why not try to use one of the template systems that already exist? 
 HTML_Template_IT, Smarty, etc.
 
 Or just use PHP...
 
 Because it's a mess.
 
 
 That's because it got out of hand. Now, practice the 3R's, regroup, rethink, 
 and redo.

That's why they're using templates.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread Martin Alterisio

2006/6/28, Robert Cummings [EMAIL PROTECTED]:


On Wed, 2006-06-28 at 07:32, Martin Marques wrote:
 On Wed, 28 Jun 2006, Ligaya Turmelle wrote:

  Martin Marques wrote:
  Why not try to use one of the template systems that already exist?
  HTML_Template_IT, Smarty, etc.
 
  Or just use PHP...

 Because it's a mess.

Agreed. Mr. nail, come meet Mr. hammer :B



And keep Mr. hammer away from Mr. finger

Cheers,

Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] working on a template system...

2006-06-28 Thread Jon Anderson
I really don't understand why people have such disregard for PHP as a 
template system... I'm not saying one way is better or worse (it's 
really a matter of preference), just that the PHP way isn't implicitly 
bad or messy...


/* The Smarty way */
$smarty-assign('display_variable',$display_variable);
...
{* template *}
dl
 {foreach key=key item=var from=$display_variable}
   dt{$key}/dtdd{$var}/dd
 {/foreach}
/dl

/* The PHP way */
dl
 ?php foreach ($display_variable as $key = $var) { ?
   dt?= $key?/dtdd?= $var ?/dd
 ?php } /* end foreach ($display_variable) */ ?
/dl

Is it really *that* bad?

jon

Martin Alterisio wrote:

2006/6/28, Robert Cummings [EMAIL PROTECTED]:


On Wed, 2006-06-28 at 07:32, Martin Marques wrote:
 On Wed, 28 Jun 2006, Ligaya Turmelle wrote:

  Martin Marques wrote:
  Why not try to use one of the template systems that already exist?
  HTML_Template_IT, Smarty, etc.
 
  Or just use PHP...

 Because it's a mess.

Agreed. Mr. nail, come meet Mr. hammer :B



And keep Mr. hammer away from Mr. finger 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread tedd
At 1:30 PM -0400 6/28/06, Robert Cummings wrote:
On Wed, 2006-06-28 at 12:28, tedd wrote:
 At 8:32 AM -0300 6/28/06, Martin Marques wrote:
 On Wed, 28 Jun 2006, Ligaya Turmelle wrote:
 
 Martin Marques wrote:
 Why not try to use one of the template systems that already exist? 
 HTML_Template_IT, Smarty, etc.
 
 Or just use PHP...
 
 Because it's a mess.
 

 That's because it got out of hand. Now, practice the 3R's, regroup, rethink, 
 and redo.

That's why they're using templates.

Cheers,
Rob.

To make a mess?  :-)

tedd

-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread Robert Cummings
On Wed, 2006-06-28 at 13:55, Jon Anderson wrote:
 I really don't understand why people have such disregard for PHP as a 
 template system... I'm not saying one way is better or worse (it's 
 really a matter of preference), just that the PHP way isn't implicitly 
 bad or messy...
 
 /* The Smarty way */
 $smarty-assign('display_variable',$display_variable);
 ...
 {* template *}
 dl
   {foreach key=key item=var from=$display_variable}
 dt{$key}/dtdd{$var}/dd
   {/foreach}
 /dl
 
 /* The PHP way */
 dl
   ?php foreach ($display_variable as $key = $var) { ?
 dt?= $key?/dtdd?= $var ?/dd
   ?php } /* end foreach ($display_variable) */ ?
 /dl
 
 Is it really *that* bad?

YES!

Simplistic examples don't properly illustrate the mess that occurs in
complex situations.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread Robert Cummings
On Wed, 2006-06-28 at 13:59, tedd wrote:
 At 1:30 PM -0400 6/28/06, Robert Cummings wrote:
 On Wed, 2006-06-28 at 12:28, tedd wrote:
  At 8:32 AM -0300 6/28/06, Martin Marques wrote:
  On Wed, 28 Jun 2006, Ligaya Turmelle wrote:
  
  Martin Marques wrote:
  Why not try to use one of the template systems that already exist? 
  HTML_Template_IT, Smarty, etc.
  
  Or just use PHP...
  
  Because it's a mess.
  
 
  That's because it got out of hand. Now, practice the 3R's, regroup, 
  rethink, and redo.
 
 That's why they're using templates.
 
 Cheers,
 Rob.
 
 To make a mess?  :-)

No, to clean up a mess. They've regrouped, rethought, and redone
properly with templates.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread tedd
At 1:55 PM -0400 6/28/06, Jon Anderson wrote:
I really don't understand why people have such disregard for PHP as a template 
system... I'm not saying one way is better or worse (it's really a matter of 
preference), just that the PHP way isn't implicitly bad or messy...

/* The Smarty way */
$smarty-assign('display_variable',$display_variable);
...
{* template *}
dl
 {foreach key=key item=var from=$display_variable}
   dt{$key}/dtdd{$var}/dd
 {/foreach}
/dl

/* The PHP way */
dl
 ?php foreach ($display_variable as $key = $var) { ?
   dt?= $key?/dtdd?= $var ?/dd
 ?php } /* end foreach ($display_variable) */ ?
/dl

Is it really *that* bad?

jon

Not at all, if I see it my way:

dl
 ?php
  foreach ($display_variable as $key = $var)
 {
?
dt?= $key?/dt
dd?= $var ?/dd
?php
}
 ?
/dl

But, as the old lady kissed the cow To each their own.

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread Martin Marques

On Wed, 28 Jun 2006 12:28:43 -0400, tedd [EMAIL PROTECTED] wrote:
 At 8:32 AM -0300 6/28/06, Martin Marques wrote:

Because it's a mess.

 
 That's because it got out of hand. Now, practice the 3R's, regroup,
 rethink, and redo.

Already did. That's when I started to use a template system. :-D

--
-
Lic. Martín Marqués |   SELECT 'mmarques' || 
Centro de Telemática|   '@' || 'unl.edu.ar';
Universidad Nacional|   DBA, Programador, 
del Litoral |   Administrador
-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread tedd
At 2:02 PM -0400 6/28/06, Robert Cummings wrote:
On Wed, 2006-06-28 at 13:55, Jon Anderson wrote:
 I really don't understand why people have such disregard for PHP as a
 template system... I'm not saying one way is better or worse (it's
 really a matter of preference), just that the PHP way isn't implicitly
 bad or messy...

 /* The Smarty way */
 $smarty-assign('display_variable',$display_variable);
 ...
 {* template *}
 dl
   {foreach key=key item=var from=$display_variable}
 dt{$key}/dtdd{$var}/dd
   {/foreach}
 /dl

 /* The PHP way */
 dl
   ?php foreach ($display_variable as $key = $var) { ?
 dt?= $key?/dtdd?= $var ?/dd
   ?php } /* end foreach ($display_variable) */ ?
 /dl

 Is it really *that* bad?

YES!

Simplistic examples don't properly illustrate the mess that occurs in
complex situations.

Cheers,
Rob.
--


Not meaning to be contrary, but complex situations are supposed to be reduced 
to simplistic solutions.

I don't see anything wrong with what was presented.

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread Jon Anderson

Robert Cummings wrote:

Simplistic examples don't properly illustrate the mess that occurs in
complex situations.
However, a simplistic example does properly illustrate my point nicely. 
I could even take one of my complex multi-page smarty templates, run and 
perl script to convert it, and end up with a PHP template that's just as 
clean as the Smarty template by virtue of being basically identical.


If you split up your logic and your presentation layers, then your 
templates can be nice and clean, even if they're written in PHP. It's 
just much easier to shoot yourself in the foot with a PHP template.


(Again, I have nothing against Smarty or other template systems. I use 
Smarty all the time, and I quite like it.)


jon

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread Robert Cummings
On Wed, 2006-06-28 at 14:19, Jon Anderson wrote:
 Robert Cummings wrote:
  Simplistic examples don't properly illustrate the mess that occurs in
  complex situations.
 However, a simplistic example does properly illustrate my point nicely. 
 I could even take one of my complex multi-page smarty templates, run and 
 perl script to convert it, and end up with a PHP template that's just as 
 clean as the Smarty template by virtue of being basically identical.
 
 If you split up your logic and your presentation layers, then your 
 templates can be nice and clean, even if they're written in PHP. It's 
 just much easier to shoot yourself in the foot with a PHP template.
 
 (Again, I have nothing against Smarty or other template systems. I use 
 Smarty all the time, and I quite like it.)

Been there done that. I split my stuff up very well into modular chunks
thank-you-very-much. I still prefer a template engine. But then I guess
you like passing arrays as parameters or have set order to your function
parameters. I prefer to use custom tags where the attribute order is
unimportant. Incidentally custom tags look just like HTML, flow just
like HTML, and validate when a tag is left open. Can provide semantics
as well as content. You can keep your PHP soup.

?php if( userLevel( 'admin' ) ){ ?
blah blah blah blah blah
php? } ?

myProject:restrict level=admin
blah blah blah blah blah
/myProject:restrict

Yep, I'm not going back.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread Robert Cummings
On Wed, 2006-06-28 at 14:10, tedd wrote:
 At 2:02 PM -0400 6/28/06, Robert Cummings wrote:
 On Wed, 2006-06-28 at 13:55, Jon Anderson wrote:
  I really don't understand why people have such disregard for PHP as a
  template system... I'm not saying one way is better or worse (it's
  really a matter of preference), just that the PHP way isn't implicitly
  bad or messy...
 
  /* The Smarty way */
  $smarty-assign('display_variable',$display_variable);
  ...
  {* template *}
  dl
{foreach key=key item=var from=$display_variable}
  dt{$key}/dtdd{$var}/dd
{/foreach}
  /dl
 
  /* The PHP way */
  dl
?php foreach ($display_variable as $key = $var) { ?
  dt?= $key?/dtdd?= $var ?/dd
?php } /* end foreach ($display_variable) */ ?
  /dl
 
  Is it really *that* bad?
 
 YES!
 
 Simplistic examples don't properly illustrate the mess that occurs in
 complex situations.
 
 Cheers,
 Rob.
 --
 
 
 Not meaning to be contrary, but complex situations are supposed to be reduced 
 to simplistic solutions.

That's right, and a template engine simplifies the complexity.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread tedd
At 2:35 PM -0400 6/28/06, Robert Cummings wrote:

  Not meaning to be contrary, but complex situations are supposed to be 
  reduced to simplistic solutions.

That's right, and a template engine simplifies the complexity.

Cheers,
Rob.

Okay, whatever tools work for you.

Like we used to say in my old GTE days of running telephone cable -- Boss, no 
matter how many times we cut this cable, it's still too short.

In other words, add as many layers of complexity you need to make things simple 
for you.

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread Robert Cummings
On Wed, 2006-06-28 at 15:10, tedd wrote:
 At 2:35 PM -0400 6/28/06, Robert Cummings wrote:
 
   Not meaning to be contrary, but complex situations are supposed to be 
   reduced to simplistic solutions.
 
 That's right, and a template engine simplifies the complexity.
 
 Cheers,
 Rob.
 
 Okay, whatever tools work for you.
 
 Like we used to say in my old GTE days of running telephone cable -- Boss, 
 no matter how many times we cut this cable, it's still too short.
 
 In other words,

Your kidding right? What you say above and what you say below are
different. You must think I'm stupid. Oh well.

  add as many layers of complexity you need to make things simple for you.

I do, thanks. How's your cave btw?

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread John Nichel

Robert Cummings wrote:

On Wed, 2006-06-28 at 15:10, tedd wrote:

At 2:35 PM -0400 6/28/06, Robert Cummings wrote:

Not meaning to be contrary, but complex situations are supposed to be reduced 
to simplistic solutions.

That's right, and a template engine simplifies the complexity.

Cheers,
Rob.

Okay, whatever tools work for you.

Like we used to say in my old GTE days of running telephone cable -- Boss, no 
matter how many times we cut this cable, it's still too short.

In other words,


Your kidding right? What you say above and what you say below are
different. You must think I'm stupid. Oh well.



I don't ever remember anyone using the word stupid.  Other adjectives 
maybe, but not stupid.



 add as many layers of complexity you need to make things simple for you.


I do, thanks. How's your cave btw?



Those of us who feel adding a template system on top of something 
already well equipped to do the job are living in a cave?  Yes, other 
adjectives indeed.


reminds self to update his killfile list

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread Robert Cummings
On Wed, 2006-06-28 at 15:28, John Nichel wrote:
 Robert Cummings wrote:
  On Wed, 2006-06-28 at 15:10, tedd wrote:
  At 2:35 PM -0400 6/28/06, Robert Cummings wrote:
  Not meaning to be contrary, but complex situations are supposed to be 
  reduced to simplistic solutions.
  That's right, and a template engine simplifies the complexity.
 
  Cheers,
  Rob.
  Okay, whatever tools work for you.
 
  Like we used to say in my old GTE days of running telephone cable -- 
  Boss, no matter how many times we cut this cable, it's still too short.
 
  In other words,
  
  Your kidding right? What you say above and what you say below are
  different. You must think I'm stupid. Oh well.
  
 
 I don't ever remember anyone using the word stupid.  Other adjectives 
 maybe, but not stupid.

Using a comparison implying someone can't see the fallacy in it's logic
implies someone is too stupid to understand your metaphors.

   add as many layers of complexity you need to make things simple for you.
  
  I do, thanks. How's your cave btw?
  
 
 Those of us who feel adding a template system on top of something 
 already well equipped to do the job are living in a cave?  Yes, other 
 adjectives indeed.

When did I ask you or anyone other than Tedd if they were living in a
cave? Ge! I guess we don't need databases, they're just another
layer adding simplicity. I guess we don't need TCP/IP it's just another
layer, etc etc etc. Let's be realistic here, the whole Internet works on
top of layer after layer after layer and each was created to simplify.

 reminds self to update his killfile list

Awww, again?

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread Robert Cummings
On Wed, 2006-06-28 at 15:39, Robert Cummings wrote:
 On Wed, 2006-06-28 at 15:28, John Nichel wrote:
  Robert Cummings wrote:
   On Wed, 2006-06-28 at 15:10, tedd wrote:
   At 2:35 PM -0400 6/28/06, Robert Cummings wrote:
   Not meaning to be contrary, but complex situations are supposed to be 
   reduced to simplistic solutions.
   That's right, and a template engine simplifies the complexity.
  
   Cheers,
   Rob.
   Okay, whatever tools work for you.
  
   Like we used to say in my old GTE days of running telephone cable -- 
   Boss, no matter how many times we cut this cable, it's still too short.
  
   In other words,
   
   Your kidding right? What you say above and what you say below are
   different. You must think I'm stupid. Oh well.
   
  
  I don't ever remember anyone using the word stupid.  Other adjectives 
  maybe, but not stupid.
 
 Using a comparison implying someone can't see the fallacy in it's logic
 implies someone is too stupid to understand your metaphors.
 
add as many layers of complexity you need to make things simple for you.
   
   I do, thanks. How's your cave btw?
   
  
  Those of us who feel adding a template system on top of something 
  already well equipped to do the job are living in a cave?  Yes, other 
  adjectives indeed.
 
 When did I ask you or anyone other than Tedd if they were living in a
 cave? Ge! I guess we don't need databases, they're just another
 layer adding simplicity. I guess we don't need TCP/IP it's just another
 layer, etc etc etc. Let's be realistic here, the whole Internet works on
 top of layer after layer after layer and each was created to simplify.

Oh yeah... and PHP is a layer over CGI *PTHTHTTHTHTH* Maybe we should go
back to that.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] cool your jets [WAS: Re: [PHP] working on a template system...]

2006-06-28 Thread Paul Novitski

Hey kids,

I thought I was joining a PHP list, not a snarky ego-fest.  I assume 
most of us are trying to get work done around here and are interested 
in programming QA.  Please take your squabbles off-list or re-title 
them.  They're off-topic and a waste of everyone's else's time.  Yeah 
I've got a delete key but I have to open  read the extraneous crap 
to discover that I need to delete the garbage messages.  I'm pressed 
for time.  If you're not, PLEASE get some programming work to keep 
you off the street.


This list badly needs a bouncer.

If you can't treat your colleagues with respect, what is it that you 
need?  More love? sex? drugs? therapy?  Whatever it is, please work 
out your emotional issues off-list so you don't feel compelled to 
take out your frustrations on your peers who are, just like you, 
trying to do their best with the intelligence and education at 
hand.  Any asshole can declare war.  The future is made of 
cooperation, respect, and mutual education.


Can anyone recommend another PHP list where there's a much higher 
signal-to-noise ratio?


Grumpily,
Paul

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] cool your jets [WAS: Re: [PHP] working on a template system...]

2006-06-28 Thread Jay Blanchard
[snip]
Can anyone recommend another PHP list where there's a much higher 
signal-to-noise ratio?
[/snip]

/dev/null comes to mind.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread Martin Alterisio

2006/6/28, Jon Anderson [EMAIL PROTECTED]:


I really don't understand why people have such disregard for PHP as a
template system... I'm not saying one way is better or worse (it's
really a matter of preference), just that the PHP way isn't implicitly
bad or messy...

/* The Smarty way */
$smarty-assign('display_variable',$display_variable);
...
{* template *}
dl
  {foreach key=key item=var from=$display_variable}
dt{$key}/dtdd{$var}/dd
  {/foreach}
/dl

/* The PHP way */
dl
  ?php foreach ($display_variable as $key = $var) { ?
dt?= $key?/dtdd?= $var ?/dd
  ?php } /* end foreach ($display_variable) */ ?
/dl

Is it really *that* bad?

jon

Martin Alterisio wrote:
 2006/6/28, Robert Cummings [EMAIL PROTECTED]:

 On Wed, 2006-06-28 at 07:32, Martin Marques wrote:
  On Wed, 28 Jun 2006, Ligaya Turmelle wrote:
 
   Martin Marques wrote:
   Why not try to use one of the template systems that already exist?
   HTML_Template_IT, Smarty, etc.
  
   Or just use PHP...
 
  Because it's a mess.

 Agreed. Mr. nail, come meet Mr. hammer :B


 And keep Mr. hammer away from Mr. finger

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Have you (all of you questioning the use of templates) ever worked in a
project with more than one developer, where part of the team ARE NOT coders?
WE understand code, but that's not the case for everyone else. Graphic
designers don't like code, they even don't like html for crying out loud (I
think they have a good point there btw). Editor, writers, marketing people
they all give a damn about php and the like, but, still they need or want to
mess up with how things look like, and they really don't like the idea of
having to wait two laboral days to change the fricking color of a link, or
have an newsletter email typo corrected. They need templates, they love
templates. Just put it in dreamweaver (or the like), fix the look, upload
and we're back on business, why the hell should I have to call the damn
coder?

The net has been developed by amateurs long enough (no offense, just
introspective). If we are to became more professional, we'll need the right
tools, templates is just one of those tools.


Re: [PHP] cool your jets [WAS: Re: [PHP] working on a template system...]

2006-06-28 Thread Stut

Jay Blanchard wrote:

/dev/null comes to mind.


/dev/null came to my mind once. Not really sure what happened after that.

-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] cool your jets [WAS: Re: [PHP] working on a template system...]

2006-06-28 Thread phpninja

The only one with an ego around here is you. Frankly, no one cares that your
pressed for time. Your lucky someone even responds to your questions.

Get the hell off the list and stop bitching.

-Original Message-
From: Paul Novitski [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 28, 2006 1:15 PM
To: PHP-General
Subject: [PHP] cool your jets [WAS: Re: [PHP] working on a template
system...]

Hey kids,

I thought I was joining a PHP list, not a snarky ego-fest.  I assume most of
us are trying to get work done around here and are interested in programming
QA.  Please take your squabbles off-list or re-title them.  They're
off-topic and a waste of everyone's else's time.  Yeah I've got a delete key
but I have to open  read the extraneous crap to discover that I need to
delete the garbage messages.  I'm pressed for time.  If you're not, PLEASE
get some programming work to keep you off the street.

This list badly needs a bouncer.

If you can't treat your colleagues with respect, what is it that you need?
More love? sex? drugs? therapy?  Whatever it is, please work out your
emotional issues off-list so you don't feel compelled to take out your
frustrations on your peers who are, just like you, trying to do their best
with the intelligence and education at hand.  Any asshole can declare war.
The future is made of cooperation, respect, and mutual education.

Can anyone recommend another PHP list where there's a much higher
signal-to-noise ratio?

Grumpily,
Paul

--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php


Re: [PHP] cool your jets [WAS: Re: [PHP] working on a template system...]

2006-06-28 Thread Jochem Maas
Paul Novitski wrote:
 Hey kids,

hi mom.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cool your jets [WAS: Re: [PHP] working on a template system...]

2006-06-28 Thread Robert Cummings
On Wed, 2006-06-28 at 18:11, Jochem Maas wrote:
 Paul Novitski wrote:
  Hey kids,
 
 hi mom.

Dad had an operation?

-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cool your jets [WAS: Re: [PHP] working on a template system...]

2006-06-28 Thread Jochem Maas
Robert Cummings wrote:
 On Wed, 2006-06-28 at 18:11, Jochem Maas wrote:
 Paul Novitski wrote:
 Hey kids,
 hi mom.
 
 Dad had an operation?

an invalid type conversion?

 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cool your jets [WAS: Re: [PHP] working on a template system...]

2006-06-28 Thread tedd
At 12:11 AM +0200 6/29/06, Jochem Maas wrote:
Paul Novitski wrote:
 Hey kids,

hi mom.

Oh no, not another one of those talks?

What did I do this time? I wasn't anywhere near it, and no one saw me anyway.

Besides mom, you should take some time off -- you appear to be wrapped a bit 
tight. Lighten up, and perhaps you'll live enough to reach my age. If not, it 
won't be your a##hole that will declare war, but your heart.

Cheers,

tedd

-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cool your jets [WAS: Re: [PHP] working on a template system...]

2006-06-28 Thread Robert Cummings
On Wed, 2006-06-28 at 18:35, Jochem Maas wrote:
 Robert Cummings wrote:
  On Wed, 2006-06-28 at 18:11, Jochem Maas wrote:
  Paul Novitski wrote:
  Hey kids,
  hi mom.
  
  Dad had an operation?
 
 an invalid type conversion?

I dunno, did you try it? Did you catch anything? Maybe it needs to be
thrown!


-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread tedd
At 3:21 PM -0400 6/28/06, Robert Cummings wrote:
Your kidding right? What you say above and what you say below are
different. You must think I'm stupid. Oh well.


Robert !

Hey, don't get shorts in a knot -- I didn't mean anything of the sort. I seldom 
deliberately go out of my way to insult anyone.

If you took offense in what I said, then please accept my apologies. I didn't 
mean it that way.

   add as many layers of complexity you need to make things simple for you.

The layers of complexity I speak of are things we all do to make our world 
simpler, which appears to be an oxymoron. We use higher level languages, which 
are exceedingly more and more complex, to make our lives simpler -- do you see 
what I'm getting at?  It's not about you.

I do, thanks. How's your cave btw?

As for my cave -- how did you know? That's what my family calls my office, the 
bear cave. When the grand-kids misbehave, they have to visit the bear cave.

There -- all better now?  :-)

tedd


-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread tedd
At 3:28 PM -0400 6/28/06, John Nichel wrote:


reminds self to update his killfile list

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]


humor  /* please note the humor tags */

Does that mean because I agreed with you, I'm now off your killfile list?

Or does my rank simply reduce ($tedd--) one step further away?

/humor

tedd
--

http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread tedd
At 3:39 PM -0400 6/28/06, Robert Cummings wrote:
When did I ask you or anyone other than Tedd if they were living in a
cave?


Yeah, that's right -- he didn't infer that anyone else lived in a cave, just me.

If you want anyone else to tell you that you live in a cave, then you'll have 
to stand in line behind me.

LOL -- you guys think that's an insult? I've received, and sometimes deserved, 
much worse.

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread tedd
At 5:34 PM -0300 6/28/06, Martin Alterisio wrote:
Have you (all of you questioning the use of templates) ever worked in a
project with more than one developer, where part of the team ARE NOT coders?
WE understand code, but that's not the case for everyone else. Graphic
designers don't like code, they even don't like html for crying out loud (I
think they have a good point there btw). Editor, writers, marketing people
they all give a damn about php and the like, but, still they need or want to
mess up with how things look like, and they really don't like the idea of
having to wait two laboral days to change the fricking color of a link, or
have an newsletter email typo corrected. They need templates, they love
templates. Just put it in dreamweaver (or the like), fix the look, upload
and we're back on business, why the hell should I have to call the damn
coder?

The net has been developed by amateurs long enough (no offense, just
introspective). If we are to became more professional, we'll need the right
tools, templates is just one of those tools.

Martin:

I can appreciate your perspective, but that's your perspective.

I don't think the use of templates should be a yardstick to measure 
professionalism.

Now, I assume that you didn't mean your claim to sound that way, but I think 
there's real danger in trying to define tools with professional and accepted 
ways of doing things.

If all professional and accepted ways of doing things had been left to the 
professionals, then we certainly would not be as technically advanced as we are 
today -- not brag, just fact!

There's a reason why the newest inventions and innovations come from amateurs 
and not those in the work force known as the accepted professional.

tedd

-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread David Tulloh
Martin Alterisio wrote:
 2006/6/28, Jon Anderson [EMAIL PROTECTED]:
 

 I really don't understand why people have such disregard for PHP as a
 template system... I'm not saying one way is better or worse (it's
 really a matter of preference), just that the PHP way isn't implicitly
 bad or messy...

 /* The Smarty way */
 $smarty-assign('display_variable',$display_variable);
 ...
 {* template *}
 dl
   {foreach key=key item=var from=$display_variable}
 dt{$key}/dtdd{$var}/dd
   {/foreach}
 /dl

 /* The PHP way */
 dl
   ?php foreach ($display_variable as $key = $var) { ?
 dt?= $key?/dtdd?= $var ?/dd
   ?php } /* end foreach ($display_variable) */ ?
 /dl

 Is it really *that* bad?

 jon

 [snipage]

 Have you (all of you questioning the use of templates) ever worked in a
 project with more than one developer, where part of the team ARE NOT
 coders?

I have.

 WE understand code, but that's not the case for everyone else. Graphic
 designers don't like code, they even don't like html for crying out loud (I
 think they have a good point there btw). Editor, writers, marketing people
 they all give a damn about php and the like, but, still they need or
 want to
 mess up with how things look like, and they really don't like the idea of
 having to wait two laboral days to change the fricking color of a link, or
 have an newsletter email typo corrected. They need templates, they love
 templates. Just put it in dreamweaver (or the like), fix the look, upload
 and we're back on business, why the hell should I have to call the damn
 coder?

The problems that you outlined above have nothing to do with the
template language used, more about the structure of the site and the
level of control given to the content developers.  Having a simple
content specific file which the content developer can change directly is
a basic must.

Having that file contain smarty template magic or straight php template
magic is a far less important question, why bother with smarty when php
will work just as well?

The biggest issue I see with using php as a template language is that
too much control is given to the content developers.  You don't want
some smartarse throwing complex code around, hacking or opening holes in
your security or creating nasty bugs.

 
 [sniped pointless flame]

BTW: My prefered template varient of the above loop.

dl
 ? foreach ($menu_items as $name = $link): ?
   dt ?=$name? /dt dd ?=$link? /dd
 ? endforeach; ?
/dl

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-28 Thread Robert Cummings
On Wed, 2006-06-28 at 19:29, tedd wrote:
 At 3:21 PM -0400 6/28/06, Robert Cummings wrote:
 Your kidding right? What you say above and what you say below are
 different. You must think I'm stupid. Oh well.
 
 
 Robert !
 
 Hey, don't get shorts in a knot -- I didn't mean anything of the sort. I 
 seldom deliberately go out of my way to insult anyone.
 
 If you took offense in what I said, then please accept my apologies. I didn't 
 mean it that way.
 
add as many layers of complexity you need to make things simple for you.
 
 The layers of complexity I speak of are things we all do to make our world 
 simpler, which appears to be an oxymoron. We use higher level languages, 
 which are exceedingly more and more complex, to make our lives simpler -- do 
 you see what I'm getting at?  It's not about you.
 
 I do, thanks. How's your cave btw?
 
 As for my cave -- how did you know? That's what my family calls my office, 
 the bear cave. When the grand-kids misbehave, they have to visit the bear 
 cave.
 
 There -- all better now?  :-)

*lol* No apologies needed... I take everything on the list with a grain
of salt and automatically presume a degreee of humour and sarcasm :) I
expect for the most part that my posts be taken that way too. i guess
that's the problem with the written medium, sometimes light hearted
banter can run awry... and it doesn't help I guess that I often forget
my smilies and *emotes* :B  -- that's my buck toothed grin.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cool your jets [WAS: Re: [PHP] working on a template system...]

2006-06-28 Thread Micky Hulse

Lol! Omg, you guys make reading my email so much more fun!

Cheers!
Micky

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] working on a template system...

2006-06-27 Thread sempsteen

hi, i'm working on a template system. Basically i'm building raw
contents in arrays and then put them in templates by some special
tags.

for loop systems my basic array structure is like this:
$array['key'][]['keyword'] = ...

for example, for a bulletin board system, array structure for
categories is something like this:
$array['categories'][]['text_category_name'] = ...

it is looped through database recordset, so final array for 2 categories can be:
$array['categories'][0]['text_category_name'] = 'programming'
$array['categories'][1]['text_category_name'] = 'life'

template file structure for loops is something like this (ex, categories):
!-- loop|categories:bof --
tr
  td[$text_category_name$]/td
/tr
!-- loop|categories:eof --

i can easily loop this template and replace [$text_category_name] for
every category set in the array. after removing the comment tags i get
the final content:

tr
  tdprogramming/td
/tr
tr
  tdlife/td
/tr

But i'm stuck with nested loops. For example i want to put related
forums after each categories.

array structure is:
$array['categories'][0]['text_category_name'] = programming
$array['categories'][0]['forums'][0]['text_forum_name'] = php
$array['categories'][0]['forums'][1]['text_forum_name'] = ruby

$array['categories'][1]['text_category_name'] = life
$array['categories'][1]['forums'][0]['text_forum_name'] = music
$array['categories'][1]['forums'][1]['text_forum_name'] = sports

template structure is:
!-- loop|categories:bof --
tr
  td[$text_category_name$]/td
/tr
!-- loop|forums:bof --
tr
  td[$text_forum_name$]/td
/tr
!-- loop|forums:eof --
!-- loop|categories:eof --

i've written some functions, used them recursively but it didn't work.
actually i couldn't find the true logic. note that it isn't a limited
array. it can have messages under each forums, peoples under each
messages, so on..

help me find the true approach to handle this. thank you.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-27 Thread Martin Marques

Why not try to use one of the template systems that already exist? 
HTML_Template_IT, Smarty, etc.

On Tue, 27 Jun 2006 10:22:42 +0300, sempsteen [EMAIL PROTECTED] wrote:
 hi, i'm working on a template system. Basically i'm building raw
 contents in arrays and then put them in templates by some special
 tags.
 
 for loop systems my basic array structure is like this:
 $array['key'][]['keyword'] = ...
 
 for example, for a bulletin board system, array structure for
 categories is something like this:
 $array['categories'][]['text_category_name'] = ...
 
 it is looped through database recordset, so final array for 2 categories
 can be:
 $array['categories'][0]['text_category_name'] = 'programming'
 $array['categories'][1]['text_category_name'] = 'life'
 
 template file structure for loops is something like this (ex, categories):
 !-- loop|categories:bof --
 tr
td[$text_category_name$]/td
 /tr
 !-- loop|categories:eof --
 
 i can easily loop this template and replace [$text_category_name] for
 every category set in the array. after removing the comment tags i get
 the final content:
 
 tr
tdprogramming/td
 /tr
 tr
tdlife/td
 /tr
 
 But i'm stuck with nested loops. For example i want to put related
 forums after each categories.
 
 array structure is:
 $array['categories'][0]['text_category_name'] = programming
 $array['categories'][0]['forums'][0]['text_forum_name'] = php
 $array['categories'][0]['forums'][1]['text_forum_name'] = ruby
 
 $array['categories'][1]['text_category_name'] = life
 $array['categories'][1]['forums'][0]['text_forum_name'] = music
 $array['categories'][1]['forums'][1]['text_forum_name'] = sports
 
 template structure is:
 !-- loop|categories:bof --
 tr
td[$text_category_name$]/td
 /tr
 !-- loop|forums:bof --
 tr
td[$text_forum_name$]/td
 /tr
 !-- loop|forums:eof --
 !-- loop|categories:eof --
 
 i've written some functions, used them recursively but it didn't work.
 actually i couldn't find the true logic. note that it isn't a limited
 array. it can have messages under each forums, peoples under each
 messages, so on..
 
 help me find the true approach to handle this. thank you.
 
 
-
Lic. Martín Marqués |   SELECT 'mmarques' || 
Centro de Telemática|   '@' || 'unl.edu.ar';
Universidad Nacional|   DBA, Programador, 
del Litoral |   Administrador
-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] working on a template system...

2006-06-27 Thread Ligaya Turmelle

Martin Marques wrote:

Why not try to use one of the template systems that already exist? 
HTML_Template_IT, Smarty, etc.

On Tue, 27 Jun 2006 10:22:42 +0300, sempsteen [EMAIL PROTECTED] wrote:


hi, i'm working on a template system. Basically i'm building raw
contents in arrays and then put them in templates by some special
tags.

for loop systems my basic array structure is like this:
$array['key'][]['keyword'] = ...

for example, for a bulletin board system, array structure for
categories is something like this:
$array['categories'][]['text_category_name'] = ...

it is looped through database recordset, so final array for 2 categories
can be:
$array['categories'][0]['text_category_name'] = 'programming'
$array['categories'][1]['text_category_name'] = 'life'

template file structure for loops is something like this (ex, categories):
!-- loop|categories:bof --
tr
  td[$text_category_name$]/td
/tr
!-- loop|categories:eof --

i can easily loop this template and replace [$text_category_name] for
every category set in the array. after removing the comment tags i get
the final content:

tr
  tdprogramming/td
/tr
tr
  tdlife/td
/tr

But i'm stuck with nested loops. For example i want to put related
forums after each categories.

array structure is:
$array['categories'][0]['text_category_name'] = programming
$array['categories'][0]['forums'][0]['text_forum_name'] = php
$array['categories'][0]['forums'][1]['text_forum_name'] = ruby

$array['categories'][1]['text_category_name'] = life
$array['categories'][1]['forums'][0]['text_forum_name'] = music
$array['categories'][1]['forums'][1]['text_forum_name'] = sports

template structure is:
!-- loop|categories:bof --
tr
  td[$text_category_name$]/td
/tr
!-- loop|forums:bof --
tr
  td[$text_forum_name$]/td
/tr
!-- loop|forums:eof --
!-- loop|categories:eof --

i've written some functions, used them recursively but it didn't work.
actually i couldn't find the true logic. note that it isn't a limited
array. it can have messages under each forums, peoples under each
messages, so on..

help me find the true approach to handle this. thank you.




-
Lic. Martín Marqués |   SELECT 'mmarques' || 
Centro de Telemática|   '@' || 'unl.edu.ar';
Universidad Nacional|   DBA, Programador, 
del Litoral |   Administrador

-


Or just use PHP...

--

life is a game... so have fun.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php