My last post can be found here,
CakePHP Issue : Call to a member function find() on a non-object
I am asking a new question, as the people who answered my last question, said that the error I am getting now is a new problem, therefore a new post.
Please read my last post, if any of you wish me to re-post all my code on this post I will do so, just ask!
So my problem is that, yes once I do remove the vars $uses from my code, it works in the NEW copy of cake I have put on the same server. However it just bypasses my die command when I use it on my live site! Now I know (or at lest think) this must be something to do with the way this copy of cake was configured.
Also, in the NEW copy of cake I did not have to add a 'Router' path in the routes.php file for it to work. However on the live site, it will just give me a 404 error when trying to access the controller. Now with the NEW copy of cake, I called the function index(), but in the live site I named it eventDetails(), now I have tried changing this to index(), but I still get a 404 error when the router path is not there and the same 'Internal Error Has Occurred', see last post.
Any ideas?
Again any help would be very welcome.
Glenn Curtis.
Thanks For your help Dunhamzz.
But I have solved the issue. I knew it was something to do with my set-up and the guy who set-up this cake site set the debug level to 0. While the new copy of cake had it set to 2.
Thanks
Glenn.
Related
I am trying to run the following code to generate a simple To Do list app using Angular: https://raw.githubusercontent.com/kumarneetesh24/angular-app/master/mytodoapp.html
But I am getting the following output.
Could any one help me to find out what i am missing .Apart from this the app is not creating new tasks (upon entering and pressing go)
Your angular js file is not getting loaded .
use this script tag :
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script>
You First Need to do some re-search and Understand the Concept . Looks
like you copy pasted the code from some where and asking for help .
This type of posts are not acceptable as per stack overflow documentation.
Glad Some of the Guys helped you with out any suggestions which is
Good but at least let them know what they missing .
I provided you plunker :-
learn todo
https://plnkr.co/edit/dA0bSLWm3T7KYctQosO7?p=preview
Understand your self and Update your post How you Figured
Thanks.
.
There is no problem in your code. You must add localhost to the Trusted Sites Zone or publish your code to the target server.
I'm trying to bake my first CakePHP application and am unable to get any page to particularly load for me right now. I've updated my config settings for salt,database, etc. and the index.php page tells me that I have configured everything.
So far I've used cake bake all on just one database table so far to make sure it loads properly. I created the Model, Controller, and View for the standard add/index/view/edit pages. When I try to access URL/organizations/index.php I'm hitting a 404 error however.
Is there any troubleshooting someone might have advice for how to solve this one? It is confusing to me that the index.php loads (so it redirects properly when loading the webroot) but trying to view any View pages yields no results. Is there any debug commands I can do to view what the valid pages would be? Or any additional information I can provide?
If you try URL/index.php/organisations or something similar to this and it works, then there is an issue with URL re-writing on the server which you'll need to correct.
I believe if you have things set up correctly you would want to visit /organizations in order to access the index() method of the organizations controller.
In general the ".php" is left off of the URL, as your index.php file initiates all the bootstrapping and routing. This also requires a correct .htaccess setup. Hard to say exactly what the problem is without seeing the app or an error message.
Try in url
URL/organizations/index.php
To
URL/organizations/index
or
URL/organizations/index.ctp
Cakephp using .ctp extension, that means cakephp Template. Please see this link. And also you can see your app\view\Organizations folder. Here all file is with .ctp extension. Isn't it ?
Background: I'm new to CakePHP and trying to modify an preexisting project.
When I try to add a new UploadsController it is supposed to handle xxxx/uploads requests right?
However, when entering the url neither AppController or UploadsController, allow index.php to do a dispatch. Files are being called. It goes straight to /uploads which is a directory.
I realize this is a bad design to begin with but trying to fix things one step at a time. Need to authenticate before going to /uploads, and than take action.
What am I doing wrong? I tried to modify routes.php to specify controller but that does not work either.
So as I said I am new and fixing someone else's project. I found that there is a security issue where uploads directory is exposed. So I figured I would add Controller to take care of this. uploads folder was under webroot as a result it was going to uploads folder and was not directing to controller. Thanks and hopes this helps someone in the future.. although kind of doubt it since it was a really bad way to do this to begin with.
With the info you gave this is what I can suggest:
Check to see if the UploadsController is in the Controller folder.
Make sure that there's at least a index.ctp file in Views/Uploads/
Check to see if the UploadsController has a default index() method. This is what www.example.com/uploads/ will hit.
I am referring to the problem that has already been asked. CakePHP 2.0 - How to make custom error pages?
It gives me a lot idea of solving out the problem but instead of thowing exception I want to use it for all of my controller and actions. It suggested me to do where ever at particular location I want throw new NotFoundException(); I want it everywhere I mean where so ever controller or action is missing.
With debug turned off all your error are converted to either 400 or 500 errors. So you just need to customize your app/View/Errors/error400.ctp and app/View/Errors/error500.ctp as required.
I am having some issues with a site that was working correctly until i implemented full page caching in CakePHP.
I have followed the guidance in the Manual and have my $session->flash in a no-cache block as so:
<cake:nocache>
<?
if($session->check('Message.flash')){
$session->flash();
}
?>
</cake:nocache>
However, whenever a controller sets a flash message and redirects to a cached page the page loads down to the tag and then gives the error:
Notice (8): Trying to get property of non-object
[CORE/cake/libs/view/helpers/session.php, line 145]
Fatal error: Call to undefined method stdClass::renderLayout() in
/home/decipherd/domains/example.com/public_html/beta/cake/libs/view/helpers/session.php
on line 14
If i then go to a page created by another controller the correct (delayed) message is displayed and the page loads correctly.
I have now submitted this to the CakePHP trac as ticket 282
Sounds like it might be an issue with the core, have you tried submitting a bug report?
Are you sure that there is something in the flash message? Try:
debug($session->read());
OR to output it to the debug.log
$this->log($session->read(), LOG_DEBUG); // this might not work in the view?
Looking at the error message, it seems as is SessionHelper is not available for some reason.
I am not sure why exactly, this helper is usually loaded automatically when using AuthComponent or SessionComponent in your application.
Just a guess, but it might be worth putting $helpers = array('Session', ...); in your problem controller or AppController for good measure.
You can inspect everything available to your view with debug($this);
Ultimately, I would take Matt's advice and upgrade to the latest stable version anyway.