There should be a better way than what I am doing right now......

I have a set of 3 default Roles (Owner, Admin, Member).  users can add, 
delete, modify the Roles, except the 3 Default Roles.

If I create views like "edit", then all the fields in the Role table, go 
into a Form and are editable.

So, now, in the edit.ctp, I am comparing the name to see if I want to 
make it editable.

if (in_array($this->request->data['name'], array('owner', 
'admin','member'))) {
     echo $this->Form->label('Role.name', 'Role: 
'.$this->request->data['name']);
} else {
     echo $this->Form->input('Role.name');
}

I have several things like this that are either displayed (not editable) 
or editable depending on the role or permissions of the user.  I don't 
want to create different controller functions and different views for 
each variation. But, I am also not sure that passing a bunch of 
information to views and have them make the decision is right either.

Anyone have any suggestions?

Thanks,
bill


--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/How-to-avoid-extra-php-code-in-views-tp5689970.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to