Monday, August 22, 2011

Accessing Model Fields in Controller Template

Hello,

I am modifying baking template as per my need. How can I access model
fields collecting in controller.ctp ?

Currently I am using following code which is working properly but I
need more proper way.


var $filters = array(
'index' => array(
'<?php echo $name; ?>' => array(
<?php foreach ($modelObj->_schema as $key => $field) { ?>
<?php if(!in_array($key,array('id','modified','created'))) { ?>
'<?php echo $name; ?>.<?php echo $key; ?>' => array(),
<? } ?>
<? } ?>
)
)
);


Regards,
Sanjeev

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: