Funnily enough I'm just working on some view templates at this very minute,
which is why I have the info to hand!
I am using this at one point:
<?php
echo "<?php echo
isset(\${$singularVar}['{$modelClass}']['{$displayField}'])
? \${$singularVar}['{$modelClass}']['{$displayField}']
: '{$singularHumanName}'; ?>";
?>
...which is not bullet proof but is doing what I need it to do.
I have placed some debug statements in order to discover about the various
variables in there. I'm sure there's more to learn.
/cake/console/libs/tasks/ is where the variables are set. Have a look in
view.php, for example.
Jeremy Burns
Class Outfit
[email protected]
http://www.classoutfit.com
On 13 Oct 2010, at 11:55, euromark wrote:
> sure^^ $schema
> i could have guessed that
> thanks!
>
> and how would I find out which field is the display field?
> $...['displayField'] ?
>
> mark
>
>
> On 13 Okt., 12:31, Jeremy Burns | Class Outfit
> <[email protected]> wrote:
>> if ($schema[$field]['type'] == 'datetime'):
>>
>> Jeremy Burns
>> Class Outfit
>>
>> [email protected]http://www.classoutfit.com
>>
>> On 13 Oct 2010, at 11:09, euromark wrote:
>>
>>> does anyone know how to use schema infos in the baking templates?
>>> to be precise, in the views
>>
>>> currently I check on the field names themselves
>>> if ($field=="created") {
>>> // display formatted date
>>> }
>>> if ($field=="id") {
>>> // skip primary key
>>> }
>>> if ($field=="active") {
>>> // display yes/no image for checkboxes
>>> }
>>> etc
>>
>>> it would be more helpful if i had information about the schema. so i
>>> can handle all "date" and "datetime" fields (even if they are called
>>> "published" etc). and that i can handle all tinyint(1) fields as yes/
>>> no images.
>>
>>> thx
>>
>>> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
>>> with their CakePHP related questions.
>>
>>> You received this message because you are subscribed to the Google Groups
>>> "CakePHP" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected] For more options, visit this group
>>> athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en