Re: [PHPTAL] refer to array in php:

2011-05-19 Thread Richard Dyce
>  blah blah

Do you need the single quotes perhaps?

On 19 May 2011, at 14:02, GRolf wrote:

> 
> 
> I have set an array to my PHPTal:
> 
> $phptal->person = array('first_name'=>'John', 'last_name'=>'Doe');
> 
> 
> Works fine to retrieve those values in my template
> 
> ${person/first_name}
> 
> 
> However, how can I use that in tal:condition?
> 
>  blah blah
> throws an error.
> 
> I know that for objects I need to use person.first_name, but what about 
> arrays?
> 
>  blah blah
> does not work either...
> 
> 
> 
> (how come this kind of basic information is not in the manual? Even the fact 
> that a variable is just ${varname} is not in the basic example...)
> 
> 
> 
> 
> 
> ___
> 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


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


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: AW: [PHPTAL] PHPTAL and form macros

2010-08-02 Thread Richard Dyce
Per,

That's a great help.

Yes, the model is massively simplified, but I figured it was better to explain 
what I was getting at... I take your point about ugliness!

On 2 Aug 2010, at 20:20, Per Bernhardt wrote:

> So keep improving your model! By the way: You should always prefer strong 
> classes and objects instead nested array definitions ;)

I'm not sure I agree/follow. The db backend (FileMaker, no, really) I'm using 
wants to present data as an array of named field values, plus field defnitions. 
How would synthesising a php class/object heirarchy to place between the array 
representation from the db and the phptal parser help?

Thanks,

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


Re: [PHPTAL] PHPTAL and form macros

2010-08-02 Thread Richard Dyce
:-) I take your point...

Yes, I do have a framework - but it's not the framework I'm currently using!

On 2 Aug 2010, at 20:17, Kornel LesiƄski wrote:

> On 02.08.2010, at 19:27, Richard Dyce wrote:
>> 
>> 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.
>> 
>> > 
>> $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 ;-)
>> 
> 
> If you already have framework that works, then most pragmatic solution would 
> be to let it generate HTML, and then output it literally in PHPTAL:
> 
> ${structure form_html}
> 
> 
> I don't have any code to generate form from such structure, but it seems 
> quite doable with TAL.
> 
> -- 
> regards, Kornel
> 
> 
> 
> 
> ___
> 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] PHPTAL and form macros

2010-08-02 Thread Richard Dyce
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.

 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


Re: [PHPTAL] How to write a sort link for table headers

2010-07-30 Thread Richard Dyce
I've got it to work with:

  
field name
  

but I was wondering if there's something more idiomatic that I should have used 
instead?

dd

On 30 Jul 2010, at 16:47, Richard Dyce wrote:

> Apologies for double-post - did a reply to a previous posting rather than 
> start new thread. Sorry!
> 
> Hi,
> 
> Sorry for the newbie question - I'm trying to work out how to rewrite a link 
> at the top of a table that sorts the table by column...
> 
> 
> At present, I'm using:
> 
> 
>  tal:content="repeat/item/key" >field name
> 
> 
> where I've captured incoming values in the GET ...
> 
> $template->column   = array_key_exists('column', $_GET)) ? 
> htmlspecialchars($_GET['column']) : '';  # grab the sort column
> $template->criteria =  (array_key_exists('criteria', $_GET)) ? 
> htmlspecialchars($_GET['criteria']) : '';# grab search criteria
> 
> 
> I need to decide how to signify that a table, already sorted by 'column', 
> should be reverse sorted by column. In the past I'd do this by using the case 
> of 'column' - 'column' for ascending and 'COLUMN' for descending. Is there a 
> way to do this without resorting to php? or is there a more idiomatic PHPTAL 
> way of doing it?
> 
> 
> Any pointers gratefully received...
> 
> dd
> ___
> 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] How to write a sort link for table headers

2010-07-30 Thread Richard Dyce
Apologies for double-post - did a reply to a previous posting rather than start 
new thread. Sorry!

Hi,

Sorry for the newbie question - I'm trying to work out how to rewrite a link at 
the top of a table that sorts the table by column...


At present, I'm using:


 field name


where I've captured incoming values in the GET ...

$template->column   = array_key_exists('column', $_GET)) ? 
htmlspecialchars($_GET['column']) : '';  # grab the sort column
$template->criteria =  (array_key_exists('criteria', $_GET)) ? 
htmlspecialchars($_GET['criteria']) : '';# grab search criteria


I need to decide how to signify that a table, already sorted by 'column', 
should be reverse sorted by column. In the past I'd do this by using the case 
of 'column' - 'column' for ascending and 'COLUMN' for descending. Is there a 
way to do this without resorting to php? or is there a more idiomatic PHPTAL 
way of doing it?


Any pointers gratefully received...

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


[PHPTAL] How to write a sort link for table headers

2010-07-30 Thread Richard Dyce
Hi,

Sorry for the newbie question - I'm trying to work out how to rewrite a link at 
the top of a table that sorts the table by column...


At present, I'm using:


  field name


where I've captured incoming values in the GET ...

$template->column   = array_key_exists('column', $_GET)) ? 
htmlspecialchars($_GET['column']) : '';  # grab the sort column
$template->criteria =  (array_key_exists('criteria', $_GET)) ? 
htmlspecialchars($_GET['criteria']) : '';# grab search criteria


I need to decide how to signify that a table, already sorted by 'column', 
should be reverse sorted by column. In the past I'd do this by using the case 
of 'column' - 'column' for ascending and 'COLUMN' for descending. Is there a 
way to do this without resorting to php? or is there a more idiomatic PHPTAL 
way of doing it?


Any pointers gratefully received...

dd




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