Re: How to add view Header, Footer into static html page?
you can use cake default template in view. View/Layout/default.ctp On May 26, 2014 7:57 PM, "Châu Huỳnh Phong" wrote: > I have two common views: > demo/app/View/Elements/header.tpl > demo/app/View/Elements/footer.tpl > > And now, I have static html page: demo/edit/static/index.html > > So, Have any way to add header.tpl and footer.tpl to static page html > index.html > > Thank you so much! > > -- > 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. > -- 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: CakePHP 3.x - DbAcl
Great! I'll take a look at it :) On Monday, May 26, 2014 2:25:13 PM UTC+2, Thomas von Hassel wrote: > > https://bitbucket.org/elementsdk/cndacl.plugin > > (please, don’t laugh .. it’s not quite polished to my standards yet ;)) > > > On 26 May 2014, at 10:06, José Lorenzo wrote: > > I would be happy to see your implementation :D > > On Monday, May 26, 2014 10:02:11 AM UTC+2, Thomas von Hassel wrote: >> >> Hey >> >> >> How far away is the DbAcl for 3.x ? >> >> I needed a DbAcl implementation for the thing i’m working on right now, >> so i rolled my own. It’s far from feature complete compared to the 2.x >> version, but works for me. >> >> If need be i can clean it up some more and finish the tests if someone >> wants to use it ? >> >> >> /thomas >> >> > -- > 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. > > > -- 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: callback succession / why afterValidate() if validation fails
Thx José for the explanation. But how do I test if the validation has failed ? Something like this is not really nice... function afterValidate($options) { if (!empty($this->validationErrors)) { return false; } } any better idea ? TIA, Charles On 26.05.14 10:16, José Lorenzo wrote: > It is just the way it works. There are equal amount of reasons for > wanting the callback to be run after the validation has failed, can > you not change the logic to check if there are any validation errors > and not run the rest of the method? > > On Monday, May 26, 2014 10:06:50 AM UTC+2, cbueche wrote: > > Dear Bakers, > > I have an app under CakePHP 2.5.1. I'm not sure to understand how > the callback succession is supposed to work, eg if the validation > fails, there is IMHO no reason to run afterValidate() ? But it > does run indeed. > > What I'm trying to do: > > my form has 7 entry fields. The ones I have issues with are > start_time, end_time and duration. The user might enter a > combination of them, eg > > - start & end > - start & duration > - duration & end > - only duration > > (at the end, I only care about durations) > > My strategy for saving the data is > > - have a validation for the fields, eg to get the right time > format (HH:MM) or duration, but with 'required' => false and > 'allowEmpty' => true > - in afterValidate(), I verify that the new entered start and end > do not overlap with existing records > - in beforeSave(), I verify the combination entered by the user, > the goal being to calculate a duration > > My problem is that even if the user enters a wrong format for a > field, Cake still run afterValidate(), causing problems in my > queries, before I can return "false" to abort the save. > > Now I'm not really sure why cake runs afterValidate() if > validation fails. Is there something I missed ? > > TIA for your assistance, > Charles > -- 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: CakePHP 3.x - DbAcl
https://bitbucket.org/elementsdk/cndacl.plugin (please, don't laugh .. it's not quite polished to my standards yet ;)) On 26 May 2014, at 10:06, José Lorenzo wrote: > I would be happy to see your implementation :D > > On Monday, May 26, 2014 10:02:11 AM UTC+2, Thomas von Hassel wrote: > Hey > > > How far away is the DbAcl for 3.x ? > > I needed a DbAcl implementation for the thing i'm working on right now, so i > rolled my own. It's far from feature complete compared to the 2.x version, > but works for me. > > If need be i can clean it up some more and finish the tests if someone wants > to use it ? > > > /thomas > > > -- > 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. -- 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: CakePHP 3.x - DbAcl
thomas, take a look at https://github.com/cakephp/acl this is the new 3.x repo for Acl relevant stuff It has been moved out of the core. Might be useful to use some of it for your approach? Mark Am Montag, 26. Mai 2014 10:02:11 UTC+2 schrieb Thomas von Hassel: > > Hey > > > How far away is the DbAcl for 3.x ? > > I needed a DbAcl implementation for the thing i’m working on right now, so > i rolled my own. It’s far from feature complete compared to the 2.x > version, but works for me. > > If need be i can clean it up some more and finish the tests if someone > wants to use it ? > > > /thomas > > -- 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.
How to add view Header, Footer into static html page?
I have two common views: demo/app/View/Elements/header.tpl demo/app/View/Elements/footer.tpl And now, I have static html page: demo/edit/static/index.html So, Have any way to add header.tpl and footer.tpl to static page html index.html Thank you so much! -- 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: Database schema for tests in 3.0.0-dev3
https://github.com/cakephp/cakephp/issues/3567 On Monday, May 26, 2014 3:18:15 PM UTC+7, José Lorenzo wrote: > > This looks like a bug, can you please create a Ticket? > > On Monday, May 26, 2014 9:41:04 AM UTC+2, Joerg Henning wrote: >> >> Hi, >> >> not sure where to put this since I don't know it it's a defect or I'm >> just getting it wrong: trying to set up a test case using the latest 3.0.0 >> version. How would I generate the schema for the test database? Since >> there's no Schema shell, I'm trying to import the schema from my default >> database, like here: >> http://book.cakephp.org/3.0/en/development/testing.html#importing-table-information >> : >> >> class TransactionFixture extends TestFixture >> { >> public $import = ['table' => 'transactions', 'connection' => >> 'default']; >> } >> >> class TransactionsTest extends \Cake\TestSuite\TestCase >> { >> public $fixtures = ['app.transaction']; >> >> public function testGetTransactions() >> { >> $table = Cake\ORM\TableRegistry::get('transactions'); >> // ... >> } >> } >> >> However, that does not seem to work - it fails with the following error: >> >> SQLSTATE[42S02]: Base table or view not found: 1146 Table >> 'mydb_test.transactions' doesn't exist >> >> It seems it's trying to import the table from the test database, not from >> the default database as it should. Digging deeper into the problem, I see >> the following code in FixtureManager: >> >> ConnectionManager::alias('test', 'default'); >> >> So since 'test' is aliased with 'default' how is this even supposed to >> ever work in the first place? The fixture would try to import the schema >> from the 'default' DB but since that one is aliased to 'test' so we end up >> trying to import from 'test' into 'test', don't we? Or am I getting it all >> wrong? >> >> Any help appreciated, >> >> Joerg >> > -- 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: Database schema for tests in 3.0.0-dev3
This looks like a bug, can you please create a Ticket? On Monday, May 26, 2014 9:41:04 AM UTC+2, Joerg Henning wrote: > > Hi, > > not sure where to put this since I don't know it it's a defect or I'm just > getting it wrong: trying to set up a test case using the latest 3.0.0 > version. How would I generate the schema for the test database? Since > there's no Schema shell, I'm trying to import the schema from my default > database, like here: > http://book.cakephp.org/3.0/en/development/testing.html#importing-table-information > : > > class TransactionFixture extends TestFixture > { > public $import = ['table' => 'transactions', 'connection' => > 'default']; > } > > class TransactionsTest extends \Cake\TestSuite\TestCase > { > public $fixtures = ['app.transaction']; > > public function testGetTransactions() > { > $table = Cake\ORM\TableRegistry::get('transactions'); > // ... > } > } > > However, that does not seem to work - it fails with the following error: > > SQLSTATE[42S02]: Base table or view not found: 1146 Table > 'mydb_test.transactions' doesn't exist > > It seems it's trying to import the table from the test database, not from > the default database as it should. Digging deeper into the problem, I see > the following code in FixtureManager: > > ConnectionManager::alias('test', 'default'); > > So since 'test' is aliased with 'default' how is this even supposed to > ever work in the first place? The fixture would try to import the schema > from the 'default' DB but since that one is aliased to 'test' so we end up > trying to import from 'test' into 'test', don't we? Or am I getting it all > wrong? > > Any help appreciated, > > Joerg > -- 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: callback succession / why afterValidate() if validation fails
It is just the way it works. There are equal amount of reasons for wanting the callback to be run after the validation has failed, can you not change the logic to check if there are any validation errors and not run the rest of the method? On Monday, May 26, 2014 10:06:50 AM UTC+2, cbueche wrote: > > Dear Bakers, > > I have an app under CakePHP 2.5.1. I'm not sure to understand how the > callback succession is supposed to work, eg if the validation fails, there > is IMHO no reason to run afterValidate() ? But it does run indeed. > > What I'm trying to do: > > my form has 7 entry fields. The ones I have issues with are start_time, > end_time and duration. The user might enter a combination of them, eg > > - start & end > - start & duration > - duration & end > - only duration > > (at the end, I only care about durations) > > My strategy for saving the data is > > - have a validation for the fields, eg to get the right time format > (HH:MM) or duration, but with 'required' => false and 'allowEmpty' => true > - in afterValidate(), I verify that the new entered start and end do not > overlap with existing records > - in beforeSave(), I verify the combination entered by the user, the goal > being to calculate a duration > > My problem is that even if the user enters a wrong format for a field, > Cake still run afterValidate(), causing problems in my queries, before I > can return "false" to abort the save. > > Now I'm not really sure why cake runs afterValidate() if validation fails. > Is there something I missed ? > > TIA for your assistance, > Charles > -- 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.
callback succession / why afterValidate() if validation fails
Dear Bakers, I have an app under CakePHP 2.5.1. I'm not sure to understand how the callback succession is supposed to work, eg if the validation fails, there is IMHO no reason to run afterValidate() ? But it does run indeed. What I'm trying to do: my form has 7 entry fields. The ones I have issues with are start_time, end_time and duration. The user might enter a combination of them, eg - start & end - start & duration - duration & end - only duration (at the end, I only care about durations) My strategy for saving the data is - have a validation for the fields, eg to get the right time format (HH:MM) or duration, but with 'required' => false and 'allowEmpty' => true - in afterValidate(), I verify that the new entered start and end do not overlap with existing records - in beforeSave(), I verify the combination entered by the user, the goal being to calculate a duration My problem is that even if the user enters a wrong format for a field, Cake still run afterValidate(), causing problems in my queries, before I can return "false" to abort the save. Now I'm not really sure why cake runs afterValidate() if validation fails. Is there something I missed ? TIA for your assistance, Charles -- 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.
Database schema for tests in 3.0.0-dev3
Hi, not sure where to put this since I don't know it it's a defect or I'm just getting it wrong: trying to set up a test case using the latest 3.0.0 version. How would I generate the schema for the test database? Since there's no Schema shell, I'm trying to import the schema from my default database, like here: http://book.cakephp.org/3.0/en/development/testing.html#importing-table-information: class TransactionFixture extends TestFixture { public $import = ['table' => 'transactions', 'connection' => 'default']; } class TransactionsTest extends \Cake\TestSuite\TestCase { public $fixtures = ['app.transaction']; public function testGetTransactions() { $table = Cake\ORM\TableRegistry::get('transactions'); // ... } } However, that does not seem to work - it fails with the following error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydb_test.transactions' doesn't exist It seems it's trying to import the table from the test database, not from the default database as it should. Digging deeper into the problem, I see the following code in FixtureManager: ConnectionManager::alias('test', 'default'); So since 'test' is aliased with 'default' how is this even supposed to ever work in the first place? The fixture would try to import the schema from the 'default' DB but since that one is aliased to 'test' so we end up trying to import from 'test' into 'test', don't we? Or am I getting it all wrong? Any help appreciated, Joerg -- 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: CakePHP 3.x - DbAcl
I would be happy to see your implementation :D On Monday, May 26, 2014 10:02:11 AM UTC+2, Thomas von Hassel wrote: > > Hey > > > How far away is the DbAcl for 3.x ? > > I needed a DbAcl implementation for the thing i’m working on right now, so > i rolled my own. It’s far from feature complete compared to the 2.x > version, but works for me. > > If need be i can clean it up some more and finish the tests if someone > wants to use it ? > > > /thomas > > -- 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.
CakePHP 3.x - DbAcl
Hey How far away is the DbAcl for 3.x ? I needed a DbAcl implementation for the thing i'm working on right now, so i rolled my own. It's far from feature complete compared to the 2.x version, but works for me. If need be i can clean it up some more and finish the tests if someone wants to use it ? /thomas -- 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.