1. create ACL is quite easy, using croogo acl plugin, visit
http://localhost:8000/admin/acl/acl_permissions
then use 'generate actions' to generate all acl related model data
if your website is pretty big, then you might most likely meet the sql query timeout error.
change the default value from 30 to a proper one like: 120 (seconds) to make it works.
for example, if you are using zend server, change below variable in /Zend/ZendServer/etc/php.ini:
max_execution_time = 120 ; Maximum execution time of each script, in seconds
2.JQuery append method tricky, the following function doesn't work.
<script type="text/javascript">
$(function() {
var i = 2;
$('#addSmallImage').click(function() {
$('#deal-small-images').append('<div><input class="ui-corner-all" type="file" name=' + 'data[DealImage][simage' + i + ']>' + '<a href="#" class="del-small-image">Delete</a></div>');
i++;
});
$('.del-small-image').live('click',function(){
$(this).parent().remove();
i--;
});
});
</script>
because the var 'i' cann't be recognized in jquery append function, correct it by the below:
...
$sname = '<div><input class="ui-corner-all" type="file" name=' + 'data[DealImage][simage' + i + ']>' + '<a href="#" class="del-small-image">Delete</a></div>';
$('#deal-small-images').append($sname);
...
3.form including files
you must setenctype="multipart/form-data" method="post", this can be donein cakephp by below:
Specifying ‘file’ changes the form submission method to ‘post’, and includes an enctype of “multipart/form-data” on the form tag. This is to be used if there are any file elements inside the form. The absence of the proper enctype attribute will cause the file uploads not to function.
<?php echo $this->Form->create('User', array('type' => 'file')); ?> //Output: <form id="UserAddForm" enctype="multipart/form-data" method="post" action="/users/add">
<?php echo $this->Form->create('User', array('type' => 'file')); ?>
//Output:
<form id="UserAddForm" enctype="multipart/form-data" method="post" action="/users/add">
Note: the element name should be the correct one lookslike: data[DealImage][simage1], ortherwise, the file will not be passed when submiting the data to controller.
4. cakephp url name tricky
if you input http://yourhost/faq inyourie/ff, you will be redirected to home controller rather than a visit error, this might be caused by your router which drived from cakephp dispatcher/router, typically the following code will made cakerouter reserved3 characters "[a-z]3" for localeusage.
Router::connect('/:locale' . $route, $default, array_merge(array('locale' => '[a-z]{3}'), $params));
so in your router.php,3 characters urlcan not be used for mapping.
5. cakephp saveAll tricky
saveAll will save the main table and associatedtable data,if youget save failure, please check:
*)all 'not null' fieldshavethe value filled
*) all value type are correct, don'tscrew up the 'int' and 'string' especiallywhen you dealing with an enum data
*)make surethe idof all tables are "autocrement"
if you still get errors, then use 'save' methodone by one.