I am using an MVC pattern to represent a table with many records of music albums. To each music album there are attributes (genre, artist, ratings, etc). Each attribute can have multiple values (so the genre of one album can be both "pop" and "latin", for example). I want to represent those attribute values using table(s).
So there are ...
I haven't been able to find any information regarding the best way to handle record editing with approval in CakePHP.
Specifically, I need to allow users to edit data in a record, but the edited data should not overwrite the original record data until administrators have approved the change. I could put the edited records in a new tabl...
This works:
function upload($directory) {
App::import('Vendor', 'UploadedFiles', array('file' => 'UploadedFiles.php'));
echo $directory;
$this->_saveUploadedFiles('C:/xampp/htdocs/freetickets/app/webroot/img/gallery/zantje_11042/');
}
function _saveUploadedFiles($galleryPath) {
$absGalleryPath = $galle...
Hello,
I have an app where I need to call some JS in the onLoad event of the BODY tag of two forms. However, I can't find how to modify the tag for just them. Does anyone know?
Frank
...
I want to use CakePHP's core validation for lists in my model:
var $validate = array(
'selectBox' => array(
'allowedChoice' => array(
'rule' => array('inList', $listToCheck),
'message' => 'Enter something in listToCheck.'
)
)
);
However, the $listToCheck array is the same array that's used in the view, to populate a ...
Hi,
I would like to pass a variable from one controller function to an other. In other words, how can I access the variable from an other function, within the same controller?
Thanks
...
<?php
class UploadsController extends AppController {
var $name = 'Uploads';
var $components = array('Auth');
var $uses = array('Upload');
function beforeFilter() {
$this->Auth->allow('*');
}
function upload($event) {
App::import('Vendor', 'UploadedFiles', array('file' => 'UploadedFiles.php'));
$user = $this->Auth->user('i...
Here's the current flow of my quiz app:
users/do_program
quiz_contents/view
quiz_questions/do_quiz
The checking if the user has to do another module after finishing the current ones are in the quiz_contents and quiz_questions controller which I think can be improved because of the duplicate code. So what would you guys suggest?
Some...
Hi I'm using CakePHP and I'm wondering do you guys puts isset() or !empty() around all of your variables in the views? Or should I depend on the data validation? What would be the suggested solution?
...
I have a facebook connect site. I am able to "login" to my site with the facebook api & fbml. I would like to give my users the ability to invite friends. I am using the multi invite and the form shows up fine.
My problem is once the user either invites or cancels on the page, the request back to my application from facebook, causes ...
If my whole site is using the default.ctp layout specified in apps/view/layouts/default.ctp, how do I change only the home page layout to use homepage.ctp and leave the rest of the site using default.ctp?
...
Hello,
I have a controller named sales_controller at this controller I got a function in wich I want to:
update information about the sale -> DONE
create a new record on other model -> DONE
update a field on a user record -> PROBLEM
My last attempted to do this was:
App::import('model','User');
$user= $this->Auth->user();
$nr = $t...
I'm having an issue with a misbehaving behavior. The short of it is that I am hooking into the beforeSave and afterSave callbacks using a behavior, but this has unintended consequences for my situation. Is it possible to replicate this?
$this->Model->bsCallback();
if ($this->Model->saveAll($this->data)) { // Model might have other rel...
i use validation in model like this
'email' => array(
//'UniqueMail'=>array('rule' => array('checkEmailUnique', 'email' ),'message' => 'mail is used'),
'email'=>array('rule' => 'email','message' => 'mail not valid'),
'notEmpty'=>array('rule' => 'notEmpty','message' => '*'),
)
and this validation...
Hi,
I have a windows shared hosting account with Godaddy.com with PHP5 that does not allow cron or scheduled job.
I am developing a website in PHP5 with CakePHP and I need to run a cron job to send emails.
What will be the best way to do it?
Thanks for your answers in advance. :)
...
Well this may be a question with a simple answer but I've been searching and couldn't find how to do this.
I have the models: sales and follow. The table follow has an id, an user_id and sale_id.
What I wan't to do is: on the sales_controller I need to find one follow record that has the user_id that is Authenticated and the sale_id tha...
I haven't quite figured this out. EVERY piece of documentation I've found covers how to use xdebug to debug scripts running in Apache. I need to debug a php CLI script.
So, for instance, how do I pass the XDEBUG_SESSION_START variable in to get xdebug to kick on?
I'm specifically trying to debug a CakePHP shell. So if anyone has any ad...
Is there a way to check if a cakePHP action is being called from an swf/flash movie like there is for Ajax using the requestHandler?
...
I've got a CakePHP search form that has 'type'=>'get'. Basically, one of the elements in the form is a submit button of type image. When the form is posted, in the URL I always get these x & y coordinates of the image submit button:
http://site.com/controller/action?x=22&y=36&query=hello
Is there any way I can prevent the coor...
Hi,
I'm kind of new to cakePHP and get to the moment where i have to do pagination.
The comments table has a parent_id and the threaded query is working correctly so now, I want to paginate the results.
My problem is the limited sql query affects all the retrieved comments and I only want to limit the parent ones because the other way...