Using Model->find('all') returns an array with the following structure:
array(
0 => array('Model1' => array(/* Model1 fields*/), 'Model2' => array(/* Model2 fields*/), ...),
1 => array('Model1' => array(/* Model1 fields*/), 'Model2' => array(/* Model2 fields*/), ...),
...)
When a single Model is queried (i.e. Recursive = -1), is...
I'm working on integrating authentication and authorization into my CakePHP application now and am having some difficulties.
First up, I'm not using ACL. It scares me.
In my AppController I have this:
var $components = array("Auth");
So, any time I want to check the logged in user, I call this from one of my controllers:
$this->Aut...
I have three divs (on the same page)with different id that I would like to use pagination for. I am using CakePHP's inbuilt pagination method to bring about this. The first page for all the divs are displayed correctly. But if I am in the first page of the second div and click the next link, I get the next items of the first div.
And s...
I am getting a Missing Helper error when I am trying to upload my cake php files to a shared host.
Undefined variable: javascript
Missing Helper File
It is working fine on my local machine.
I have the following directory structure in shared hosting:(using cpanel)
/home/user/
/app
/cake
/vendors
/public _html
/css
...
In my Users controller, I find the number of forms that the user has created by querying the 'Forms' table and store it in an array. But how to use the array variables in the view file.
Normally, I would set the variable in the controller using set function and use it in the view file as such. But how to set an array in the controller? ...
Duplicate of
What is a PHP Framework?
and many more
So far, I've been using PHP for small tweaks, mostly with WordPress. What are PHP frameworks? Why do I need them? WHEN do I need them?
Any insight will be helpful. Thanks.
...
Possible Duplicates:
What PHP framework would you choose for a new application and why?
Whats your no framework PHP framework?
I am thinking to use a MVC framework in php. I used codeigniter before for some of my project.
Codigniter is light weighted compared to other framework. But it has less functionality compared to the ot...
I have the following relationships set up:
A HABTM B
B belongsTo C
C hasMany B
Now, for a given A, I need all C with the B's attached. I can write the SQL queries, but what's the proper CakePHP way? What method do I call on which model, and with which parameters?
...
Hi,
In my cakePHP controller there is an action named saveReport() where $attribute_ids is an array holding all the selected attributes obtained from the Ajax post..
function saveReport()
{
echo $this->params['form']['formid'];
echo $this->params['form']['reportTitle'];
echo $this->params['form']['attr'];
$attribute_ids...
hi ,
I am having a table named reports having (id,form_id,title)
and another table form(id,name)
in my reports.ctp
i am listing all my reports title by fetching it from the table using
function reports()
{
$allreports= $this->Report>find('all',
array('conditions'=>array('Report.user_id'=>$userI...
In an attempt to keep my scripts maintainable, I'm going to move each into their own file, organised by controller and action:
// scripts which only apply to /views/posts/add.ctp
/app/webroot/js/page/posts/add.js
// scripts which only apply to /view/users/index.ctp
/app/webroot/js/page/users/index.js
That's all cool, however I'd like...
Hi,
i am having a action like
$report_attrid=$this->Report->find('all',array('conditions'=>array('Report.report_id'=>$report_id,'Report.user_id'=>$userId)));
foreach($report_attrid as & $reportattrid):
$reportattrid['Report']['value']=$this->Result->find('all',array('fields'=>array('Result.label','Result.value','Result.submitter_...
Hi,
i am having a query like
$report_attrid=$this->Report->find('all',array('conditions'=>array('Report.report_id'=>$report_id,'Report.user_id'=>$userId)));
foreach($report_attrid as & $reportattrid):
$reportattrid['Report']['attr']=$this->Attribute->find('all',array('fields'=>array('Attribute.id','Attribute.label'),'c...
Hi,
i am having a Table structure like
Reports
id report_id title form_id attribute_id
1 1 r1 24 69
2 1 r1 24 72
Results
id form_id attribute_id value submitter_id
1 24 69 A 1
2 24 69 B 2
3 24 72 ...
hi,
i am having the QUery in my controller actions as
$report_attrid=$this->Report->find('all',array('conditions'=>array('Report.report_id'=>$report_id,'Report.user_id'=>$userId)));
$submitters['Result']['submitters']=$this->Result->find('all',array('conditions'=>array('Result.form_id'=>$report_form_id)
,'group'=>array('Result.su...
I am working on a project using CakePHP and have been trying to update some views. The file uploads to the server correctly but the system seems to serve the old version. I am kind of new to Cake so I'd appreciate any pointers.
Thanks!
...
What's the best way in cakephp to extend the html->link function so that I can
tell it to output a secure(https) link?
Right now, I've added my own secure_link function to app_helpers that's basically a
copy of the link function but adding a https to the beginning.
But it seems like there should be a better way of overriding the html...
Hi,
while opening a page to view my Form in my application i am getting the error
as
[Exception... "'Syntax error, unrecognized expression: #' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "" data: no]
i dont know why its so??? please suggest me.
i am having JQ...
I need to redirect the default CakePHP home page / or (/pages/home) to /users/dashboard page
I tried
Router::connect('/', array('controller' => 'users', 'action' => 'dashboard'));
and
Router::connect('/pages/home', array('controller' => 'users', 'action' => 'dashboard'));
But both are not working
...
I haven't used Rails, but I'm somewhat familiar with it. I'm more familiar with CakePHP. I get the idea that CakePHP is modeled after Rails, and they seem to have a lot in common.
But, basically, I'd like to know if patterning itself after Rails is, or has ever been, one of the goals of CakePHP? I understand it's not a port, but is R...