![]() However, in that same action I'm echoing a 'pass' or 'fail' to signal my view of the result. Method Summary requestAction () public deprecated Calls a controller's method from any location. Var chart = Highcharts.chart( // code to create graphÄocument.getElementById('data').For an action in my controller that needs no view, I'm disabling the layout and template like this: $this->autoRender = false Īnd it's all good. CakePHP Version: 3.4 A Trait RequestActionTrait Provides the requestAction () method for doing sub-requests Namespace: Cake\Routing Deprecated: 3.3.0 Use view cells instead. This is the part of the view I want to stay rendered where I have the functionality related to the hidden form Form->create('Save data', array('url'=>'/exportations/save_data/'.$id, 'enctype' => 'multipart/form-data', 'method' => 'post', 'id' => 'data'))?> How to use Elfinder with CkEditor in CakePHP This article refers to CakePHP 4, but actually the same technique can be used for CakePHP 2.x This works both. In case it helps, I am adding the code I have for this action: Due to this, I'd like to know if there is another alternative for being able to call one function in my controller but staying at the page I am at (not by redirecting because of the looping aspect). CakePHP controllers trigger several events/callbacks that you can use to insert logic around the request life-cycle: Event List Controller.initialize Controller.startup Controller.beforeRedirect Controller.beforeRender Controller. autoRender false //3 App::import('Vendor','pData', array('file' >'pchart'.DS.'pData.class')) App::import('Vendor','pChart', array('file' >'pchart'.DS.'pChart.class')) //4 fontFolder APP.'vendors'.DS.'pchart'.DS. Nevertheless, these lines do not seem to be working for me, as the action keeps being redirected to this function trying to render a non existing view instead of staying in the previous one. Therefore, I wanted to call this function without redirecting to the previous view but without rendering a new view either, for which I was using the following: $this->autoRender = false To upgrade to 3.6.x run the following composer command: php composer.phar require -update-with-dependencies 'cakephp/cakephp:3.6.'. The AppController class can be defined in src/Controller/AppController.php and it should contain methods that are shared between all of your applicationâs. ![]() ![]() Either you can change your default home page in your /config/routes. The goal of this tutorial is to show a basic chart using pChart in CakePHP environment, during this process, you should gain the idea of using pChart in CakePHP. ![]() display function manages pages and subpages itself that is why you are getting error. Your applicationâs controllers extend the AppController class, which in turn extends the core Controller class. Cakephp by default takes Pages controller's display actions as a home page. This page outlines the changes and improvements made in 3.6. In CakePHP, a controller is named after the primary model it handles. Although CakePHP will automatically call it after every actionâs logic (unless youâve called this->disableAutoRender () ), you can use it to specify an alternate view file by specifying a view file name as first argument of Controller::render () method. My problem is that I don't want to leave the current view, but I can not redirect to the view I want to stay in either because that would create a constant loop of loading the page, calling my function when loading has finished and then redirecting again. CakePHP omits options if they are false You need to change your code like so: autoRender false > That should stop the view from. CakePHP 3.6 is an API compatible upgrade from 3.5.I am trying to submit a hidden form whenever a page is loaded, for which I have created a function in my controller. ( controller > Topics action > printInfo file > /home/.sites/106/site15/cakephp/app/views/topics/printinfo.thtml ) pageTitle > Missing View.
0 Comments
Leave a Reply. |