Re: How to include separate Controller,Model,View with CakePHP
What you can do is write code in the beforeFilter() function of AppController. For example ?php public function beforeFilter() { $this-loadModel('Post'); $this-set('recentPosts', $this-Post-findRecent()); } ? and on Model/Post.php ?php public function findRecent() { if(($recent = Cache::read('posts_recent')) == null) { $recent = $this-find('all',['limit'=4]); Cache::write('posts_recent',$recent); } ? This helps if you place recent post to some part of your site (ie a widget, posts/index, aboutus, etc). You cache the results so next time it loads quickly. Remember this code will run every time you access your site. So if you just want posts in aboutus page you can do the above in the PagesController. On Wednesday, August 13, 2014 3:23:30 PM UTC+3, Matthew Smart wrote: now on the about us page i will have content and a section i want to be the posts that i created as seen in the examples above. However to do this i want to be able to have: Controller/AboutsController.php, Model/About.php view/Abouts/about.ctp and kind of require/include the whole Posts MVC. and if i was to just make my about us page the Posts MVC then the names wouldnt be really what i wont them to, meaning the pages would be called posts instead of about, due to cakephp naming conventions. I hope this makes sense, can any one help please? -- 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: Best practice: using class on all pages
Okay, outputting an ulli structure with an element is indeed very usefull. It can appear in multiple areas on the template files. I understand that I should do something like: echo $this-element('mainmanu', array( 'tree' = array(...), 'active' = array(...) )); The tree array holds the records and should be calculated with a given depth. The active array holds the parent nodes of the active node. So far so good I guess? But what do you exactly mean with getting the data with a request action? Sorry if this is a silly question :) -- 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: Cake 2.5.1 Extremely Slow With MSSQL?
I'm not sure if this is really a good idea. See: http://stackoverflow.com/questions/1155211/what-is-pdo-scrollable-cursor But if you want this find its way into the core, then you can help the core team to get in there. Help yourself by either: a) Create an issue explaining everything on GitHub https://github.com/cakephp/cakephp/issues/new b) Fork the code, change it, prove that it really solves the problem without breaking anything else and create a Pull Request https://github.com/cakephp/cakephp/ Thanks Marc Am Mittwoch, 13. August 2014 16:07:26 UTC+2 schrieb Jordan Hopfner: Thanks Alan, appreciate the help. The project has been put on hold for now but I'll definitely try this change when I go to use SQL Server again. It would be great if the core team would make these changes to Cake :) On Friday, August 8, 2014 10:30:20 PM UTC-6, Alan Read wrote: Changing the line: 772) $prepareOptions += array(PDO::ATTR_CURSOR = PDO::CURSOR_SCROLL); to 772) $prepareOptions += array(PDO::ATTR_CURSOR = PDO::*CURSOR_FWDONLY*); in the _execute function inside of Sqlserver.php solved this issue for me On Wednesday, May 28, 2014 5:19:09 PM UTC-4, Jordan Hopfner wrote: Hey guys, I'm using the latest version of Cake (2.5.1) and am having a problem with extremely slow connections to a MSSQL server. A controller action that only has one simple select statement is taking an upwards of 50 seconds to complete. I don't think it's the select statement itself, I have a created an empty page that connects to MSSQL via PDO and executes the exact same statement and the result is instantaneous, so this leads me to believe it's a problem with the MSSQL data source packaged with Cake. If it was a driver or connection issue I would assume it would happen on the test page as well. Any ideas? I'm on PHP 5.3.x and am connecting to SQL Server 2008 R2. Jordan -- 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.
Post idea: Long term, large scales projects with CakePHP
*TL;DR*, Tell people why and how a RAD framework can compete with the likes of Symfony for larger projects which have a long lifetime. As we all know CakePHP get's a pretty bad rep in the PHP community and no more so than from the Symfony corner. They love to belittle the framework and regurgitate Uncle Bob. It would be nice to have a bit of a slap-down post about using a RAD framework can be for more than just prototyping. It would be great for someone with good knowledge of the core to detail some of the software design principles being used in the framework and how you can build large scale commercial and stable applications using CakePHP. So often people look down on CakePHP because they see it as being magic, tightly coupled or slow. Yeah, we've all heard them spouting this garbage. So why not address it? I think a post or even a book page which extols the virtues of the framework would be beneficial. Something which advertises the framework, why it's cool, what it does which is cool. I know there are some large scale sites out there using the framework. I know I've built a few which *I'd consider* reasonably high traffic (eg, 80k unique visitors a month). So it can be done. I also know that there are plugins, tips, hints and optimisations out there which people have done to help their app. Streamlining the framework by removing all the default routes for example. Making better use of caching. Whatever it might be I would really like to see some Laravel style marketing happening for CakePHP because it is a good framework. I'd welcome other peoples thoughts and suggestions. -- 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.
Authorize.net Integration with CakePHP 3
Hi, I am trying to integrate authorizenet payment recurrring billing with my cakePHP 3 project. Adding require: { authorizenet/authorizenet: ~1.8}to the composer I installed the library file in vendor. I couldn't find any namespace declarations on the library files. I created a function on my vendor controller as below public function authtest(){ define(AUTHORIZENET_API_LOGIN_ID, LOGIN); define(AUTHORIZENET_TRANSACTION_KEY, KEY); $subscription = new AuthorizeNet_Subscription; $subscription-name= PHP Monthly Magazine; $subscription-intervalLength = 1; $subscription-intervalUnit= months; $subscription-startDate = 2014-08-14; $subscription-totalOccurrences= 12; $subscription-amount = 12.99; $subscription-creditCardCardNumber= 60110012; $subscription-creditCardExpirationDate= 2018-10; $subscription-creditCardCardCode = 123; $subscription-billToFirstName = Rasmus; $subscription-billToLastName = Doe; // Create the subscription. $request = new AuthorizeNetARB; $response= $request-createSubscription($subscription); $subscription_id = $response-getSubscriptionId(); echo $subscription_id;exit; } When I am accessing the function ad dsite.com/vendors/authtest I get the following error. Fatal Error *Error: *Class 'App\Controller\AuthorizeNet_Subscription' not found Would you please help me to fix this? Regards, Jipson -- 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: Cake 2.5.1 Extremely Slow With MSSQL?
In the PHP manual it states: PDO::CURSOR_FWDONLY (integer http://php.net/manual/en/language.types.integer.php)Create a PDOStatement http://php.net/manual/en/class.pdostatement.php object with a forward-only cursor. This is the default cursor choice, as it is the fastest and most common data access pattern in PHP. So I don't think it's a bad idea, but I don't know the reasoning the reasoning for using SCROLL over FWDONLY. On Thursday, August 14, 2014 6:38:47 AM UTC-6, ravag...@gmail.com wrote: I'm not sure if this is really a good idea. See: http://stackoverflow.com/questions/1155211/what-is-pdo-scrollable-cursor But if you want this find its way into the core, then you can help the core team to get in there. Help yourself by either: a) Create an issue explaining everything on GitHub https://github.com/cakephp/cakephp/issues/new b) Fork the code, change it, prove that it really solves the problem without breaking anything else and create a Pull Request https://github.com/cakephp/cakephp/ Thanks Marc Am Mittwoch, 13. August 2014 16:07:26 UTC+2 schrieb Jordan Hopfner: Thanks Alan, appreciate the help. The project has been put on hold for now but I'll definitely try this change when I go to use SQL Server again. It would be great if the core team would make these changes to Cake :) On Friday, August 8, 2014 10:30:20 PM UTC-6, Alan Read wrote: Changing the line: 772) $prepareOptions += array(PDO::ATTR_CURSOR = PDO::CURSOR_SCROLL); to 772) $prepareOptions += array(PDO::ATTR_CURSOR = PDO::*CURSOR_FWDONLY* ); in the _execute function inside of Sqlserver.php solved this issue for me On Wednesday, May 28, 2014 5:19:09 PM UTC-4, Jordan Hopfner wrote: Hey guys, I'm using the latest version of Cake (2.5.1) and am having a problem with extremely slow connections to a MSSQL server. A controller action that only has one simple select statement is taking an upwards of 50 seconds to complete. I don't think it's the select statement itself, I have a created an empty page that connects to MSSQL via PDO and executes the exact same statement and the result is instantaneous, so this leads me to believe it's a problem with the MSSQL data source packaged with Cake. If it was a driver or connection issue I would assume it would happen on the test page as well. Any ideas? I'm on PHP 5.3.x and am connecting to SQL Server 2008 R2. Jordan -- 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: Cake 2.5.1 Extremely Slow With MSSQL?
I think the reasoning to use scroll was for future reasonsin CakePHP 3 they are introducing a new ORM layer ( http://book.cakephp.org/3.0/en/appendices/orm-migration.html) and a Query Object. I believe they are going to implement the Query Object with methods like last, first, previous, next etc. With a scrollable cursor those operations are mapped one to one and should be pretty fast: - *SCROLL: *It specifies that all fetch options (FIRST, LAST, PRIOR, NEXT, RELATIVE, ABSOLUTE) are available. If SCROLL is not specified in an ISO DECLARE CURSOR, NEXT is the only fetch option supported. SCROLL cannot be specified if FAST_FORWARD is also specified. ( http://www.sqlservergeeks.com/articles/sql-server-bi/31/sql-server-what-is-a-cursor ) If the cursor is set to FWDONLY, then the only operation available would be next. In my case, with cursor set to SCROLL a simple find query was taking 18 seconds to complete...since the majority of the time I just forward loop through a result set, losing first, last, previous etc is not that big of an issue. On Thu, Aug 14, 2014 at 11:31 AM, Jordan Hopfner nickelfa...@gmail.com wrote: In the PHP manual it states: PDO::CURSOR_FWDONLY (integer http://php.net/manual/en/language.types.integer.php)Create a PDOStatement http://php.net/manual/en/class.pdostatement.php object with a forward-only cursor. This is the default cursor choice, as it is the fastest and most common data access pattern in PHP. So I don't think it's a bad idea, but I don't know the reasoning the reasoning for using SCROLL over FWDONLY. On Thursday, August 14, 2014 6:38:47 AM UTC-6, ravag...@gmail.com wrote: I'm not sure if this is really a good idea. See: http://stackoverflow.com/questions/1155211/what-is-pdo-scrollable-cursor But if you want this find its way into the core, then you can help the core team to get in there. Help yourself by either: a) Create an issue explaining everything on GitHub https://github.com/cakephp/cakephp/issues/new b) Fork the code, change it, prove that it really solves the problem without breaking anything else and create a Pull Request https://github.com/cakephp/cakephp/ Thanks Marc Am Mittwoch, 13. August 2014 16:07:26 UTC+2 schrieb Jordan Hopfner: Thanks Alan, appreciate the help. The project has been put on hold for now but I'll definitely try this change when I go to use SQL Server again. It would be great if the core team would make these changes to Cake :) On Friday, August 8, 2014 10:30:20 PM UTC-6, Alan Read wrote: Changing the line: 772) $prepareOptions += array(PDO::ATTR_CURSOR = PDO::CURSOR_SCROLL); to 772) $prepareOptions += array(PDO::ATTR_CURSOR = PDO::*CURSOR_FWDONLY* ); in the _execute function inside of Sqlserver.php solved this issue for me On Wednesday, May 28, 2014 5:19:09 PM UTC-4, Jordan Hopfner wrote: Hey guys, I'm using the latest version of Cake (2.5.1) and am having a problem with extremely slow connections to a MSSQL server. A controller action that only has one simple select statement is taking an upwards of 50 seconds to complete. I don't think it's the select statement itself, I have a created an empty page that connects to MSSQL via PDO and executes the exact same statement and the result is instantaneous, so this leads me to believe it's a problem with the MSSQL data source packaged with Cake. If it was a driver or connection issue I would assume it would happen on the test page as well. Any ideas? I'm on PHP 5.3.x and am connecting to SQL Server 2008 R2. Jordan -- 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 a topic in the Google Groups CakePHP group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/cake-php/2Vqixc1UGCw/unsubscribe. To unsubscribe from this group and all its topics, 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. -- Alan Read -- 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.