Sometimes Im get this kind of error when working with my plugins:
Class PluginNameAppController not found in ...
It's really weird because I connect plugin AppController before any controller using App::uses();
And this error occur randomly, then, I refresh current page (or clean tmp\cache\persistent) and it's gone.
I have 3 plugins connected in Config/bootstrap.php and I think they are conflicting some how.
Cakephp 2.6.0.
Use
Configure::write('Cache.viewPrefix', 'prefix');
with different value
in PluginAppController's beforeFilter function.
Ok, problem is still not resolved, but here is few solutions to resolve it:
Comment this lines in core.php: chopapp.com/#i5x18g0p
Uncomment Cache.disable in core.php: Configure::write('Cache.disable', true);
Using CakePHP 2.3. I turned on the security component, and I noticed an odd behavior with postLinks, where for some reason they are no longer seem to be transmitting data by POST, but instead they are using GET. In the action I'm trying to call, the first thing I do is to ensure that the data was made by POST:
if (!$this->request->is('post'))
{
throw new MethodNotAllowedException();
}
When the security component is on, this if statement is false. When it is off, the if statement is true. No other changes have been made.
The postLink:
<?php echo $this->Form->postLink($this->Html->image('icons/resend-icon.png'), array('action' => 'resend', $invoice['Invoice']['number']), array('escape' => false, 'class' => 'hastip', 'title' => 'Resend'), __('Are you sure you want to resend this invoice?')); ?>
As far as I've been able to look, I've found no explanation for this. I would prefer if I could make sure the data is actually being sent by POST, though everything else works if I remove the check for the request is a POST.
Edit:
I've discovered that if I set $this->Security->csrfCheck = false; and $this->Security->validatePost = false; in the before filter for that particular action, it does not have this problem. I would still like to know why precisely this is though.
Edit 2:
After more investigation, I discovered the view of the page in question has another form on it, echo $this->Form->create('Invoice', array('type' => 'get')); which should not be affecting the post links in any way (post links are not inside the form, etc.), but if I remove the array('type' => 'get'), the postLinks start working. I need the other form to be of type get though, as it's a search form, and I need to have the search query string in the URL.
Edit 3:
I've discovered that moving the search form below the post links also fixes the problem. I tried running the markup through a html validator to make sure nothing was malformed, but it did not report anything.
Edit 4:
I discovered that the markup being generated for the PostLinks is incorrect -- the hidden inputs used for detecting CSRF are named incorrectly, resulting in it failing CSRF tests. Thus, the request is getting blackholed. I have set up a blackhole callback to redirect http:// to https://, so the page gets redirected, resulting in a new get request for the same page, which then gets rejected by the MethodNotAllowedException. Trying to investigate now why the PostLinks aren't being generated correctly.
I determined the solution is after finishing with the first form, I needed to reset the Form helper's request type.
<?php echo $this->Form->create('Invoice', array('type' => 'get')); ?>
<?php echo $this->Form->end(); ?>
<?php $this->Form->requestType = null; ?>
$this->Form->requestType starts as null, and gets set by calling $this->Form->create. So if I set the earlier Form to be post, or if I had created the Form after using postLinks, the Form helper's request type is set to a value that will work with PostLinks when I attempted to create the postLinks, but it appears manually resetting requestType also works.
Edit: This is actually a bug with the CakePHP framework. I have reported it, and it has been fixed, so this is no longer necessary in the newest version of CakePHP.
I'm working with a facebook tab. It's an iframe posts will recieve certain in the http-response only if the page is embedded in an iframe. This means that I can't use $http as I normally do. I try to figure out how to supply this data to angular.
I tried this, but it doesn't work.
<?php
if($signed_request['page']['liked'] == 1){
echo '<script type="text/javascript">$scope.liking = true</script>';
}else{
echo '<script type="text/javascript">$scope.liking = false</script>';
}
?>
I have considered adding some sort of html-field, like an input type="hidden" with a ng-model attatched to it, but it feels kind of hacky. Does angular have any suggested approach to solve this kind of problem?
I have one problem with CakePHP and $requestAction. In the 1.3 manual of cakephp there is written
It is important to note that making a requestAction using 'return' from a controller method can cause script and css tags to not work correctly.
Now I got this case. The contents of $html->css() and $html->script() are not displayed in the final view after using a $this->requestAction() in combination with return in the controller.
Does anybody know a workaround for this problem? How to use styles and scripts together with $this->requestAction(<...>, array('return'))?
I am trying to create a subscribable web cal. The file works, if I link to it directly. But when generated out of CAKEPHP, even with a blank layout, the calendar program says the data is invalid. I am guessing there are some hidden headers, data, something that cakephp is sending in the background. Any way to have cakephp just send the actual file?
Any other ideas why I can't subscribe?
Make sure that you put Configure::Write('debug',0); in the action in your controller that returns the data for the calendar. And then make sure you call a layout that ONLY has <?php echo $content_for_layout; ?> and nothing else in it using $this->layout = ‘yourlayout’; in that same action in the controller.