Re: Plugin appController beforeFilter() action doesn't work anymore
I didn't find out which release changes caused the problem. But yesterday, I finally got the answar. When I changed the "beforeFilter" tot "beforeRender", it worked again! Thanks anyway for the help! Op donderdag 22 oktober 2015 12:13:17 UTC+2 schreef Rob Maurer: > > There are changes made with each minor release that can affect your app; > start here (http://book.cakephp.org/2.0/en/appendices.html) to see them > listed all in one place. - Rob Maurer > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Plugin appController beforeFilter() action doesn't work anymore
There are changes made with each minor release that can affect your app; start here (http://book.cakephp.org/2.0/en/appendices.html) to see them listed all in one place. - Rob Maurer -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Plugin appController beforeFilter() action doesn't work anymore
Since my update from CakePhp 2.3. to CakePhp 2.7., my beforeFilter() action in pluginAppController doesn't work anymore: array( 'loginAction' => array( 'plugin' => 'coaster_cms', 'controller' => 'users', 'action' => 'login' ), 'loginRedirect' => array( 'plugin' => 'coaster_cms', 'controller' => 'attractions', 'action' => 'index' ), 'authenticate' => array( 'Form' => array( 'passwordHasher' => 'Blowfish' ) ), 'authError' => 'No rights to visit this page.' ) ); public function beforeFilter() { debug('test'); // No "test" output in any of my plugin actions parent::beforeFilter() } } ?> Does anybody knows what could possibly go wrong in my application that causes this? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
use App\Controller\AppController;
Hi All, Cake 3.0. When is/isn't use App\Controller\AppController; required in a controller? The blog tutorial does not use it, some of the examples on the controllers page use it, but not all. Can anyone explain exactly when his is needed please? Thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: When to use appcontroller
Why don't you authenticate the user in the AppController if the user is a user, then load the appropriate Model, get the values you need through the Model and set it to the view. This can all be done within the beforeFilter of your AppController. On Wednesday, January 14, 2015 at 3:10:39 AM UTC+2, Ben Merton wrote: I'm wanting to make certain variables (counts of various records) to be used on most views in my app. Currently I'm both loading each relevant model and doing the count operation to create the variable I want to pass to my views within the appcontroller as it will then be available to every view. Is this the best way to do it or is there a better way to do it that keeps the code out of the appcontroller. For context, I'm showing user statistics on each page of the users part of the site. Thanks! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: When to use appcontroller
You could use a component instead. mark Am Mittwoch, 14. Januar 2015 02:10:39 UTC+1 schrieb Ben Merton: I'm wanting to make certain variables (counts of various records) to be used on most views in my app. Currently I'm both loading each relevant model and doing the count operation to create the variable I want to pass to my views within the appcontroller as it will then be available to every view. Is this the best way to do it or is there a better way to do it that keeps the code out of the appcontroller. For context, I'm showing user statistics on each page of the users part of the site. Thanks! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
When to use appcontroller
I'm wanting to make certain variables (counts of various records) to be used on most views in my app. Currently I'm both loading each relevant model and doing the count operation to create the variable I want to pass to my views within the appcontroller as it will then be available to every view. Is this the best way to do it or is there a better way to do it that keeps the code out of the appcontroller. For context, I'm showing user statistics on each page of the users part of the site. Thanks! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: AppController::beforeRender usage question.
Just to offer an additional option, if you still want to do it in beforeRender you can unlock fields and unlock actions in the Security Component, this will stop it from creating a blackhole but you are losing a bit of the security by doing so. This is usually used when performing ajax for example... I don't recommend doing it if you can avoid it. http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#form-tampering-prevention http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#disabling-csrf-and-post-data-validation-for-specific-actions HTH On 7 November 2014 04:40, heavyKevy arnett.ke...@gmail.com wrote: Generally you get the black hole if you add fields to the form without using the form helper. If you need to add information to the form that is not exposed to the user, use hidden fields. On Thursday, November 6, 2014 10:48:06 AM UTC+7, glk wrote: Hello everyone, I'm trying to add data fields to $this-request-data within the AppController::beforeRender() function. When the view is created, all of the data fields exist, but when the form is submitted... the great blackhole appears. I probably need to just put the additional fields in while in the controller, but was trying to use the beforeRender call back to keep DRY! Thanks for any assitance, Greg -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout. -- Kind Regards Stephen Speakman -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: AppController::beforeRender usage question.
When looking at the Security I find the following: Controller creates data array. View is rendered. 1) In the view I create an input for a field NOT already defined in the data array... blackhole 2) I create an input for a field NOT already defined in the data array (type=hidden) I also get.. blackhole *3) If an input is created div style=display:none input /div NO blackhole* 4) If the input is created div style=display:none input with type=hidden /div YES to the blackhole I don't think Security should allow #3, but as of 2.5.4 it does! My original question concerning adding data fields to every edit and add method with beforeRender was to get around points 1 2; to keep from doing it in each and every controller, and to keep from using lock/unlock security settings. So my question now becomes: When does Security calculate its _Token for an edit or add form... Before the beforeRender() or after? Thanks, Greg -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: AppController::beforeRender usage question.
Well silly me... The reason that the hidden fields created blackhole was simple: I was modifying the contents of the fields when the user changed other data on the form! From the documentation: Form tampering prevention By default the SecurityComponent prevents users from tampering with forms in specific ways. The SecurityComponent will prevent the following things: - Unknown fields cannot be added to the form. - Fields cannot be removed from the form. - Values in hidden inputs cannot be modified. So my hidden div solves that issue. Duh! But still need to find out when the SecurityComponent calculates its hash? On Friday, November 7, 2014 11:26:33 AM UTC-7, glk wrote: When looking at the Security I find the following: Controller creates data array. View is rendered. 1) In the view I create an input for a field NOT already defined in the data array... blackhole 2) I create an input for a field NOT already defined in the data array (type=hidden) I also get.. blackhole *3) If an input is created div style=display:none input /div NO blackhole* 4) If the input is created div style=display:none input with type=hidden /div YES to the blackhole I don't think Security should allow #3, but as of 2.5.4 it does! My original question concerning adding data fields to every edit and add method with beforeRender was to get around points 1 2; to keep from doing it in each and every controller, and to keep from using lock/unlock security settings. So my question now becomes: When does Security calculate its _Token for an edit or add form... Before the beforeRender() or after? Thanks, Greg -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
The AppController
I've always wondered if it is a preference or a standard to define function in your AppController instead of your Controller, for example: public function admin_index() {...} Instead of doing hte above in each Controller, is it alight to do this in the AppController? This way the function is accessible by all controller and there is minimal duplicate code. What are the best practices of CakePHP when it comes to this? Will doing the function in each Controller improve performance of the entire application or does it not even matter? Opinions? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: The AppController
Read about https://github.com/FriendsOfCake/crud it kind of does exactly that - but in a cleaner way :) mark Am Donnerstag, 6. November 2014 17:48:05 UTC+1 schrieb David Cole: I've always wondered if it is a preference or a standard to define function in your AppController instead of your Controller, for example: public function admin_index() {...} Instead of doing hte above in each Controller, is it alight to do this in the AppController? This way the function is accessible by all controller and there is minimal duplicate code. What are the best practices of CakePHP when it comes to this? Will doing the function in each Controller improve performance of the entire application or does it not even matter? Opinions? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: The AppController
Looks interesting, but my question was if it is more practical to duplicate each function in each controller instead of having just one function in the AppController. Which is best practice? What is faster when loading the application/webpage. On Thursday, November 6, 2014 6:50:12 PM UTC-6, euromark wrote: Read about https://github.com/FriendsOfCake/crud it kind of does exactly that - but in a cleaner way :) mark Am Donnerstag, 6. November 2014 17:48:05 UTC+1 schrieb David Cole: I've always wondered if it is a preference or a standard to define function in your AppController instead of your Controller, for example: public function admin_index() {...} Instead of doing hte above in each Controller, is it alight to do this in the AppController? This way the function is accessible by all controller and there is minimal duplicate code. What are the best practices of CakePHP when it comes to this? Will doing the function in each Controller improve performance of the entire application or does it not even matter? Opinions? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: AppController::beforeRender usage question.
beforeRender() is for the tasks you want to perform before views are rendered. $this-Request-data array gets reset every time any kind of request happens so there is no point adding extra field in there in beforeRender(). 2014年11月6日木曜日 12時48分06秒 UTC+9 glk: Hello everyone, I'm trying to add data fields to $this-request-data within the AppController::beforeRender() function. When the view is created, all of the data fields exist, but when the form is submitted... the great blackhole appears. I probably need to just put the additional fields in while in the controller, but was trying to use the beforeRender call back to keep DRY! Thanks for any assitance, Greg -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: AppController::beforeRender usage question.
Generally you get the black hole if you add fields to the form without using the form helper. If you need to add information to the form that is not exposed to the user, use hidden fields. On Thursday, November 6, 2014 10:48:06 AM UTC+7, glk wrote: Hello everyone, I'm trying to add data fields to $this-request-data within the AppController::beforeRender() function. When the view is created, all of the data fields exist, but when the form is submitted... the great blackhole appears. I probably need to just put the additional fields in while in the controller, but was trying to use the beforeRender call back to keep DRY! Thanks for any assitance, Greg -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: The AppController
Of course it's better to write it once rather than many places. But remember, AppController does NOT deal with a particular Model. If you name a controller PostsController, it knows it'll work with Post model. AppController has none of that. So if you are writing some function that could be used from the whole application and not a specific model, go ahead and put it in AppController. Like checking if a user is logged in or not. If you are writing some function that's specific to a model, you have to put it in a designated controller. 2014年11月7日金曜日 10時05分19秒 UTC+9 David Cole: Looks interesting, but my question was if it is more practical to duplicate each function in each controller instead of having just one function in the AppController. Which is best practice? What is faster when loading the application/webpage. On Thursday, November 6, 2014 6:50:12 PM UTC-6, euromark wrote: Read about https://github.com/FriendsOfCake/crud it kind of does exactly that - but in a cleaner way :) mark Am Donnerstag, 6. November 2014 17:48:05 UTC+1 schrieb David Cole: I've always wondered if it is a preference or a standard to define function in your AppController instead of your Controller, for example: public function admin_index() {...} Instead of doing hte above in each Controller, is it alight to do this in the AppController? This way the function is accessible by all controller and there is minimal duplicate code. What are the best practices of CakePHP when it comes to this? Will doing the function in each Controller improve performance of the entire application or does it not even matter? Opinions? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
AppController::beforeRender usage question.
Hello everyone, I'm trying to add data fields to $this-request-data within the AppController::beforeRender() function. When the view is created, all of the data fields exist, but when the form is submitted... the great blackhole appears. I probably need to just put the additional fields in while in the controller, but was trying to use the beforeRender call back to keep DRY! Thanks for any assitance, Greg -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Make AppController variable available in pluginAppController
Okay, that's some basic stuff that I totally forgot! Thanks, it works fine now! ;) -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Make AppController variable available in pluginAppController
You're not setting the variables in the object scope but in the method scope. This means that the variables will be erased from memory when the method execution has been done. You also need to make sure that you call parent::beforeFilter(); In your plugin's AppController. Otherwise the general AppController's beforeFilter won't be called. On Saturday, 6 September 2014 17:46:49 UTC+2, Sam Clauw wrote: In the AppController, I want to put the plugin, controller and action in variables just like this: class AppController extends Controller { public $components = array( 'DebugKit.Toolbar', 'Session' ); public function beforeFilter() { $plugin = $this-request-params['plugin']; $controller = $this-request-params['controller']; $action = $this-request-params['action']; } } Now, I've made a plugin called CoasterCms. I thought every plugin got all the variables stored in AppController so I could get the plugin variable: ?php class CoasterCmsAppController extends AppController { public $helpers = array( 'Html', 'Form', 'Session' ); public $components = array( 'Session', 'Paginator' ); public function beforeFilter() { debug($plugin); } } However, it's not showing anything at all... What's the reason and how can I fix this? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Make AppController variable available in pluginAppController
In the AppController, I want to put the plugin, controller and action in variables just like this: class AppController extends Controller { public $components = array( 'DebugKit.Toolbar', 'Session' ); public function beforeFilter() { $plugin = $this-request-params['plugin']; $controller = $this-request-params['controller']; $action = $this-request-params['action']; } } Now, I've made a plugin called CoasterCms. I thought every plugin got all the variables stored in AppController so I could get the plugin variable: ?php class CoasterCmsAppController extends AppController { public $helpers = array( 'Html', 'Form', 'Session' ); public $components = array( 'Session', 'Paginator' ); public function beforeFilter() { debug($plugin); } } However, it's not showing anything at all... What's the reason and how can I fix this? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: problem with redirect page in AppController beforefilter.
Hey Could you show a snippet of your code so we can see how you're doing it? On 2 May 2014 08:02, Vann Mardy vannmard...@gmail.com wrote: Dear All, i want to check user login beforeFilter , but i have one problem with redirect page (adminstrators/login) in AppController beforeFilter. it show this message The page isn't redirecting properly. please help me. thanks you! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout. -- Kind Regards Stephen Speakman -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
problem with redirect page in AppController beforefilter.
Dear All, i want to check user login beforeFilter , but i have one problem with redirect page (adminstrators/login) in AppController beforeFilter. it show this message The page isn't redirecting properly. please help me. thanks you! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: __construct causing error in AppController
Because you've missing params for __construct() method :) Try to: public function __construct($request = null, $response = null) { parent::__construct($request, $response); //Write to here... } I used and successfully! On Wednesday, August 26, 2009 2:53:17 AM UTC+7, Benjamin Moses Lieb wrote: My new AppController is empty, and I added an empty __construct () to add some info for all my controllers ?php class AppController extends Controller { function __construct () { } } ? However the addition of the __construct() function causes this error: Fatal error: Call to a member function init() on a non-object in / apppath/cake/libs/controller/controller.php on line 442 -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Wrong AppController called when 2 projects are accessed simultaneously
Hi, I am using CakePHP 2.2.1, and running 2 cake projects on my machine. Both projects use the same plugins, i.e. I have simlinks in the app/Plugin folders of both project that link to CakePHP/trunk/plugins/ If I access either project separately I don't have any issues but if I access both projects around the same time, the beforeFilter of the wrong AppController is called. example: 1) log into PROJECT1 2) log into PROJECT2 from different tab or browser or machine 3) The following error appears in the PROJECT2 browser: The datasource configuration master was not found in database.php Stack Trace 1. /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/ConnectionManager.php line 94 → ConnectionManager::_getConnectionObject(string) 2. /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/Model.php line 3158 → ConnectionManager::getDataSource(string) 3. /opt/repos/PROJECT1/trunk/app/Model/AppModel.php line 87 → Model-setDataSource(string) 4. /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/Datasource/Session/DatabaseSession.php line 141 → AppModel-deleteAll(array, boolean, boolean) 5. [internal function] → DatabaseSession-gc(integer) 6. /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/Datasource/CakeSession.php line 617 → session_start() 7. /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/Datasource/CakeSession.php line 189 → CakeSession::_startSession() 8. /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/Datasource/CakeSession.php line 361 → CakeSession::start() 9. /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Controller/Component/SessionComponent.php line 70 → CakeSession::read(string) 10. /opt/repos/CakePHP/trunk/plugins/Authacl/Controller/Component/AuthaclComponent.php line 207 → SessionComponent-read(string) 11. /opt/repos/PROJECT1/trunk/app/Controller/AppController.php line 25 → AuthaclComponent-getGroupNames() 12. /opt/repos/PROJECT1/trunk/app/Controller/AppController.php line 62 → AppController-_authConfig() 13. /opt/repos/PROJECT1/trunk/app/Controller/AppController.php line 13 → AppController-_auth() 14. /opt/repos/CakePHP/trunk/plugins/Authacl/Controller/AuthaclAppController.php line 7 → AppController-beforeFilter() 15. /opt/repos/CakePHP/trunk/plugins/Authacl/Controller/UserController.php line 591 → AuthaclAppController-beforeFilter() 16. [internal function] → UserController-beforeFilter(CakeEvent) 17. /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Event/CakeEventManager.php line 246 → call_user_func(array, CakeEvent) 18. /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Controller/Controller.php line 670 → CakeEventManager-dispatch(CakeEvent) 19. /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Routing/Dispatcher.php line 184 → Controller-startupProcess() 20. /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Routing/Dispatcher.php line 162 → Dispatcher-_invoke(UserController, CakeRequest, CakeResponse) 21. ROOT/webroot/index.php line 101 → Dispatcher-dispatch(CakeRequest, CakeResponse) At lines 3, 11, 12 and 13, we can see that the AppController in PROJECT1 is called, even though this error page is appearing in PROJECT2! In this case the error is a missing datasource configuration because cake seem to expect a master configuration in PROJECT2, even though this configuration only exists in PROJECT1. A similar problem occurs if I login PROJECT2 first and PROJECT1 second. The sessions are configured as follow in app/Config/core.php for PROJECT1: Configure::write('Session', array( 'defaults' = 'database', 'cookie' = 'PROJECT1', 'timeout' = '144000', 'cookieTimeout' = '144000', 'checkAgent' = false, 'autoRegenerate' = false, 'handler' = array( 'database' = 'master', 'model' = 'Session' ) )); For PROJECT2: Configure::write('Session', array( 'defaults' = 'database', 'cookie' = 'PROJECT2', 'timeout' = 60, 'cookieTimeout' = 60, 'checkAgent' = false, 'autoRegenerate' = false, 'handler' = array( 'database' = 'default', 'model' = 'Session' ) )); How can I force the correct appController to be called? Please help. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Wrong AppController called when 2 projects are accessed simultaneously
try to change prefix to unique ... core.php // Prefix each application on the same server with a different string, to avoid Memcache and APC conflicts. $prefix = 'myapp_'; Andras Kende http://www.kende.com On Aug 21, 2013, at 12:48 AM, JD julien.duh...@gmail.com wrote: Hi, I am using CakePHP 2.2.1, and running 2 cake projects on my machine. Both projects use the same plugins, i.e. I have simlinks in the app/Plugin folders of both project that link to CakePHP/trunk/plugins/ If I access either project separately I don't have any issues but if I access both projects around the same time, the beforeFilter of the wrong AppController is called. example: 1) log into PROJECT1 2) log into PROJECT2 from different tab or browser or machine 3) The following error appears in the PROJECT2 browser: The datasource configuration master was not found in database.php Stack Trace • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/ConnectionManager.php line 94 → ConnectionManager::_getConnectionObject(string) • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/Model.php line 3158 → ConnectionManager::getDataSource(string) • /opt/repos/PROJECT1/trunk/app/Model/AppModel.php line 87 → Model-setDataSource(string) • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/Datasource/Session/DatabaseSession.php line 141 → AppModel-deleteAll(array, boolean, boolean) • [internal function] → DatabaseSession-gc(integer) • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/Datasource/CakeSession.php line 617 → session_start() • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/Datasource/CakeSession.php line 189 → CakeSession::_startSession() • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/Datasource/CakeSession.php line 361 → CakeSession::start() • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Controller/Component/SessionComponent.php line 70 → CakeSession::read(string) • /opt/repos/CakePHP/trunk/plugins/Authacl/Controller/Component/AuthaclComponent.php line 207 → SessionComponent-read(string) • /opt/repos/PROJECT1/trunk/app/Controller/AppController.php line 25 → AuthaclComponent-getGroupNames() • /opt/repos/PROJECT1/trunk/app/Controller/AppController.php line 62 → AppController-_authConfig() • /opt/repos/PROJECT1/trunk/app/Controller/AppController.php line 13 → AppController-_auth() • /opt/repos/CakePHP/trunk/plugins/Authacl/Controller/AuthaclAppController.php line 7 → AppController-beforeFilter() • /opt/repos/CakePHP/trunk/plugins/Authacl/Controller/UserController.php line 591 → AuthaclAppController-beforeFilter() • [internal function] → UserController-beforeFilter(CakeEvent) • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Event/CakeEventManager.php line 246 → call_user_func(array, CakeEvent) • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Controller/Controller.php line 670 → CakeEventManager-dispatch(CakeEvent) • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Routing/Dispatcher.php line 184 → Controller-startupProcess() • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Routing/Dispatcher.php line 162 → Dispatcher-_invoke(UserController, CakeRequest, CakeResponse) • ROOT/webroot/index.php line 101 → Dispatcher-dispatch(CakeRequest, CakeResponse) At lines 3, 11, 12 and 13, we can see that the AppController in PROJECT1 is called, even though this error page is appearing in PROJECT2! In this case the error is a missing datasource configuration because cake seem to expect a master configuration in PROJECT2, even though this configuration only exists in PROJECT1. A similar problem occurs if I login PROJECT2 first and PROJECT1 second. The sessions are configured as follow in app/Config/core.php for PROJECT1: Configure::write('Session', array( 'defaults' = 'database', 'cookie' = 'PROJECT1', 'timeout' = '144000', 'cookieTimeout' = '144000', 'checkAgent' = false, 'autoRegenerate' = false, 'handler' = array( 'database' = 'master', 'model' = 'Session' ) )); For PROJECT2: Configure::write('Session', array( 'defaults' = 'database', 'cookie' = 'PROJECT2', 'timeout' = 60, 'cookieTimeout' = 60, 'checkAgent' = false, 'autoRegenerate' = false, 'handler' = array( 'database' = 'default', 'model' = 'Session' ) )); How can I force the correct appController to be called? Please help. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group
Re: Wrong AppController called when 2 projects are accessed simultaneously
Thanks a mil Andras!! I actually had to change the prefix for _cake_core_ Cache::config('_cake_core_', array( 'engine' = $engine, //'prefix' = 'cake_core_', 'prefix' = 'project1_', 'path' = CACHE . 'persistent' . DS, 'serialize' = ($engine === 'File'), 'duration' = $duration )); but your advice put me on the right track. Have a great day. On Wednesday, August 21, 2013 10:51:07 AM UTC+2, Andras Kende wrote: try to change prefix to unique ... core.php // Prefix each application on the same server with a different string, to avoid Memcache and APC conflicts. $prefix = 'myapp_'; Andras Kende http://www.kende.com On Aug 21, 2013, at 12:48 AM, JD julien...@gmail.com javascript: wrote: Hi, I am using CakePHP 2.2.1, and running 2 cake projects on my machine. Both projects use the same plugins, i.e. I have simlinks in the app/Plugin folders of both project that link to CakePHP/trunk/plugins/ If I access either project separately I don't have any issues but if I access both projects around the same time, the beforeFilter of the wrong AppController is called. example: 1) log into PROJECT1 2) log into PROJECT2 from different tab or browser or machine 3) The following error appears in the PROJECT2 browser: The datasource configuration master was not found in database.php Stack Trace • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/ConnectionManager.php line 94 → ConnectionManager::_getConnectionObject(string) • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/Model.php line 3158 → ConnectionManager::getDataSource(string) • /opt/repos/PROJECT1/trunk/app/Model/AppModel.php line 87 → Model-setDataSource(string) • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/Datasource/Session/DatabaseSession.php line 141 → AppModel-deleteAll(array, boolean, boolean) • [internal function] → DatabaseSession-gc(integer) • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/Datasource/CakeSession.php line 617 → session_start() • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/Datasource/CakeSession.php line 189 → CakeSession::_startSession() • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Model/Datasource/CakeSession.php line 361 → CakeSession::start() • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Controller/Component/SessionComponent.php line 70 → CakeSession::read(string) • /opt/repos/CakePHP/trunk/plugins/Authacl/Controller/Component/AuthaclComponent.php line 207 → SessionComponent-read(string) • /opt/repos/PROJECT1/trunk/app/Controller/AppController.php line 25 → AuthaclComponent-getGroupNames() • /opt/repos/PROJECT1/trunk/app/Controller/AppController.php line 62 → AppController-_authConfig() • /opt/repos/PROJECT1/trunk/app/Controller/AppController.php line 13 → AppController-_auth() • /opt/repos/CakePHP/trunk/plugins/Authacl/Controller/AuthaclAppController.php line 7 → AppController-beforeFilter() • /opt/repos/CakePHP/trunk/plugins/Authacl/Controller/UserController.php line 591 → AuthaclAppController-beforeFilter() • [internal function] → UserController-beforeFilter(CakeEvent) • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Event/CakeEventManager.php line 246 → call_user_func(array, CakeEvent) • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Controller/Controller.php line 670 → CakeEventManager-dispatch(CakeEvent) • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Routing/Dispatcher.php line 184 → Controller-startupProcess() • /opt/repos/CakePHP/cakephp-2.2.1/lib/Cake/Routing/Dispatcher.php line 162 → Dispatcher-_invoke(UserController, CakeRequest, CakeResponse) • ROOT/webroot/index.php line 101 → Dispatcher-dispatch(CakeRequest, CakeResponse) At lines 3, 11, 12 and 13, we can see that the AppController in PROJECT1 is called, even though this error page is appearing in PROJECT2! In this case the error is a missing datasource configuration because cake seem to expect a master configuration in PROJECT2, even though this configuration only exists in PROJECT1. A similar problem occurs if I login PROJECT2 first and PROJECT1 second. The sessions are configured as follow in app/Config/core.php for PROJECT1: Configure::write('Session', array( 'defaults' = 'database', 'cookie' = 'PROJECT1', 'timeout' = '144000', 'cookieTimeout' = '144000', 'checkAgent' = false, 'autoRegenerate' = false, 'handler' = array( 'database' = 'master', 'model' = 'Session' ) )); For PROJECT2: Configure::write('Session', array
SaaS and AppController
I have an app I am working on and I was wondering if this is the designed behavior. As usual my controllers extend AppController I use the beforeFilter() to determine the site the request is for and setup the environment widgets,auth etc. My concern is if I put a mail() in the beforeFilter and call the app I get 9 emails for one request. So appcontroller - beforeFilter is being called 9 times. This is alot of overhead for a SaaS app. considering 4 queries are run so 36 queries total Is this the expected behavior and is there a better way to setting all the required settings etc. Thx Eric -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: SaaS and AppController
On Monday, 17 June 2013 14:53:26 UTC+2, Eric Haskins wrote: I have an app I am working on and I was wondering if this is the designed behavior. As usual my controllers extend AppController I use the beforeFilter() to determine the site the request is for and setup the environment widgets,auth etc. My concern is if I put a mail() in the beforeFilter and call the app I get 9 emails for one request. if you log $this-here, you'll almost certainly find that there are 9 emails for 9 requests (/expected/url, /expected/url/css/missing.css, /expected/url/js/missing.js, etc.); that or there are 8 requestAction calls. Cake calls the beforefilter only once per request. AD -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: SaaS and AppController
Thx AD I didnt realize the placeholders I had in the layout were the culprit Eric On Monday, June 17, 2013 9:19:31 AM UTC-4, AD7six wrote: On Monday, 17 June 2013 14:53:26 UTC+2, Eric Haskins wrote: I have an app I am working on and I was wondering if this is the designed behavior. As usual my controllers extend AppController I use the beforeFilter() to determine the site the request is for and setup the environment widgets,auth etc. My concern is if I put a mail() in the beforeFilter and call the app I get 9 emails for one request. if you log $this-here, you'll almost certainly find that there are 9 emails for 9 requests (/expected/url, /expected/url/css/missing.css, /expected/url/js/missing.js, etc.); that or there are 8 requestAction calls. Cake calls the beforefilter only once per request. AD -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: AppController Troubleshooting
Do you call beforeFilter in this controller? If so, does it in turn call parent::beforefilter()? Does the controller have its own constructor? Can you post the code? On Thu, May 16, 2013 at 3:33 PM, Larry Lutz lut...@swbell.net wrote: I'm hoping that someone can give me some troubleshooting ideas. I have a CakePHP 2.2.7 application/site with 31 controllers in addition to AppController. Thirty of those controllers correctly import (actually use) AppController so that variables set in it are available in the other controllers and so forth. One controller doesn't seem to inherit anything from AppController. Just like all the other controllers, I have this on the first line: App::uses('AppController', 'Controller'); The class declaration looks like this: class HowtosController extends AppController { For the life of me, I can't figure out why the HowtosController is failing to inherit everything from AppController, while all the other controllers do. I've looked at everything that I can think of, and nothing seems to fix it. Basically, I'm using the Cake-Menu plugin which sets a $menu variable in AppController, and the HowtosController isn't receiving that. I also display the user name (if one is logged in) using $user['username'] which results in an Undefined variable: user in all the views deriving from HowtosController. (So it's not limited to just one plugin or the Auth component. It's across the board.) Looking at the available variables in the Debug Toolkit, none of the variables that one would expect to see are in the Howtos views. Can anyone give me any suggestions on how to continue troubleshooting? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
AppController Troubleshooting
I'm hoping that someone can give me some troubleshooting ideas. I have a CakePHP 2.2.7 application/site with 31 controllers in addition to AppController. Thirty of those controllers correctly import (actually use) AppController so that variables set in it are available in the other controllers and so forth. One controller doesn't seem to inherit anything from AppController. Just like all the other controllers, I have this on the first line: App::uses('AppController', 'Controller'); The class declaration looks like this: class HowtosController extends AppController { For the life of me, I can't figure out why the HowtosController is failing to inherit everything from AppController, while all the other controllers do. I've looked at everything that I can think of, and nothing seems to fix it. Basically, I'm using the Cake-Menu plugin which sets a $menu variable in AppController, and the HowtosController isn't receiving that. I also display the user name (if one is logged in) using $user['username'] which results in an Undefined variable: user in all the views deriving from HowtosController. (So it's not limited to just one plugin or the Auth component. It's across the board.) Looking at the available variables in the Debug Toolkit, none of the variables that one would expect to see are in the Howtos views. Can anyone give me any suggestions on how to continue troubleshooting? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Class 'AppController' not found in C:\xampp\htdocs\cakephp\lib\Cake\Controller\CakeErrorController.php on line 31
-- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: How Can I use different AppController with specific route prefix!?
On Thursday, 10 January 2013 19:55:49 UTC+1, Khaled Attia wrote: Hello, I'm going to create API provider for my application, and I don't want to split the API from the main app because there is a lot of tables relations in models and components and other stuff that I want to use with the API, In same time I don't want to use the main AppController because there is a lot of things that happen with each controller (DB queries, load helpers, components, redirects, ...etc) that I don't want to use in API. I tried to create a new directory and at it to App::Build Don't do that - in short is won't work. If you don't want your ApiAppController to extend AppController - then (surprise) extend Controller and mission accomplished. If your Api code is not already in a plugin - that's of course something you should change first, so that your api code is encapsulated in a tidy folder. AD -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
How Can I use different AppController with specific route prefix!?
Hello, I'm going to create API provider for my application, and I don't want to split the API from the main app because there is a lot of tables relations in models and components and other stuff that I want to use with the API, In same time I don't want to use the main AppController because there is a lot of things that happen with each controller (DB queries, load helpers, components, redirects, ...etc) that I don't want to use in API. I tried to create a new directory and at it to App::Build but I faced a problem when there is a another controller in main controller directory with the same name. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Auth allow for shared functions in Appcontroller
Hey Cricket.. Yes I am loading auth like you said in AppController :) So, what to put where? eg: PageController $this-allowedActions = array_merge($this-allowedActions, $args); AppController ??? not 100% sure how you are doing it.. :) Thanks for your time!!! --Tom kl. 00:04:49 UTC+1 fredag 23. november 2012 skrev cricket følgende: Ignore what I said. I just thought about it for a minute and that's incorrect. Auth::allow merges the actions: $this-allowedActions = array_merge($this-allowedActions, $args); So when it runs in a given Controller the other actions are merged with whatever you allow in AppController. I just removed an action from one of mine and allow()ed it inAppController. Works just fine. What version are you running? And I assumed you initialised Auth in AppController's $components array. eg. public $components = array( 'Auth' = array( 'loginAction' = array( 'admin' = 0, 'controller' = 'users', 'action' = 'login' ), // etc. If you don't do it that way you need to initialise in beforeFilter() *before* you call Auth::allow(). On Thu, Nov 22, 2012 at 5:48 PM, lowpass zijn.d...@gmail.comjavascript: wrote: When AppController::beforeFilter() runs, it knows only about the methods in AppController. If you want to have dedicated actions for each controller then you need to specifically allow() them in each controller. Your controller action might in turn call parent::TellAFriend() which is a method in AppController, but Auth won't care about that. The only thing that matters in terms of whether you can call it is that it's not a private method. Auth only handles actions that Dispatcher dispatches to. On Thu, Nov 22, 2012 at 3:01 PM, MetZ met...@gmail.com javascript: wrote: Hi. I have a function in my AppController = TellaFriend That allows a visitor to email his friend about a spesific page on the website, eg: shared by all controllers Now, if I need to have the function available to my views using PostsController, I need to put in Auth allow TellaFriend in Postscontroller. And if I need it in PageController, I need to put in Auth allow TellaFriend in Pagecontroller also, and so on. Since this is a shared function, I was wondering, is it possible to add it to AppController, and have it available app-wide? I refer to my first post for the basic controller setup in use today (except anything Auth allow in AppController, If I put anything like the mentioned string in AppController, App does not work at all). -Tom kl. 20:33:21 UTC+1 torsdag 22. november 2012 skrev cricket følgende: He means that he wants his AppController actions Auth::allow()ed globally. I've never run into this personally; don't know if it's a bug. Are these *actions* or just global functions that your controllers call internally? The latter I've done many times. There's no need to allow them as they're not actions that Dispatcher is involved with. It can be an array or multiple strings, btw. On Thu, Nov 22, 2012 at 11:09 AM, Jeremy Burns : Class Outfit jerem...@classoutfit.com wrote: I hope I haven't misunderstood what you are trying to do... If they are shared functions just put and allow them in app controller and call them from any other controller like so: $this-myFunctionName(). On 22 Nov 2012, at 16:04, MetZ met...@gmail.com wrote: Hi. Anyone know how I can auth allow shared functions in appcontroller? Appcontroller: public function beforeFilter() { $this-Auth-allow('SharedFunction'); OtherController.php public function beforeFilter() { parent::beforeFilter(); $this-Auth-allow('ControllerSpesificFunction', 'ControllerSpesificFunction2'); If I do it like above, it kills my app, and to get the sharedfunction(s) access in all controllers, I need to manually put them in all controllers. Anyone know how I can do it? Have tried with array() and so on. same result. Thanks! -Tom -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake...@googlegroups.com. To unsubscribe from this group, send email to cake-php+u...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send
Re: Auth allow for shared functions in Appcontroller
and running cake 2.3 kl. 11:37:21 UTC+1 fredag 23. november 2012 skrev MetZ følgende: Hey Cricket.. Yes I am loading auth like you said in AppController :) So, what to put where? eg: PageController $this-allowedActions = array_merge($this-allowedActions, $args); AppController ??? not 100% sure how you are doing it.. :) Thanks for your time!!! --Tom kl. 00:04:49 UTC+1 fredag 23. november 2012 skrev cricket følgende: Ignore what I said. I just thought about it for a minute and that's incorrect. Auth::allow merges the actions: $this-allowedActions = array_merge($this-allowedActions, $args); So when it runs in a given Controller the other actions are merged with whatever you allow in AppController. I just removed an action from one of mine and allow()ed it inAppController. Works just fine. What version are you running? And I assumed you initialised Auth in AppController's $components array. eg. public $components = array( 'Auth' = array( 'loginAction' = array( 'admin' = 0, 'controller' = 'users', 'action' = 'login' ), // etc. If you don't do it that way you need to initialise in beforeFilter() *before* you call Auth::allow(). On Thu, Nov 22, 2012 at 5:48 PM, lowpass zijn.d...@gmail.com wrote: When AppController::beforeFilter() runs, it knows only about the methods in AppController. If you want to have dedicated actions for each controller then you need to specifically allow() them in each controller. Your controller action might in turn call parent::TellAFriend() which is a method in AppController, but Auth won't care about that. The only thing that matters in terms of whether you can call it is that it's not a private method. Auth only handles actions that Dispatcher dispatches to. On Thu, Nov 22, 2012 at 3:01 PM, MetZ met...@gmail.com wrote: Hi. I have a function in my AppController = TellaFriend That allows a visitor to email his friend about a spesific page on the website, eg: shared by all controllers Now, if I need to have the function available to my views using PostsController, I need to put in Auth allow TellaFriend in Postscontroller. And if I need it in PageController, I need to put in Auth allow TellaFriend in Pagecontroller also, and so on. Since this is a shared function, I was wondering, is it possible to add it to AppController, and have it available app-wide? I refer to my first post for the basic controller setup in use today (except anything Auth allow in AppController, If I put anything like the mentioned string in AppController, App does not work at all). -Tom kl. 20:33:21 UTC+1 torsdag 22. november 2012 skrev cricket følgende: He means that he wants his AppController actions Auth::allow()ed globally. I've never run into this personally; don't know if it's a bug. Are these *actions* or just global functions that your controllers call internally? The latter I've done many times. There's no need to allow them as they're not actions that Dispatcher is involved with. It can be an array or multiple strings, btw. On Thu, Nov 22, 2012 at 11:09 AM, Jeremy Burns : Class Outfit jerem...@classoutfit.com wrote: I hope I haven't misunderstood what you are trying to do... If they are shared functions just put and allow them in app controller and call them from any other controller like so: $this-myFunctionName(). On 22 Nov 2012, at 16:04, MetZ met...@gmail.com wrote: Hi. Anyone know how I can auth allow shared functions in appcontroller? Appcontroller: public function beforeFilter() { $this-Auth-allow('SharedFunction'); OtherController.php public function beforeFilter() { parent::beforeFilter(); $this-Auth-allow('ControllerSpesificFunction', 'ControllerSpesificFunction2'); If I do it like above, it kills my app, and to get the sharedfunction(s) access in all controllers, I need to manually put them in all controllers. Anyone know how I can do it? Have tried with array() and so on. same result. Thanks! -Tom -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake...@googlegroups.com. To unsubscribe from this group, send email to cake-php+u...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed
Re: Auth allow for shared functions in Appcontroller
On Fri, Nov 23, 2012 at 5:37 AM, MetZ met...@gmail.com wrote: So, what to put where? eg: PageController $this-allowedActions = array_merge($this-allowedActions, $args); No, no. This line is from AuthComponent. I just mentioned it to point out that calling allow() in AppController *and* your regular controller should work just fine. So how are you initialising Auth? In the $components array or in beforeFilter()? What you want to do is possible so you've probably either got something misconfigured somewhere or you're calling something where/when you shouldn't be. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Auth allow for shared functions in Appcontroller
Like this: *AppController* public $components = array( 'Acl', 'Auth' = array( 'loginAction' = '/', 'loginRedirect' = '/users/dashboard', 'logoutRedirect' = array('admin'=false,'controller'='pages','action'='home'), 'autoRedirect' = false, 'authorize' = array( 'Actions' = array( 'actionPath' = 'controllers' ) ), 'authError' = 'No access', ), 'Session', 'Security', 'Cookie' ); public function beforeFilter() { // unquoting this line will cause App to crash // $this-Auth-allow('TellaFriend') } *PageController* public function beforeFilter() { parent::beforeFilter(); $this-Auth-allow('home','view'); } And using cake 2.3 beta So? Doing anything wrong? -Tom kl. 20:20:52 UTC+1 fredag 23. november 2012 skrev cricket følgende: On Fri, Nov 23, 2012 at 5:37 AM, MetZ met...@gmail.com javascript: wrote: So, what to put where? eg: PageController $this-allowedActions = array_merge($this-allowedActions, $args); No, no. This line is from AuthComponent. I just mentioned it to point out that calling allow() in AppController *and* your regular controller should work just fine. So how are you initialising Auth? In the $components array or in beforeFilter()? What you want to do is possible so you've probably either got something misconfigured somewhere or you're calling something where/when you shouldn't be. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Auth allow for shared functions in Appcontroller
Hi. Anyone know how I can auth allow shared functions in appcontroller? Appcontroller: public function beforeFilter() { $this-Auth-allow('SharedFunction'); OtherController.php public function beforeFilter() { parent::beforeFilter(); $this-Auth-allow('ControllerSpesificFunction', 'ControllerSpesificFunction2'); If I do it like above, it kills my app, and to get the sharedfunction(s) access in all controllers, I need to manually put them in all controllers. Anyone know how I can do it? Have tried with array() and so on. same result. Thanks! -Tom -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Auth allow for shared functions in Appcontroller
I hope I haven't misunderstood what you are trying to do... If they are shared functions just put and allow them in app controller and call them from any other controller like so: $this-myFunctionName(). On 22 Nov 2012, at 16:04, MetZ met...@gmail.com wrote: Hi. Anyone know how I can auth allow shared functions in appcontroller? Appcontroller: public function beforeFilter() { $this-Auth-allow('SharedFunction'); OtherController.php public function beforeFilter() { parent::beforeFilter(); $this-Auth-allow('ControllerSpesificFunction', 'ControllerSpesificFunction2'); If I do it like above, it kills my app, and to get the sharedfunction(s) access in all controllers, I need to manually put them in all controllers. Anyone know how I can do it? Have tried with array() and so on. same result. Thanks! -Tom -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Auth allow for shared functions in Appcontroller
He means that he wants his AppController actions Auth::allow()ed globally. I've never run into this personally; don't know if it's a bug. Are these *actions* or just global functions that your controllers call internally? The latter I've done many times. There's no need to allow them as they're not actions that Dispatcher is involved with. It can be an array or multiple strings, btw. On Thu, Nov 22, 2012 at 11:09 AM, Jeremy Burns : Class Outfit jeremybu...@classoutfit.com wrote: I hope I haven't misunderstood what you are trying to do... If they are shared functions just put and allow them in app controller and call them from any other controller like so: $this-myFunctionName(). On 22 Nov 2012, at 16:04, MetZ met...@gmail.com wrote: Hi. Anyone know how I can auth allow shared functions in appcontroller? Appcontroller: public function beforeFilter() { $this-Auth-allow('SharedFunction'); OtherController.php public function beforeFilter() { parent::beforeFilter(); $this-Auth-allow('ControllerSpesificFunction', 'ControllerSpesificFunction2'); If I do it like above, it kills my app, and to get the sharedfunction(s) access in all controllers, I need to manually put them in all controllers. Anyone know how I can do it? Have tried with array() and so on. same result. Thanks! -Tom -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Auth allow for shared functions in Appcontroller
Hi. I have a function in my AppController = TellaFriend That allows a visitor to email his friend about a spesific page on the website, eg: shared by all controllers Now, if I need to have the function available to my views using PostsController, I need to put in Auth allow TellaFriend in Postscontroller. And if I need it in PageController, I need to put in Auth allow TellaFriend in Pagecontroller also, and so on. Since this is a shared function, I was wondering, is it possible to add it to AppController, and have it available app-wide? I refer to my first post for the basic controller setup in use today (except anything Auth allow in AppController, If I put anything like the mentioned string in AppController, App does not work at all). -Tom kl. 20:33:21 UTC+1 torsdag 22. november 2012 skrev cricket følgende: He means that he wants his AppController actions Auth::allow()ed globally. I've never run into this personally; don't know if it's a bug. Are these *actions* or just global functions that your controllers call internally? The latter I've done many times. There's no need to allow them as they're not actions that Dispatcher is involved with. It can be an array or multiple strings, btw. On Thu, Nov 22, 2012 at 11:09 AM, Jeremy Burns : Class Outfit jerem...@classoutfit.com javascript: wrote: I hope I haven't misunderstood what you are trying to do... If they are shared functions just put and allow them in app controller and call them from any other controller like so: $this-myFunctionName(). On 22 Nov 2012, at 16:04, MetZ met...@gmail.com javascript: wrote: Hi. Anyone know how I can auth allow shared functions in appcontroller? Appcontroller: public function beforeFilter() { $this-Auth-allow('SharedFunction'); OtherController.php public function beforeFilter() { parent::beforeFilter(); $this-Auth-allow('ControllerSpesificFunction', 'ControllerSpesificFunction2'); If I do it like above, it kills my app, and to get the sharedfunction(s) access in all controllers, I need to manually put them in all controllers. Anyone know how I can do it? Have tried with array() and so on. same result. Thanks! -Tom -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake...@googlegroups.comjavascript:. To unsubscribe from this group, send email to cake-php+u...@googlegroups.com javascript:. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake...@googlegroups.comjavascript:. To unsubscribe from this group, send email to cake-php+u...@googlegroups.com javascript:. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Auth allow for shared functions in Appcontroller
When AppController::beforeFilter() runs, it knows only about the methods in AppController. If you want to have dedicated actions for each controller then you need to specifically allow() them in each controller. Your controller action might in turn call parent::TellAFriend() which is a method in AppController, but Auth won't care about that. The only thing that matters in terms of whether you can call it is that it's not a private method. Auth only handles actions that Dispatcher dispatches to. On Thu, Nov 22, 2012 at 3:01 PM, MetZ met...@gmail.com wrote: Hi. I have a function in my AppController = TellaFriend That allows a visitor to email his friend about a spesific page on the website, eg: shared by all controllers Now, if I need to have the function available to my views using PostsController, I need to put in Auth allow TellaFriend in Postscontroller. And if I need it in PageController, I need to put in Auth allow TellaFriend in Pagecontroller also, and so on. Since this is a shared function, I was wondering, is it possible to add it to AppController, and have it available app-wide? I refer to my first post for the basic controller setup in use today (except anything Auth allow in AppController, If I put anything like the mentioned string in AppController, App does not work at all). -Tom kl. 20:33:21 UTC+1 torsdag 22. november 2012 skrev cricket følgende: He means that he wants his AppController actions Auth::allow()ed globally. I've never run into this personally; don't know if it's a bug. Are these *actions* or just global functions that your controllers call internally? The latter I've done many times. There's no need to allow them as they're not actions that Dispatcher is involved with. It can be an array or multiple strings, btw. On Thu, Nov 22, 2012 at 11:09 AM, Jeremy Burns : Class Outfit jerem...@classoutfit.com wrote: I hope I haven't misunderstood what you are trying to do... If they are shared functions just put and allow them in app controller and call them from any other controller like so: $this-myFunctionName(). On 22 Nov 2012, at 16:04, MetZ met...@gmail.com wrote: Hi. Anyone know how I can auth allow shared functions in appcontroller? Appcontroller: public function beforeFilter() { $this-Auth-allow('SharedFunction'); OtherController.php public function beforeFilter() { parent::beforeFilter(); $this-Auth-allow('ControllerSpesificFunction', 'ControllerSpesificFunction2'); If I do it like above, it kills my app, and to get the sharedfunction(s) access in all controllers, I need to manually put them in all controllers. Anyone know how I can do it? Have tried with array() and so on. same result. Thanks! -Tom -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake...@googlegroups.com. To unsubscribe from this group, send email to cake-php+u...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake...@googlegroups.com. To unsubscribe from this group, send email to cake-php+u...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Auth allow for shared functions in Appcontroller
Ignore what I said. I just thought about it for a minute and that's incorrect. Auth::allow merges the actions: $this-allowedActions = array_merge($this-allowedActions, $args); So when it runs in a given Controller the other actions are merged with whatever you allow in AppController. I just removed an action from one of mine and allow()ed it inAppController. Works just fine. What version are you running? And I assumed you initialised Auth in AppController's $components array. eg. public $components = array( 'Auth' = array( 'loginAction' = array( 'admin' = 0, 'controller' = 'users', 'action' = 'login' ), // etc. If you don't do it that way you need to initialise in beforeFilter() *before* you call Auth::allow(). On Thu, Nov 22, 2012 at 5:48 PM, lowpass zijn.digi...@gmail.com wrote: When AppController::beforeFilter() runs, it knows only about the methods in AppController. If you want to have dedicated actions for each controller then you need to specifically allow() them in each controller. Your controller action might in turn call parent::TellAFriend() which is a method in AppController, but Auth won't care about that. The only thing that matters in terms of whether you can call it is that it's not a private method. Auth only handles actions that Dispatcher dispatches to. On Thu, Nov 22, 2012 at 3:01 PM, MetZ met...@gmail.com wrote: Hi. I have a function in my AppController = TellaFriend That allows a visitor to email his friend about a spesific page on the website, eg: shared by all controllers Now, if I need to have the function available to my views using PostsController, I need to put in Auth allow TellaFriend in Postscontroller. And if I need it in PageController, I need to put in Auth allow TellaFriend in Pagecontroller also, and so on. Since this is a shared function, I was wondering, is it possible to add it to AppController, and have it available app-wide? I refer to my first post for the basic controller setup in use today (except anything Auth allow in AppController, If I put anything like the mentioned string in AppController, App does not work at all). -Tom kl. 20:33:21 UTC+1 torsdag 22. november 2012 skrev cricket følgende: He means that he wants his AppController actions Auth::allow()ed globally. I've never run into this personally; don't know if it's a bug. Are these *actions* or just global functions that your controllers call internally? The latter I've done many times. There's no need to allow them as they're not actions that Dispatcher is involved with. It can be an array or multiple strings, btw. On Thu, Nov 22, 2012 at 11:09 AM, Jeremy Burns : Class Outfit jerem...@classoutfit.com wrote: I hope I haven't misunderstood what you are trying to do... If they are shared functions just put and allow them in app controller and call them from any other controller like so: $this-myFunctionName(). On 22 Nov 2012, at 16:04, MetZ met...@gmail.com wrote: Hi. Anyone know how I can auth allow shared functions in appcontroller? Appcontroller: public function beforeFilter() { $this-Auth-allow('SharedFunction'); OtherController.php public function beforeFilter() { parent::beforeFilter(); $this-Auth-allow('ControllerSpesificFunction', 'ControllerSpesificFunction2'); If I do it like above, it kills my app, and to get the sharedfunction(s) access in all controllers, I need to manually put them in all controllers. Anyone know how I can do it? Have tried with array() and so on. same result. Thanks! -Tom -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake...@googlegroups.com. To unsubscribe from this group, send email to cake-php+u...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake...@googlegroups.com. To unsubscribe from this group, send email to cake-php+u...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us
Re: Passing variables between AppController and Models / Access Auth data in Models
If you're using CakePHP 2.0+, use AuthComponent::user() static method. $queryData['conditions']['customer_id'] = AuthComponent::user('customer_id'); Em segunda-feira, 5 de novembro de 2012 22h14min48s UTC-2, Nir Regev escreveu: Hi all ! I need to implement a little complex user permissions over data in tables : relations are similar to the following : - user belongs to a customer - book belongs to a customer In order to keep it DRY and fat model / slim controller, I thought I could just add something like : // Book Model $queryData['conditions']['customer_id']=$this-Auth-User['customer_id']; But, I don't get how to access Auth parameters from the models. The only way I found to pass this barrier is to send the user's customer_id via the $_SESSION which is quite .. err .. ugly :) Any suggestions on how to pass parameters to all models ? Note that I need the customer_id available for all models, not just Book .. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Passing variables between AppController and Models / Access Auth data in Models
Works perfect ! Thanks :) -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Passing variables between AppController and Models / Access Auth data in Models
Hi all ! I need to implement a little complex user permissions over data in tables : relations are similar to the following : - user belongs to a customer - book belongs to a customer In order to keep it DRY and fat model / slim controller, I thought I could just add something like : // Book Model $queryData['conditions']['customer_id']=$this-Auth-User['customer_id']; But, I don't get how to access Auth parameters from the models. The only way I found to pass this barrier is to send the user's customer_id via the $_SESSION which is quite .. err .. ugly :) Any suggestions on how to pass parameters to all models ? Note that I need the customer_id available for all models, not just Book .. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Passing arguments from element to beforeFilter in AppController
Hi, In my AppControllers beforeFilter I use a TreeHelper to generate the main menu. Now I need to pass a/some arguments to this TreeHelper from within a Views element. Does anyone know if it can be done and how to do this? Or do I need to put this TreeHelper somewhere else instead of in a beforeFilter to be able to pass arguments from within a view? The reason why I need to pass arguments from within a view (or element) is that I want to use different themes and the arguments that need to be passed are different for each theme so I need to send them from within the Views/Themed-folder. Or is it possible to put a bootstrap.php file within a theme? Thanks for any help. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Pagination Limit Default Global AppController CakePHP 2.x
Thanks. Exactly what I was looking for. On Thursday, September 20, 2012 5:26:58 PM UTC-4, cricket wrote: If you define a $paginate var in AppController, it's going to be overwritten in your other controllers. What you could do instead is put it in AppController::beforeFilter() like so: $this-paginate['limit'] = 15; Just remember to have parent::beforeFilter() in your other controllers' beforeFilter callbacks. On Tue, Sep 18, 2012 at 5:38 PM, TonyCharlotteCakePHP tonyl...@gmail.com javascript: wrote: Well it seems like cakephp's default limit for pagination is 20. For instance, if limit is not set for pagination, then cakephp will display 20 records when using pagination. I can set the limit for each individual controller with: public $paginate = array( 'limit' = 15 ); but I'm wanting to set this globally for all controllers/actions. I figured I could set limit to 15 within the AppController (using the same code above) but I still get 20 records for pagination within my other controllers/action where limit has not been set. On Thursday, September 13, 2012 4:42:53 PM UTC-4, TonyCharlotteCakePHP wrote: Is it possible to set or change the limit of pagination globally for all controllers? I've tried adding the below to the AppController: public $paginate = array( 'limit' = 15 ); Thanks -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake...@googlegroups.comjavascript:. To unsubscribe from this group, send email to cake-php+u...@googlegroups.com javascript:. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Pagination Limit Default Global AppController CakePHP 2.x
On Friday, 21 September 2012 13:01:56 UTC+2, Nikhil Agrawal wrote: Hi Directly you can change inside the pagination helper, it has been defined as 20 over there. 1) no it isn't 2) don't edit your Cake folder AD -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Pagination Limit Default Global AppController CakePHP 2.x
If you define a $paginate var in AppController, it's going to be overwritten in your other controllers. What you could do instead is put it in AppController::beforeFilter() like so: $this-paginate['limit'] = 15; Just remember to have parent::beforeFilter() in your other controllers' beforeFilter callbacks. On Tue, Sep 18, 2012 at 5:38 PM, TonyCharlotteCakePHP tonylisa...@gmail.com wrote: Well it seems like cakephp's default limit for pagination is 20. For instance, if limit is not set for pagination, then cakephp will display 20 records when using pagination. I can set the limit for each individual controller with: public $paginate = array( 'limit' = 15 ); but I'm wanting to set this globally for all controllers/actions. I figured I could set limit to 15 within the AppController (using the same code above) but I still get 20 records for pagination within my other controllers/action where limit has not been set. On Thursday, September 13, 2012 4:42:53 PM UTC-4, TonyCharlotteCakePHP wrote: Is it possible to set or change the limit of pagination globally for all controllers? I've tried adding the below to the AppController: public $paginate = array( 'limit' = 15 ); Thanks -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Pagination Limit Default Global AppController CakePHP 2.x
Well it seems like cakephp's default limit for pagination is 20. For instance, if limit is not set for pagination, then cakephp will display 20 records when using pagination. I can set the limit for each individual controller with: public $paginate = array( 'limit' = 15 ); but I'm wanting to set this globally for all controllers/actions. I figured I could set limit to 15 within the AppController (using the same code above) but I still get 20 records for pagination within my other controllers/action where limit has not been set. On Thursday, September 13, 2012 4:42:53 PM UTC-4, TonyCharlotteCakePHP wrote: Is it possible to set or change the limit of pagination globally for all controllers? I've tried adding the below to the AppController: public $paginate = array( 'limit' = 15 ); Thanks -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Unpredictable error on AppController function called in a controller
Hi there, Can someone explain me why I get from time to time this type of error: Fatal error: Call to undefined method AccountsController::checkToken() in /var/www/.../AccountsController.php on line 25 CheckToken() is defined in AppController When I get this error, I refresh one or two times and it works like a charm. How can it be random? Maybe useful to answer my question. I have another kind of random errors (once every 500 requests): Fatal error: Class 'ModelValidator' not found in /var/www/.../ANOTHER_APP/lib/Cake/Model/Model.php on line 3396 The strange thing is that cake looks in the wrong folder. Actually one from another cake app running on the same server. Can all this be linked? Many thanks for your help! -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Pagination Limit Default Global AppController CakePHP 2.x
Is it possible to set or change the limit of pagination globally for all controllers? I've tried adding the below to the AppController: public $paginate = array( 'limit' = 15 ); Thanks -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: Pagination Limit Default Global AppController CakePHP 2.x
and ? it's not working ? -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/9/13 TonyCharlotteCakePHP tonylisa...@gmail.com Is it possible to set or change the limit of pagination globally for all controllers? I've tried adding the below to the AppController: public $paginate = array( 'limit' = 15 ); Thanks -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US. -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
AppController::beforeRender() fails to fire when rendering an error page
Hey folks, strange problem here with Cake 2.2.1 When I have an error or exception, whether in debug mode 0 or 1, it successfully renders my default layout, but a bunch of variables have not been set in the view, because the chain of method execution never calls my AppController::beforeRender(). I thought the default error handling behavior was supposed to fire this to prevent this problem of view vars not being set. I tried to overwrite some error rendering (similar to discussion in this posthttp://stackoverflow.com/questions/9041289/cakephp-2-0-beforefilter-not-run-on-cakeerrorcontroller, the solution of which simply does not work for me) by creating CakeErrorController.php and returning parent::beforeRender() but this, strangely, creates an infinite loop. I cannot figure this one out! Help! -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: AppController::beforeRender() fails to fire when rendering an error page
AFAIK, only your application controllers extend AppController, not the error controller. So yeah, they will not trigger the AppController callbacks. Em 25/08/2012 22:15, amfriedman amfried...@gmail.com escreveu: Hey folks, strange problem here with Cake 2.2.1 When I have an error or exception, whether in debug mode 0 or 1, it successfully renders my default layout, but a bunch of variables have not been set in the view, because the chain of method execution never calls my AppController::beforeRender(). I thought the default error handling behavior was supposed to fire this to prevent this problem of view vars not being set. I tried to overwrite some error rendering (similar to discussion in this posthttp://stackoverflow.com/questions/9041289/cakephp-2-0-beforefilter-not-run-on-cakeerrorcontroller, the solution of which simply does not work for me) by creating CakeErrorController.php and returning parent::beforeRender() but this, strangely, creates an infinite loop. I cannot figure this one out! Help! -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US. -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: AuthComponent, set userScope in appController
Thaks. Solved Em terça-feira, 3 de julho de 2012 18h32min58s UTC-3, cricket escreveu: On Tue, Jul 3, 2012 at 8:31 AM, Lucas Simon Rodrigues Magalhaes lucass...@gmail.com wrote: The error appear in this line: 'scope' = array('User.status' = Configure::read('User.ACTIVE')), And on that line you are declaring a class member. You cannot use Configure::read() there. http://www.php.net/manual/en/language.oop5.properties.php This declaration may include an initialization, but this initialization must be a constant value--that is, it must be able to be evaluated at compile time and must not depend on run-time information in order to be evaluated. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: AuthComponent, set userScope in appController
The error appear in this line: 'scope' = array('User.status' = Configure::read('User.ACTIVE')), Em segunda-feira, 2 de julho de 2012 18h50min00s UTC-3, MaJerle.Eu escreveu: because this is php error you can not use methods/functions when declaring properties in class use this in AppController: public function beforeFilter() { parent::beforeFilter(); $this-Auth-userScope = Configure::read('User.ACTIVE'); } -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/7/2 Lucas Simon Rodrigues Magalhaes lucass...@gmail.com Hello, I have a little problem in my auth component in cakePHP 2.2. I set in my bootstrap.php [1] many CONSTANTS, example,Configure::write('User.ACTIVE', 'A'); and I wanna to use this constant in my auth component, but when I used Configure::read('User.ACTIVE'), the cakePHP show-me an error: Error: syntax error, unexpected '(', expecting ',' or ';' File: E:\wamp\www\Projetos\cakephp-startup2.2\app\Controller\AppController.php Line: 36 How to read this variable? [1] https://gist.github.com/3035900 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: AuthComponent, set userScope in appController
On Tue, Jul 3, 2012 at 8:31 AM, Lucas Simon Rodrigues Magalhaes lucass...@gmail.com wrote: The error appear in this line: 'scope' = array('User.status' = Configure::read('User.ACTIVE')), And on that line you are declaring a class member. You cannot use Configure::read() there. http://www.php.net/manual/en/language.oop5.properties.php This declaration may include an initialization, but this initialization must be a constant value--that is, it must be able to be evaluated at compile time and must not depend on run-time information in order to be evaluated. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
AuthComponent, set userScope in appController
Hello, I have a little problem in my auth component in cakePHP 2.2. I set in my bootstrap.php [1] many CONSTANTS, example,Configure::write('User.ACTIVE', 'A'); and I wanna to use this constant in my auth component, but when I used Configure::read('User.ACTIVE'), the cakePHP show-me an error: Error: syntax error, unexpected '(', expecting ',' or ';' File: E:\wamp\www\Projetos\cakephp-startup2.2\app\Controller\AppController.php Line: 36 How to read this variable? [1] https://gist.github.com/3035900 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: AuthComponent, set userScope in appController
because this is php error you can not use methods/functions when declaring properties in class use this in AppController: public function beforeFilter() { parent::beforeFilter(); $this-Auth-userScope = Configure::read('User.ACTIVE'); } -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/7/2 Lucas Simon Rodrigues Magalhaes lucass...@gmail.com Hello, I have a little problem in my auth component in cakePHP 2.2. I set in my bootstrap.php [1] many CONSTANTS, example,Configure::write('User.ACTIVE', 'A'); and I wanna to use this constant in my auth component, but when I used Configure::read('User.ACTIVE'), the cakePHP show-me an error: Error: syntax error, unexpected '(', expecting ',' or ';' File: E:\wamp\www\Projetos\cakephp-startup2.2\app\Controller\AppController.php Line: 36 How to read this variable? [1] https://gist.github.com/3035900 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How do I send emails from AppController? (CakePHP 2.0)
Hello All, how to delete Multiple tables fields values in cakephp 2.0 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How do I send emails from AppController? (CakePHP 2.0)
Thanks, I got it working! Sharon On Saturday, 19 May 2012 04:02:10 UTC+1, GB wrote: Recently I had similar problem. In one of my apps, this works: $email = new CakeEmail('smtp'); In a second I had to separate out config setting: $email = new CakeEmail(); $email-config('smtp'); Don't ask me why the need for 2 as once it was working I moved on. George On Friday, May 18, 2012 7:08:51 AM UTC-4, WhyNotSmile wrote: I've been sending emails from my PagesController, and that has been working fine, but now I need to send from AppController instead, and I can't get the emails to send. As far as I can see, I have exactly the same code in both, but the AppController function simply doesn't send the email. There are no error messages or anything - I just don't get an email. I wondered if maybe it can't find the view file or something like that? Can anyone advise me? Here is my code (in AppController): function sendSystemEmail($to = EMAIL_CONTACT, $from = array(EMAIL_FROM = SITE_NAME), $subject = null, $body = null, $view = null, $vars = null) { App::uses('CakeEmail', 'Network/Email'); $email = new CakeEmail(); $email-viewVars(array( 'body' = $body, 'vars' = $vars )); $email-template($view) -emailFormat('html') -from(EMAIL_FROM) -to($to) -subject($subject) -send(); return; } Thanks for any help you can give! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
How do I send emails from AppController? (CakePHP 2.0)
I've been sending emails from my PagesController, and that has been working fine, but now I need to send from AppController instead, and I can't get the emails to send. As far as I can see, I have exactly the same code in both, but the AppController function simply doesn't send the email. There are no error messages or anything - I just don't get an email. I wondered if maybe it can't find the view file or something like that? Can anyone advise me? Here is my code (in AppController): function sendSystemEmail($to = EMAIL_CONTACT, $from = array(EMAIL_FROM = SITE_NAME), $subject = null, $body = null, $view = null, $vars = null) { App::uses('CakeEmail', 'Network/Email'); $email = new CakeEmail(); $email-viewVars(array( 'body' = $body, 'vars' = $vars )); $email-template($view) -emailFormat('html') -from(EMAIL_FROM) -to($to) -subject($subject) -send(); return; } Thanks for any help you can give! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How do I send emails from AppController? (CakePHP 2.0)
Recently I had similar problem. In one of my apps, this works: $email = new CakeEmail('smtp'); In a second I had to separate out config setting: $email = new CakeEmail(); $email-config('smtp'); Don't ask me why the need for 2 as once it was working I moved on. George On Friday, May 18, 2012 7:08:51 AM UTC-4, WhyNotSmile wrote: I've been sending emails from my PagesController, and that has been working fine, but now I need to send from AppController instead, and I can't get the emails to send. As far as I can see, I have exactly the same code in both, but the AppController function simply doesn't send the email. There are no error messages or anything - I just don't get an email. I wondered if maybe it can't find the view file or something like that? Can anyone advise me? Here is my code (in AppController): function sendSystemEmail($to = EMAIL_CONTACT, $from = array(EMAIL_FROM = SITE_NAME), $subject = null, $body = null, $view = null, $vars = null) { App::uses('CakeEmail', 'Network/Email'); $email = new CakeEmail(); $email-viewVars(array( 'body' = $body, 'vars' = $vars )); $email-template($view) -emailFormat('html') -from(EMAIL_FROM) -to($to) -subject($subject) -send(); return; } Thanks for any help you can give! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Apache mod_rewrite and AppController issues
I am having two problems, but they could be related. I am just setting up cakephp 2.0 on a hostmonster isp account. The helpful config page that cake defaults to shows everything is OK except Apache mod_rewrite's 'pretty URLs' that are set up in .htaccess. The site happily accepts them as input, i.e. www.aerogamers.com/controller/action, but when it redirects, they come out like www.aerogamers.com/cake_install/controller/action. Problem two is that cake doesn't seem to acknowledge my AppController in app/Controllers/. For instance, my UsersController just can't seem to inherit from it. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Loading of plugins in AppController::beforeFilter
Argh, damn xD The good old ClassRegistry, totally forgotten, thanks for the hint! -- Christian On Jan 5, 11:16 pm, majna majna...@gmail.com wrote: You can load plugins form db in bootstrap.php too: $pluginHooks = ClasRegistry::init('PluginHook')-find('all'); foreach ( $pluginHooks as $pluginHook ) ... and then Configure::write('plugins', $plugins) for your hooks to be available in views as Configure::read('plugins'); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Loading of plugins in AppController::beforeFilter
Hi :) why is it not possible to load cake plugins outside of bootstrap.php? I want to implement a plugin management where all installed plugins saved in database with some configurations of the plugins, e.g. has a bootstrap or a routes file. Now I want to load the plugins in AppController::beforeFilter: = 8 = public function beforeFilter() { parent::beforeFilter(); $this-loadModel( 'PluginHook' ); $pluginHooks = $this-PluginHook-find( 'all' ); $plugins = array( ); foreach ( $pluginHooks as $pluginHook ) { $plugins[ $pluginHook[ 'PluginHook' ][ 'hook_id' ] ] = $pluginHook[ 'Plugin' ]; foreach ( $pluginHook[ 'Plugin' ] as $plugin ) { CakePlugin::load( $plugin[ 'name' ], array( 'bootstrap' = ( $plugin[ 'has_bootstrap' ] == 1 ), 'routes' = ( $plugin[ 'has_routes' ] == 1 ) ) ); } } $this-set( compact( 'plugins' ) ); } = 8 = Until this point there is no error message or anything! And now I want to run the plugin in my views: = 8 = if ( isset( $plugins ) isset( $plugins[ $hookId ] ) ! empty( $plugins[ $hookId ] ) ) : foreach ( $plugins[ $hookId ] as $plugin ) : $url = array( 'plugin' = strtolower( $plugin[ 'name' ] ), 'controller' = strtolower( $plugin[ 'start_controller' ] ) ); if ( !empty( $plugin[ 'start_action' ] ) ) : $url[ 'action' ] = $plugin[ 'start_action' ]; endif; echo $this-requestAction( $url, array( 'return' ) ); endforeach; endif; = 8 = There is nothing to see in the view but in the error.log I get this: = 8 = 2012-01-05 17:13:15 Error: [MissingControllerException] Controller class SampleController could not be found. #0 D:\xampp\htdocs\bc\cake-2.0\Cake\Core\Object.php(102): Dispatcher- dispatch(Object(CakeRequest), Object(CakeResponse), Array) #1 D:\xampp\htdocs\bc\apps\sandbox\View\Elements\plugin_hook.ctp(12): Object-requestAction(Array, Array) #2 D:\xampp\htdocs\bc\cake-2.0\Cake\View\View.php(598): include('D: \xampp\htdocs...') #3 D:\xampp\htdocs\bc\cake-2.0\Cake\View\View.php(320): View- _render('D:\xampp\htdocs...', Array) #4 D:\xampp\htdocs\bc\apps\sandbox\View\Layouts\default.ctp(68): View- element('plugin_hook', Array) #5 D:\xampp\htdocs\bc\cake-2.0\Cake\View\View.php(598): include('D: \xampp\htdocs...') #6 D:\xampp\htdocs\bc\cake-2.0\Cake\View\View.php(414): View- _render('D:\xampp\htdocs...') #7 D:\xampp\htdocs\bc\cake-2.0\Cake\View\View.php(376): View- renderLayout('h2Home/h2??...', 'default') #8 D:\xampp\htdocs\bc\cake-2.0\Cake\Controller\Controller.php(900): View-render('home', NULL) #9 D:\xampp\htdocs\bc\apps\sandbox\Controller\PagesController.php(28): Controller-render('home') #10 [internal function]: PagesController-display('home') #11 D:\xampp\htdocs\bc\cake-2.0\Cake\Controller\Controller.php(473): ReflectionMethod-invokeArgs(Object(PagesController), Array) #12 D:\xampp\htdocs\bc\cake-2.0\Cake\Routing\Dispatcher.php(107): Controller-invokeAction(Object(CakeRequest)) #13 D:\xampp\htdocs\bc\cake-2.0\Cake\Routing\Dispatcher.php(89): Dispatcher-_invoke(Object(PagesController), Object(CakeRequest), Object(CakeResponse)) #14 D:\xampp\htdocs\bc\apps\sandbox\webroot\index.php(97): Dispatcher- dispatch(Object(CakeRequest), Object(CakeResponse)) #15 {main} = 8 = It seems the plugin was not loaded ... For the sake of completenes, I'm using Cake 2.0.4, the plugin is called 'Sample' and when I just put the CakePlugin::load portion in the bootstrap.php all is working fine and as expected: = 8 = CakePlugin::load( array( 'Sample' = array( 'bootstrap' = true, 'routes' = true ) ) ); = 8 = I hope someone can help me or can explain why its not possible to load plugins another way than bootstrap.php? Best wishes for the new year! ;) -- Christian -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Loading of plugins in AppController::beforeFilter
You can load plugins form db in bootstrap.php too: $pluginHooks = ClasRegistry::init('PluginHook')-find('all'); foreach ( $pluginHooks as $pluginHook ) ... and then Configure::write('plugins', $plugins) for your hooks to be available in views as Configure::read('plugins'); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: AppController not loading ?
You do not need App::uses('Controller', 'Controller'); but it's not wrong to declare it! furthermore, it is even wise to do that because if you test your application (via phpunit) and create a single unit test for the app controller or probably any other controller you would otherwise run into a fatal error (if you don't manually include it in all tests) On 26 Dez., 21:34, thatsgreat2345 thatsgreat2...@gmail.com wrote: You do not need App::uses('Controller', 'Controller'); If you're using CakePHP 2.0 then you will need to place AppController.php into your Controllers folder in your app. It will be automatically loaded, and extended. On Dec 26, 11:34 am, Timothy O'Reilly timothy.john.orei...@gmail.com wrote: David, I am new to Cake PHP, so take that into account. https://gist.github.com/1521980 This is working for me (so far). Regards, Tim On Sat, Dec 24, 2011 at 1:40 PM, David Brisebois david.briseb...@gmail.comwrote: Hi guys I've been working with CakePHP 1.2/1.3 in the past, but first time with 2.0.4 I just started a project, now trying to load Auth component from AppController, turns out it doesn't seem to load ! I put the AppController.php in /app/Controller, I put only a die() but nothing happens !! I have the App:uses('AppController','Controller'); on top of my AccountsController but still nothing. But a die() in /lib/Controller/ AppController.php does work ! What am I missing ? Not a filename typo, I changed it 3 times... Thanks in advance and good holidays to everybody ;) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php -- | cellphone: +18579280348 | | 123 10th Street | San Francisco | CA 94103 | | web:www.zign.me|skype: timothy.o.reilly | twitter: @timothyjoreilly | -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: AppController not loading ?
David, I am new to Cake PHP, so take that into account. https://gist.github.com/1521980 This is working for me (so far). Regards, Tim On Sat, Dec 24, 2011 at 1:40 PM, David Brisebois david.briseb...@gmail.comwrote: Hi guys I've been working with CakePHP 1.2/1.3 in the past, but first time with 2.0.4 I just started a project, now trying to load Auth component from AppController, turns out it doesn't seem to load ! I put the AppController.php in /app/Controller, I put only a die() but nothing happens !! I have the App:uses('AppController','Controller'); on top of my AccountsController but still nothing. But a die() in /lib/Controller/ AppController.php does work ! What am I missing ? Not a filename typo, I changed it 3 times... Thanks in advance and good holidays to everybody ;) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- | cellphone: +18579280348 | | 123 10th Street | San Francisco | CA 94103 | | web: www.zign.me | skype: timothy.o.reilly | twitter: @timothyjoreilly | -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: AppController not loading ?
You do not need App::uses('Controller', 'Controller'); If you're using CakePHP 2.0 then you will need to place AppController.php into your Controllers folder in your app. It will be automatically loaded, and extended. On Dec 26, 11:34 am, Timothy O'Reilly timothy.john.orei...@gmail.com wrote: David, I am new to Cake PHP, so take that into account. https://gist.github.com/1521980 This is working for me (so far). Regards, Tim On Sat, Dec 24, 2011 at 1:40 PM, David Brisebois david.briseb...@gmail.comwrote: Hi guys I've been working with CakePHP 1.2/1.3 in the past, but first time with 2.0.4 I just started a project, now trying to load Auth component from AppController, turns out it doesn't seem to load ! I put the AppController.php in /app/Controller, I put only a die() but nothing happens !! I have the App:uses('AppController','Controller'); on top of my AccountsController but still nothing. But a die() in /lib/Controller/ AppController.php does work ! What am I missing ? Not a filename typo, I changed it 3 times... Thanks in advance and good holidays to everybody ;) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php -- | cellphone: +18579280348 | | 123 10th Street | San Francisco | CA 94103 | | web:www.zign.me| skype: timothy.o.reilly | twitter: @timothyjoreilly | -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
AppController not loading ?
Hi guys I've been working with CakePHP 1.2/1.3 in the past, but first time with 2.0.4 I just started a project, now trying to load Auth component from AppController, turns out it doesn't seem to load ! I put the AppController.php in /app/Controller, I put only a die() but nothing happens !! I have the App:uses('AppController','Controller'); on top of my AccountsController but still nothing. But a die() in /lib/Controller/ AppController.php does work ! What am I missing ? Not a filename typo, I changed it 3 times... Thanks in advance and good holidays to everybody ;) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
AppController loading issue
I have an AppController.php located on /app/Controller and somehow the inherited controllers are not loading it. Instead, it loads the one defined on /lib/Cake/Controller. That's how I am testing: - Create a new controller such as: ?php App::uses('AppController', 'Controller'); class ReviewsController extends AppController { - Create /app/Controller/AppController.php with: echo 'App'; and /lib/Cake/Controller/AppController.php with: echo 'Lib'; Whenever I fire up the reviews controller, I only see the Lib message. Any ideas? I was able to accomplish that just fine in older versions (1.x) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: AppController loading issue
try toggling the debug = 2 in core.php, it helps sometimes… Andras Kende On Nov 28, 2011, at 12:40 PM, Weydson wrote: I have an AppController.php located on /app/Controller and somehow the inherited controllers are not loading it. Instead, it loads the one defined on /lib/Cake/Controller. That's how I am testing: - Create a new controller such as: ?php App::uses('AppController', 'Controller'); class ReviewsController extends AppController { - Create /app/Controller/AppController.php with: echo 'App'; and /lib/Cake/Controller/AppController.php with: echo 'Lib'; Whenever I fire up the reviews controller, I only see the Lib message. Any ideas? I was able to accomplish that just fine in older versions (1.x) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: inputDefaults in AppController
Great! Thank you, that solves my problem! On 27 Nov., 05:09, Graham Weldon predomin...@gmail.com wrote: When I want to customise the behaviour of the FormHelper, I create a new subclass of FormHelper, and overload the methods I want. For example, I wanted a FormHelper and HtmlHelper for creating Twitter Bootstrap style output, without changing the default generated views. So I created this:http://bin.cakephp.org/view/1590356227 Cheers, Graham Weldonhttp://grahamweldon.com e. gra...@grahamweldon.com p. (+61) 0407 017 293 Skype: grahamweldon On Sunday, 27 November 2011 at 4:18 AM, Tilen Majerle wrote: inputDefaults works for each created form separately only and +1 for ur post :) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/11/26 cronet cro...@gmx.de (mailto:cro...@gmx.de) Hello, could I set Form inputDefaults in AppController, when loading the Helper? something like this: ?php class AppController extends Controller { public $helpers = array('Html', 'Form'=array('inputDefaults'= array('div'=array('class'='form-field'), 'error' = array('attributes' = array('wrap' = 'small')) ) )); ? The Code above isn't working, but i think you get what i thought of regards, cronet -- Our newest site for the community: CakePHP Video Tutorialshttp://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com (mailto:cake-php%2bunsubscr...@googlegroups.com) For more options, visit this group athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorialshttp://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com (mailto:cake-php+unsubscr...@googlegroups.com) For more options, visit this group athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
inputDefaults in AppController
Hello, could I set Form inputDefaults in AppController, when loading the Helper? something like this: ?php class AppController extends Controller { public $helpers = array('Html', 'Form'=array('inputDefaults'= array('div'=array('class'='form-field'), 'error' = array('attributes' = array('wrap' = 'small')) ) )); ? The Code above isn't working, but i think you get what i thought of regards, cronet -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: inputDefaults in AppController
inputDefaults works for each created form separately only and +1 for ur post :) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/11/26 cronet cro...@gmx.de Hello, could I set Form inputDefaults in AppController, when loading the Helper? something like this: ?php class AppController extends Controller { public $helpers = array('Html', 'Form'=array('inputDefaults'= array('div'=array('class'='form-field'), 'error' = array('attributes' = array('wrap' = 'small')) ) )); ? The Code above isn't working, but i think you get what i thought of regards, cronet -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: inputDefaults in AppController
When I want to customise the behaviour of the FormHelper, I create a new subclass of FormHelper, and overload the methods I want. For example, I wanted a FormHelper and HtmlHelper for creating Twitter Bootstrap style output, without changing the default generated views. So I created this: http://bin.cakephp.org/view/1590356227 Cheers, Graham Weldon http://grahamweldon.com e. gra...@grahamweldon.com p. (+61) 0407 017 293 Skype: grahamweldon On Sunday, 27 November 2011 at 4:18 AM, Tilen Majerle wrote: inputDefaults works for each created form separately only and +1 for ur post :) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/11/26 cronet cro...@gmx.de (mailto:cro...@gmx.de) Hello, could I set Form inputDefaults in AppController, when loading the Helper? something like this: ?php class AppController extends Controller { public $helpers = array('Html', 'Form'=array('inputDefaults'= array('div'=array('class'='form-field'), 'error' = array('attributes' = array('wrap' = 'small')) ) )); ? The Code above isn't working, but i think you get what i thought of regards, cronet -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com (mailto:cake-php%2bunsubscr...@googlegroups.com) For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com (mailto:cake-php+unsubscr...@googlegroups.com) For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakePHP 2.0 beta - AppController issue
Make sure your components extend Component and not Object. On Wed, Aug 24, 2011 at 6:48 AM, Ben McClure ben.mccl...@gmail.com wrote: Hmm... actually I guess it is called but I have some sort of problem with one of my components that was preventing AppController from being used apparently (although no errors were output). I will try disabling my custom components and troubleshooting them one by one to see which one's doing it. Ben -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Component causing AppController to fail in 2.0 beta
Turn on debug, it should,have shown an error message about the plugin not being loaded -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakePHP 2.0 beta - AppController issue
That was the first thing I changed--the problem turned out to be that I wasn't enabling the module in bootstrap.php. Whoops! Thanks, Ben -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Component causing AppController to fail in 2.0 beta
Debug was already set to the highest level listed (2). I get errors for everything else, but apparently in CakePHP 2.0 Beta, there is some strange behavior if you don't enable a plugin but try to use it: 1. Component added to AppController for a non-enabled plugin made the entire AppController not run, but did not display any error messages. It simply acted as if I did not have a custom AppController defined. 2. Helper added to AppController for a non-enabled plugin was less catastrophic--it simply didn't work until I enabled the plugin. I find it odd that if you try to use a model from a disabled plugin, you get a nice exception in CakePHP, but if you try to use a component or helper from a disabled plugin, it silently fails. Ben -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
CakePHP 2.0 beta - AppController issue
I'm having a hard time getting CakePHP 2.0 to use my AppController. It's located in app/Controller/AppController.php It defines components and helpers (which do not actually get defined) and has a beforeFilter with a die() statement which never gets called. Is that not the right place for CakePHP 2.0? I was following the documents available in github. Thanks all! Ben -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakePHP 2.0 beta - AppController issue
Hmm... actually I guess it is called but I have some sort of problem with one of my components that was preventing AppController from being used apparently (although no errors were output). I will try disabling my custom components and troubleshooting them one by one to see which one's doing it. Ben -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Component causing AppController to fail in 2.0 beta
I have a simple (and likely poorly written, sorry) component that I was using in CakePHP 1.3 which I wanted to use in my new 2.0 beta app called AssetGathererComponent. It is inside a plugin called 'AutoAsset'. The file is now located at app/Plugin/AutoAsset/Controller/Component/AssetGathererComponent.php I updated the constructor per the core components for how it should look in 2.0. I also made sure it extends Component Here is my current code: https://gist.github.com/1167325 I am including it in my AppController's $components array like this: 'AutoAsset.AssetGatherer' = array( 'mainJs' = 'app', 'requireJs' = array('libs/modernizr-1.7-custom.min', 'libs/selectivizr'), ), Whenever I include it in my AppController, the entire AppController goes unused in my application. When I take it back out, the AppController works fine. What have I done wrong? Thanks! Ben -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Component causing AppController to fail in 2.0 beta
Ok, getting closer. First, I made a minor typo above, 'requireJs' should have been 'requiredJs', but that doesn't really matter for this issue. It turned out I just needed to open up Config/bootstrap.php to realize I need to manually enable my plugins in CakePHP 2.0. Face ... meet palm. Ben -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Setting variables in AppController to use in Layout.
well, beforeFilter() is not always triggered why not putting everything in beforeRender() would make more sense to me by the way: for some data you can always use Configure::write() and Configure::load() might make sense if you want to use it in different locations On 10 Jul., 10:00, runckel robhueb...@web.de wrote: Hi, i dont see anything wrong there, so i would first write a $this- log($login_url) in the app controllers beforeRender to be sure it will be called and the $login_url is filled. One reason it will not be called could be a beforeRender in the calling Controller whitch doesnt call his Parent. On 8 Jul., 22:25, Angad Nadkarni angad.nadka...@gmail.com wrote: I am setting variables in AppController in order to use them in default.ctp. This is my code: function beforeRender ( ) { @Controller::loadModel('User'); $login_url = [trimmed]; $this-set('loginurl', $login_url); $this-set('user', $this-Cookie-read('User')); $this-set('examdata', $this-User-query('select listing from exams limit 0,1')); $this-set('exam', $this-Cookie-read('exam')); } The logic for above code has been performed in beforeFilter(). Now when I use the variables in default.ctp, such as say $loginurl, or $examdata, I get: Undefined variable: loginurl or Undefined variable: examdata What am I doing wrong? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Setting variables in AppController to use in Layout.
I figured out out guys. The reason was there were some syntax errors in other parts of the code (in my case, a ClassnameComponent was named as ClassnameHelper), due to which this part of the code wasn't getting executed. Also, I shifted all the 'set's to beforeRender(). I was using a few of these varnames in other views as well, so they ended up getting overwritten. I later fixed this by renaming the view-copy of these variables differently. Thanks for your time! On Jul 10, 2:31 pm, euromark dereurom...@googlemail.com wrote: well, beforeFilter() is not always triggered why not putting everything in beforeRender() would make more sense to me by the way: for some data you can always use Configure::write() and Configure::load() might make sense if you want to use it in different locations On 10 Jul., 10:00, runckel robhueb...@web.de wrote: Hi, i dont see anything wrong there, so i would first write a $this- log($login_url) in the app controllers beforeRender to be sure it will be called and the $login_url is filled. One reason it will not be called could be a beforeRender in the calling Controller whitch doesnt call his Parent. On 8 Jul., 22:25, Angad Nadkarni angad.nadka...@gmail.com wrote: I am setting variables in AppController in order to use them in default.ctp. This is my code: function beforeRender ( ) { @Controller::loadModel('User'); $login_url = [trimmed]; $this-set('loginurl', $login_url); $this-set('user', $this-Cookie-read('User')); $this-set('examdata', $this-User-query('select listing from exams limit 0,1')); $this-set('exam', $this-Cookie-read('exam')); } The logic for above code has been performed in beforeFilter(). Now when I use the variables in default.ctp, such as say $loginurl, or $examdata, I get: Undefined variable: loginurl or Undefined variable: examdata What am I doing wrong?- Hide quoted text - - Show quoted text - -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Setting variables in AppController to use in Layout.
I am setting variables in AppController in order to use them in default.ctp. This is my code: function beforeRender ( ) { @Controller::loadModel('User'); $login_url = [trimmed]; $this-set('loginurl', $login_url); $this-set('user', $this-Cookie-read('User')); $this-set('examdata', $this-User-query('select listing from exams limit 0,1')); $this-set('exam', $this-Cookie-read('exam')); } The logic for above code has been performed in beforeFilter(). Now when I use the variables in default.ctp, such as say $loginurl, or $examdata, I get: Undefined variable: loginurl or Undefined variable: examdata What am I doing wrong? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Where should I insert this before filter? AppController or AppModel?
I have this code, I need (for every page) to read a session, if doesn't exist read from a model and then write the session, something like: == function beforeFilter() { // read session variable $id = $this-Session-read('editable_season_id'); // id doesn't exist if((is_null($id)) || (!is_numeric($id))) { // find it $id = $this-MyModel-getLastSeasonId(); $this-Session-write(editable_season_id, $id); } } == If I put it inside appController I can't use $this-MyModel, but if I put it inside appModel I can't use $this-Session. So where I should insert that code??? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Where should I insert this before filter? AppController or AppModel?
On Thu, Mar 24, 2011 at 4:11 PM, Mariano C. mariano.calan...@gmail.com wrote: I have this code, I need (for every page) to read a session, if doesn't exist read from a model and then write the session, something like: == function beforeFilter() { // read session variable $id = $this-Session-read('editable_season_id'); // id doesn't exist if((is_null($id)) || (!is_numeric($id))) { // find it $id = $this-MyModel-getLastSeasonId(); $this-Session-write(editable_season_id, $id); } } == If I put it inside appController I can't use $this-MyModel, but if I put it inside appModel I can't use $this-Session. So where I should insert that code??? There's no beforeFilter() in AppModel. That's for client requests. So, AppController. To get the model, use App::import('model', 'MyModel'). -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Where should I insert this before filter? AppController or AppModel?
class AppController extends Controller { var $components = array('DebugKit.Toolbar', 'Session'); function beforeFilter() { // ricava la variabile di sessione $id = $this-Session-read('editable_season_id'); // se non esiste o è un valore non valido if((is_null($id)) || (!is_numeric($id))) { // importa modello Season App::import('Model', 'Season'); // cerca l'id della stagione più recente $id = $this-Season-getLastSeasonId(); gave me: Undefined property: PagesController::$Season [CORE\cake\libs\controller \app_controller.php, line 50] Fatal error: Call to a member function getLastSeasonId() on a non- object in C:\wamp\www\cakephp\cake\libs\controller\app_controller.php on line 50 Line 50 is: $id = $this-Season-getLastSeasonId(); Why? On 24 Mar, 22:23, cricket zijn.digi...@gmail.com wrote: On Thu, Mar 24, 2011 at 4:11 PM, Mariano C. mariano.calan...@gmail.com wrote: I have this code, I need (for every page) to read a session, if doesn't exist read from a model and then write the session, something like: == function beforeFilter() { // read session variable $id = $this-Session-read('editable_season_id'); // id doesn't exist if((is_null($id)) || (!is_numeric($id))) { // find it $id = $this-MyModel-getLastSeasonId(); $this-Session-write(editable_season_id, $id); } } == If I put it inside appController I can't use $this-MyModel, but if I put it inside appModel I can't use $this-Session. So where I should insert that code??? There's no beforeFilter() in AppModel. That's for client requests. So, AppController. To get the model, use App::import('model', 'MyModel'). -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Where should I insert this before filter? AppController or AppModel?
because you just importet the class.. use $this-Season = ClassRegistry::init('Season') or loadModel('Season') On 24 Mrz., 23:41, Mariano C. mariano.calan...@gmail.com wrote: class AppController extends Controller { var $components = array('DebugKit.Toolbar', 'Session'); function beforeFilter() { // ricava la variabile di sessione $id = $this-Session-read('editable_season_id'); // se non esiste o è un valore non valido if((is_null($id)) || (!is_numeric($id))) { // importa modello Season App::import('Model', 'Season'); // cerca l'id della stagione più recente $id = $this-Season-getLastSeasonId(); gave me: Undefined property: PagesController::$Season [CORE\cake\libs\controller \app_controller.php, line 50] Fatal error: Call to a member function getLastSeasonId() on a non- object in C:\wamp\www\cakephp\cake\libs\controller\app_controller.php on line 50 Line 50 is: $id = $this-Season-getLastSeasonId(); Why? On 24 Mar, 22:23, cricket zijn.digi...@gmail.com wrote: On Thu, Mar 24, 2011 at 4:11 PM, Mariano C. mariano.calan...@gmail.com wrote: I have this code, I need (for every page) to read a session, if doesn't exist read from a model and then write the session, something like: == function beforeFilter() { // read session variable $id = $this-Session-read('editable_season_id'); // id doesn't exist if((is_null($id)) || (!is_numeric($id))) { // find it $id = $this-MyModel-getLastSeasonId(); $this-Session-write(editable_season_id, $id); } } == If I put it inside appController I can't use $this-MyModel, but if I put it inside appModel I can't use $this-Session. So where I should insert that code??? There's no beforeFilter() in AppModel. That's for client requests. So, AppController. To get the model, use App::import('model', 'MyModel'). -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Where should I insert this before filter? AppController or AppModel?
On Thu, Mar 24, 2011 at 7:21 PM, euromark dereurom...@googlemail.com wrote: because you just importet the class.. use $this-Season = ClassRegistry::init('Season') or loadModel('Season') Oops! Yes, my bad. I meant the first choice. App::import() is not a good choice here. if ((is_null($id)) || (!is_numeric($id))) { $this-Session-write( 'editable_season_id', ClassRegistry::init('Season')-getLastSeasonId() ); } Sorry about that. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: SecondController extends FirstController extends AppController: not supported? --psybear
On Feb 1, 1:32 pm, Joshua Muheim psybea...@gmail.com wrote: Thanks, guys (especially to Tilen for his constructive feedback on my posting habits ;-) ). It seems to me I often run into limitations of CakePHP I think you need to be careful what you call a limitation, and of what. How is the way php works a limitation. cake implements partial variable merging because it helps users and is a reasonable compromise in terms of execution time v benfit. that I hope I can't be the only one who faced them yet and that there's a well known work-around already. In fact, I often seem to be the only person who had the need for them yet, and that's sometimes a bit surprising to me, because I'm definitely not creating very high-end-featured websites with CakePHP yet, and in those cases I'm just interested in knowing the reason why those features aren't available in CakePHP (for which I'm sure there are diligent thoughts behind these decisions). I'm just the kind of person who's not satisfied with only the fact that something IS or ISN'T, but rather is interested in WHY IT IS or ISN'T. That's a great mentality to have. So to get back to my question I'd really like to know WHY __mergeVars() only supports pseudo inheritance from AppController and doesn't do it e.g. recursively through the whole inheritance-chain down to AppController. performance and code simplicity. More than 80% of the time (and realistically probably more than 99% of the time) there isn't an intermediary controller object to consider. As such traversiing the classes is simply unnecessary and the 'cost' of doing that is pretty small. Maybe it's a performance issue? Maybe it's planned for a next release? Sadly the inline documentation of CakePHP codes isn't very exhaustive which is pitty because THERE's the place to put such business decisions when there's no other place for such informations (or maybe I haven't found this resource yet?). Anyway, no offense to anybody. I don't want to bother anyone or strain this mailing list, so if my questions really don't fit here I'm happy somebody's telling me this and I will think about what I could change in my habits so everybody is happy. I'm using forums and similar communities for quite a long time now, and I never had problems of any sort, but maybe things run a little different here. Thanks, Tilen, for subtly pointing me to this problem with your comment. ;-) I think if you asked questions after investigating - or showed what you've found whilst asking your questions you'll get more answers. Right now seeing --psybear in a thread (why are you doing that?) is an easy filter your messages for those who don't want to get drawn into bikeshed debates. AD -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: SecondController extends FirstController extends AppController: not supported? --psybear
On Feb 2, 8:51 am, Joshua Muheim psybea...@gmail.com wrote: Thanks Jamie for your interesting thoughts. On Tue, Feb 1, 2011 at 8:05 PM, Jamie jamie@gmail.com wrote: And since extending controllers beyond the AppController relationship isn't really in the docs and not the official way to do things, there probably hasn't been much impetus to change the behavior. The beauty of modern languages and design patterns is the fact that many things work automagically (when I love something of CakePHP, then this word!). And beneath the fact that in the official docs nothing is documented that lies a bit above the very basic functionalities, I want to point out at least my own situation that has lead me into wishing an inheritance chain for controllers would be supported by CakePHP: I have two kinds of controllers. The first one are the well known CRUD-controllers that come with a certain model. I need certain components and helpers for those controllers loaded, and I could be attempted to place them in the AppController. So for an example, one of these components XYZ takes some action whenever the index() action is called. The second kind of controllers are all the other controllers that deliver non-CRUD-functionality, e.g. PagesController, SearchController or something like that. Now these controllers don't need the components of the CRUD-controllers, but when having them placed in AppController they automatically do! So this is unnecessary overhead, and also the XYZ component tries to do some action on every non-CRUD-controller's index() action that could cause problems. So this leads me to the situation where I have to either load all the CRUD-components not in the AppController but in every single CRUD-controller itself, or I have to check within the component whether the action should be executed or not. Both workarounds aren't very pretty and lead to duplicated and/or unclean code. So again: am I the only person who has ever faced this problem? Or is it another of those situations I pointed to some posts before...? I think you're the first person to notice it and not think oh, 2 secs of editing and I can work on the next part of my problem. AD -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: SecondController extends FirstController extends AppController: not supported? --psybear
Thanks for your thoughts and explanations, AD. On Wed, Feb 2, 2011 at 10:02 AM, AD7six andydawso...@gmail.com wrote: I think you're the first person to notice it and not think oh, 2 secs of editing and I can work on the next part of my problem. I guess you're right, I would have saved a lot of time already if I hadn't tried to investigate such problems. But in the last 4 or 5 months I had to repair and refactor a totally chaotic CakePHP application that didn't have any tests and lots of duplicated code and many half-implemented feature and dead codes. I didn't have any knowledge of the application NOR CakePHP NOR existed any documentation about the project NOR did I have the chance to talk to the original developers. So I had to refactor a VERY UGLY project and apply good quality patterns to it so I could pass it on with a clear conscience to my successor, and it was VERY hard to do that with no CakePHP background (I only knew Ruby On Rails, and maybe this set my expectations for PHP based framework on too high a level). So maybe I have gotten a bit obsessed by the idea to not do *anything* that's not very high coding standard or in a way that's not the CakePHP way. So whenever I thought that something is not as good as it should be, then I asked why it was (maybe I should have made that point clearer, that's true). Also in the Ruby On Rails world testing is encouraged all the time to the users and makes a big part of the application, while CakePHP seems to miss this (IMHO very important) point - most of the questions I asked on this group were about testing, and I nearly never got a satisfying answer. Anyway, in a month my time here at this company will be over and with it I guess I'll leave CakePHP, too. CakePHP is a nice framework and I finally had quite some fun with it. But coming from RoR it just doesn't satisfy my expectations as my obsessive search for reasons seem to prove. I didn't work with RoR for two years or so now, but back then it rarely ever left me unsatisfied and I guess I will try to jump back on that train in the near future. Again, no offense to anybody - I like CakePHP, and I would definitely like to work with it again when I'm limited to PHP. So I guess I won't be posting too much into this user group anymore. I have created some components in the last few months that I think are quite neat, maybe I'll find the time to make them release-ready and share it with you guys to give something back to the CakePHP community. Anyway, thanks again for your support and I wish you all the best for the future. :-) Greetings, Josh PS: I think I'll definitely take a quick look at CakePHP 2.0 when it's finally released... -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: SecondController extends FirstController extends AppController: not supported? --psybear
However, I do think you should pick some of your words a little bit more carefully, you are talking as if PHP is a lesser language and restrictive In fact - I do, yes. ;-) But Ruby has adopted quite some patterns and features of PHP, so PHP isn't all bad. ;-) (Don't take me too serious, please.) (this is a PHP related group afterall). Luckily we have freedom of speech, don't we? :-) No, don't get me wrong, I don't want to disrespect anything or anybody. I was forced (what means I wouldn't have taken it if I didn't have to) into my current job (it's part of my obligatory civil service for my home country), and with my background it seems I've been a bit spoiled and wasn't accustomed to the freaky lovely PHP language anymore. It wasn't that I was *looking* for ways to pull PHP to pieces or something like that. ;-) Anyway, enough about this. I wish you all the best. Anyhow, good luck with whatever venture you go on next. Kind Regards Stephen @ NinjaCoderMonkey www.ninjacodermonkey.co.uk -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php