Re: [PHPTAL] PHPTAL and form macros

2010-08-24 Thread Peter Niederlag

Hello,

Am 23.08.2010 23:12, schrieb romtek:

For me, the biggest benefit of using PHPTAL is being able to view the code
in WYSIWYG programs. Having a template system in which there are many macros
calling each other on several levels defeats this purpose. I think that in
some cases using pure PHP code may be a better way. The topic being
discussed in this thread seems to fall into this category.


In general I fully agree. One thing being absolut nice in PHPTAL is that 
a template is basically just some enriched XHTML.


On the other hand forms make up a good amount of real life work, and the 
PHPTAL template easily gets quite complex/ugly when you need to create a 
select with option and at the same time mark the correct entry with 
selected=selected.


So having some macros/shotcuts for this pupose seems to be quite a 
reasonable feature-request. Currently I guess everyone is tackling 
this issue with his own flavor, having a common approach would be 
quite nice.


Another similar problem is the requirement of having some hashes and 
additional data that is calculated based on the active form-fields and 
controller-settings (prior and next action, required fields, ...). This 
data needs to be added in hidden-fields. For calculation it needs to 
know which form elements with which names are contained in the form. I'd 
really like to have an easy mechnismen in PHPTAL to accomplish this. 
Until now I didn't find a really comfortable approach on getting this done.


Greets,
Peter

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] PHPTAL and form macros

2010-08-23 Thread romtek
For me, the biggest benefit of using PHPTAL is being able to view the code
in WYSIWYG programs. Having a template system in which there are many macros
calling each other on several levels defeats this purpose. I think that in
some cases using pure PHP code may be a better way. The topic being
discussed in this thread seems to fall into this category.

I'd like to see others' opinions on this.

Roman
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] PHPTAL and form macros

2010-08-03 Thread Robert Goldsmith
Hi all,

Well, we here at Namesco are working hard to get a release package together for 
the Zend/PHPTal integration 'glue' we've developed for our own internal 
codebase (which we've called ZTal) and this has full integration with 
Zend_Form. As such it includes a large number of macros for rendering different 
form elements - although, of course, they expect to be given a Zend_Form object 
:) Even if you are not using Zend it should be reasonably easy to re-use the 
macros :)

The code is ready but the documentation is rather lacking so at a guess I'd say 
it will be a few days before we release. I'll obviously let everyone know when 
everything is live :)

Robert

On 2 Aug 2010, at 19:27, Richard Dyce wrote:

 Hi,
 
 Just a pre-re-invent-the-wheel inquiry... Does anyone have an example of 
 macros for formatting form fields in phptal?
 
 I have an older framework which create field objects based on the data and 
 type, and populates them from a simple array:
 
 e.g.
 
 ?php
 
  $fields = array(
'id'= array('label'='',  'type'='hidden', 'value'=2),
'name' = array('label'='Name',  'type'='text',   'value'='John Smith'),
'user'= array('label'='Owner', 'type'='select', 
 'valuelist'=array(1,2,3), 'value'=2)
);
 
 ?
 
 It seems daft me to duplicate the logic twice over, and it appears that 
 phptal might be able to handle it with some repeats and templating. But 
 before I tie myself in knots over this, has anyone already done it, or tried 
 it and found the gotcha ;-)
 
 Thanks,
 
 R
 ___
 PHPTAL mailing list
 PHPTAL@lists.motion-twin.com
 http://lists.motion-twin.com/mailman/listinfo/phptal



PGP.sig
Description: This is a digitally signed message part
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] PHPTAL and form macros

2010-08-03 Thread Richard Dyce
Robert,

That sounds very interesting, I'll look forward to seeing it.

I've had a few private emails from people suggesting php pre-rendering with 
structures, or using Zend Forms. I thought I should make it clear that the 
reason that I'm not looking to go down that path is that that's where I've come 
from. (The framework I've been using has 'foxels' analagous to pixels, which 
are form elements that can be built using array specs, but which have renderers 
for html, xml and json.) This makes it really easy to create lots of forms 
where there aren't isn't the need for heavy single-form specific coding. The 
benefit I see of doing it this way is that it makes it easier to create highly 
complex one-off forms within the system using specific templates, but to have a 
generalised forms to hand for most of the rest... without having to change the 
backend logic.

Hope that's as clear as mud...

On 3 Aug 2010, at 08:39, Robert Goldsmith wrote:

 Hi all,
 
 Well, we here at Namesco are working hard to get a release package together 
 for the Zend/PHPTal integration 'glue' we've developed for our own internal 
 codebase (which we've called ZTal) and this has full integration with 
 Zend_Form. As such it includes a large number of macros for rendering 
 different form elements - although, of course, they expect to be given a 
 Zend_Form object :) Even if you are not using Zend it should be reasonably 
 easy to re-use the macros :)
 
 The code is ready but the documentation is rather lacking so at a guess I'd 
 say it will be a few days before we release. I'll obviously let everyone know 
 when everything is live :)
 
 Robert



___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] PHPTAL and form macros

2010-08-03 Thread Robert Goldsmith
Hi :)

I know exactly where you're coming from and the reason we've re-worked both 
Zend Views and Zend Forms is specifically to both separate template from php 
and to make the use of the modules such as Zend Form much more optional :) 
Within Zend, Form and View are a weird (and not, in my opinion, very MVC) mix 
of php and html and if you use a View or a Form you are pretty much stuck with 
doing things the 'Zend' way.

Our take is to replace Zend View entirely with PHPTal and split Zend Form into 
2 parts - the logic and the rendering. The logic for Zend Form is the same as 
in 'normal' Zend and validation and filtering of form elements works as 
expected. The rendering has been moved to PHPTal and you simply hand a Zend 
Form instance to a top-level macro to actually do the rendering. If at any 
point you wish to render a form manually or create a compatible alternative to 
Zend Form for your own needs this is all possible. It is also possible to 
specify an alternative macro for individual form elements to override the 
default - if you wish to do things slightly different for just one form or just 
one element :)

As a side note, we've also integrated Zend_Translate support into PHPTal and 
created a number of Tales to support plural translations and rendering various 
Zend elements such as Dates.

Robert

On 3 Aug 2010, at 09:34, Richard Dyce wrote:

 Robert,
 
 That sounds very interesting, I'll look forward to seeing it.
 
 I've had a few private emails from people suggesting php pre-rendering with 
 structures, or using Zend Forms. I thought I should make it clear that the 
 reason that I'm not looking to go down that path is that that's where I've 
 come from. (The framework I've been using has 'foxels' analagous to pixels, 
 which are form elements that can be built using array specs, but which have 
 renderers for html, xml and json.) This makes it really easy to create lots 
 of forms where there aren't isn't the need for heavy single-form specific 
 coding. The benefit I see of doing it this way is that it makes it easier to 
 create highly complex one-off forms within the system using specific 
 templates, but to have a generalised forms to hand for most of the rest... 
 without having to change the backend logic.
 
 Hope that's as clear as mud...
 
 On 3 Aug 2010, at 08:39, Robert Goldsmith wrote:
 
 Hi all,
 
 Well, we here at Namesco are working hard to get a release package together 
 for the Zend/PHPTal integration 'glue' we've developed for our own internal 
 codebase (which we've called ZTal) and this has full integration with 
 Zend_Form. As such it includes a large number of macros for rendering 
 different form elements - although, of course, they expect to be given a 
 Zend_Form object :) Even if you are not using Zend it should be reasonably 
 easy to re-use the macros :)
 
 The code is ready but the documentation is rather lacking so at a guess I'd 
 say it will be a few days before we release. I'll obviously let everyone 
 know when everything is live :)
 
 Robert
 
 
 
 ___
 PHPTAL mailing list
 PHPTAL@lists.motion-twin.com
 http://lists.motion-twin.com/mailman/listinfo/phptal



PGP.sig
Description: This is a digitally signed message part
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] PHPTAL and form macros

2010-08-03 Thread Richard Dyce
Glad to know I'm on the right track - or at least there are others out there 
with the same prejudices!

Btw, I'm not that bothered about waiting for documentation :-)))

R

On 3 Aug 2010, at 09:53, Robert Goldsmith wrote:

 Hi :)
 
 I know exactly where you're coming from and the reason we've re-worked both 
 Zend Views and Zend Forms is specifically to both separate template from php 
 and to make the use of the modules such as Zend Form much more optional :) 
 Within Zend, Form and View are a weird (and not, in my opinion, very MVC) mix 
 of php and html and if you use a View or a Form you are pretty much stuck 
 with doing things the 'Zend' way.
 
 Our take is to replace Zend View entirely with PHPTal and split Zend Form 
 into 2 parts - the logic and the rendering. The logic for Zend Form is the 
 same as in 'normal' Zend and validation and filtering of form elements works 
 as expected. The rendering has been moved to PHPTal and you simply hand a 
 Zend Form instance to a top-level macro to actually do the rendering. If at 
 any point you wish to render a form manually or create a compatible 
 alternative to Zend Form for your own needs this is all possible. It is also 
 possible to specify an alternative macro for individual form elements to 
 override the default - if you wish to do things slightly different for just 
 one form or just one element :)
 
 As a side note, we've also integrated Zend_Translate support into PHPTal and 
 created a number of Tales to support plural translations and rendering 
 various Zend elements such as Dates.
 
 Robert
 
 On 3 Aug 2010, at 09:34, Richard Dyce wrote:
 
 Robert,
 
 That sounds very interesting, I'll look forward to seeing it.
 
 I've had a few private emails from people suggesting php pre-rendering with 
 structures, or using Zend Forms. I thought I should make it clear that the 
 reason that I'm not looking to go down that path is that that's where I've 
 come from. (The framework I've been using has 'foxels' analagous to pixels, 
 which are form elements that can be built using array specs, but which have 
 renderers for html, xml and json.) This makes it really easy to create lots 
 of forms where there aren't isn't the need for heavy single-form specific 
 coding. The benefit I see of doing it this way is that it makes it easier to 
 create highly complex one-off forms within the system using specific 
 templates, but to have a generalised forms to hand for most of the rest... 
 without having to change the backend logic.
 
 Hope that's as clear as mud...
 
 On 3 Aug 2010, at 08:39, Robert Goldsmith wrote:
 
 Hi all,
 
 Well, we here at Namesco are working hard to get a release package together 
 for the Zend/PHPTal integration 'glue' we've developed for our own internal 
 codebase (which we've called ZTal) and this has full integration with 
 Zend_Form. As such it includes a large number of macros for rendering 
 different form elements - although, of course, they expect to be given a 
 Zend_Form object :) Even if you are not using Zend it should be reasonably 
 easy to re-use the macros :)
 
 The code is ready but the documentation is rather lacking so at a guess I'd 
 say it will be a few days before we release. I'll obviously let everyone 
 know when everything is live :)
 
 Robert
 
 
 
 ___
 PHPTAL mailing list
 PHPTAL@lists.motion-twin.com
 http://lists.motion-twin.com/mailman/listinfo/phptal
 
 ___
 PHPTAL mailing list
 PHPTAL@lists.motion-twin.com
 http://lists.motion-twin.com/mailman/listinfo/phptal


___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal