Events or Actions

2014-07-14 Thread Paulo Sérgio J . Matsinhe
Hi, I'm new to Cake and I have a challenge. I'm trying to select an Item from a Combobox and depending on the Selected Item I would like to disable or enable another 2 fields. Everyone talks about ajax but I would like to have an example. thanks in advance! -- Like Us on FaceBook https://www.f

Re: uppercase letter names in controller not working in shared hosting

2013-03-28 Thread Miles J
How are you constructing the URLs? If I remember correctly, it should be 'controller' => 'notification_message'. On Thursday, March 28, 2013 1:45:24 PM UTC-7, Soumya Ranjan sahu wrote: > > I have a cakephp site on bluehost. I have several contollers and some are > named with 2 uppercase letters

Re: Benchmark framework article

2013-03-28 Thread Miles J
milk where both of them are liquids but each one of them has its > own use! > > > On Thu, Mar 28, 2013 at 8:58 PM, Miles J > > wrote: > >> Found this article. Pretty interesting that Cake is last place in every >> benchmark (given that it's multiple languages

Benchmark framework article

2013-03-28 Thread Miles J
Found this article. Pretty interesting that Cake is last place in every benchmark (given that it's multiple languages). http://www.techempower.com/blog/2013/03/28/framework-benchmarks/ -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- Yo

Re: Should validation 'allowEmpty' be removed?

2013-03-25 Thread Miles J
+1 notEmpty and required sort of solve this already. On Saturday, March 23, 2013 8:25:41 AM UTC-7, Sebastiaan van Stijn wrote: > > I've encountered many new CakePHP users that were a bit confused by the > 'allowEmpty' option in validation rules. Thinking about this issue, I must > say that I ag

Re: uploading file

2013-03-25 Thread Miles J
Pick one: https://github.com/davidpersson/media https://github.com/bmcclure/CakePHP-Media-Plugin https://github.com/milesj/Uploader https://www.google.com/search?q=cakephp+file+uploading&aq=f&oq=cakephp+file+uploading On Sunday, March 24, 2013 8:12:08 PM UTC-7, Rian Falam Simanjuntak wrote: > >

Re: Solution for CakePHP newbies who are stuck with messages like - Error: PostController could not be found

2013-03-23 Thread Miles J
CakePHP requires that you understand PHP. The fact that you didn't know that is unsettling. On Saturday, November 24, 2012 12:53:19 PM UTC-8, Mike Pritchard wrote: > > I struggled with the problems described in messages from new CakePHP > users. The Cake install looked OK, but when I went throu

Re: FULL_BASE_URL error using requestAction()

2012-12-07 Thread Miles J
Anyone have an idea? On Monday, November 26, 2012 12:11:05 PM UTC-8, Miles J wrote: > > The latest, 2.2.2 I believe. > > On Thursday, November 22, 2012 5:40:38 AM UTC-8, jsundquist wrote: >> >> What version are you using. >> On Nov 22, 2012 1:39 AM, "Miles J&qu

Re: FULL_BASE_URL error using requestAction()

2012-11-26 Thread Miles J
The latest, 2.2.2 I believe. On Thursday, November 22, 2012 5:40:38 AM UTC-8, jsundquist wrote: > > What version are you using. > On Nov 22, 2012 1:39 AM, "Miles J" > > wrote: > >> I keep seeing this in my debug.log, any ideas? >> >> 2012-11-22

FULL_BASE_URL error using requestAction()

2012-11-21 Thread Miles J
I keep seeing this in my debug.log, any ideas? 2012-11-22 03:22:36 Notice: Notice (8): Use of undefined constant FULL_BASE_URL - assumed 'FULL_BASE_URL' in [/var/www/cake/latest/lib/Cake/Core/Object.php, line 87] Trace: Object::requestAction() - CORECake/Core/Object.php, line 87 include - /var/w

Re: Facebook PHP SDK, session_regenerate_id

2012-07-11 Thread Miles J
Could the order of session creation be the problem? Make sure the FB sessions are being created after Cakes. On Wednesday, July 11, 2012 9:03:41 PM UTC-7, Afif Abu Bakar wrote: > > Hi all. > > I'm having some problems working with authenticate users that login via > Facebook. Users cannot login

Re: Manage large multilingual project

2012-07-01 Thread Miles J
One thing I want to point out, is that using keys instead of sentences as keys is much easier to manage. msgid "welcome.intro" msgstr "Welcome %s" Much better than: msgid "Welcome %s" msgstr "" On Saturday, June 9, 2012 5:05:13 AM UTC-7, heohni wrote: > > Hi, > > I have a project with currentl

Re: Why using HTML->link instead of manually writing an anchor text ?

2012-07-01 Thread Miles J
http://milesj.me/blog/read/end-html-helper On Saturday, June 30, 2012 6:38:36 PM UTC-7, Marcelo Custódio wrote: > > Isn't it much slower concerning development time ? > > What are the advantages of of HTML->link ? > > Thanks ! > -- Our newest site for the community: CakePHP Video Tutorials http

Re: CakePHP Image Upload and Remote Delete

2012-06-27 Thread Miles J
So the images on B are on its own local file system? The only real solution is to make some kind of API call from A using curl that posts to B telling it to delete a certain file. Or I would suggest moving everything to Amazon S3. On Monday, June 25, 2012 7:39:16 AM UTC-7, GerarD wrote: > > Hi

Re: CMS with cakephp

2012-06-27 Thread Miles J
Just use Croogo http://croogo.org/ On Wednesday, June 27, 2012 8:25:25 PM UTC-7, Mr. Manager wrote: > > Dear All, > > If everyone between cakephp 1.3 and cakephp 2x. which one is better if I > want to make website with unlimited content management system. > > Please let me know if anyone know ab

Re: Notice: Constant CAKE_CORE_INCLUDE_PATH already defined in

2012-06-02 Thread Miles J
Search and find out where its being defined twice. On Saturday, June 2, 2012 8:55:14 AM UTC-7, alvin567 wrote: > > Notice: Constant CAKE_CORE_INCLUDE_PATH already defined in > > how do I cancel out this error? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org

Re: Serialization of 'Closure' is not allowed

2012-05-19 Thread Miles J
MThomas, the error pretty much says what you want to know. You cant serialize closures, so where are you using a closure? On Friday, May 18, 2012 9:14:29 AM UTC-7, MThomas wrote: > > Hi! > > First of all I'm pretty new to CakePHP. Although it sometimes gives me > headaches I love. > > On probl

Re: Recover associated data of second level.

2012-05-12 Thread J.
To Be more precise I have : User hasOne Profile Profile belongsTo USer Profile HABTM Card Card HABTM Profile Since profile belongs to User, How can I get its associated data (CArd) from the USer view ? Le samedi 12 mai 2012 16:25:48 UTC+2, J. a écrit : > > Hi, > > In my cak

Recover associated data of second level.

2012-05-12 Thread J.
Hi, In my cake app I have : User hasOne Profile HasAndBelongsToMany Card When I find a user, I get this array : array( > 'User' => array( > 'password' => '*', > 'id' => '1', > 'email' => '***', > 'username' => '**', >

Re: Wrong request method (2.1.2)

2012-05-04 Thread Miles J
I believe it has changed so if you are doing an edit it sends a PUT, else if you are doing a create it sends a POST. I ran into that same issue today. On Friday, May 4, 2012 1:17:31 PM UTC-7, SigalX wrote: > > I've seen that cake had sent "PUT" in the "_method" variable but it was > POST and I

Re: Problem with Miles J. Uploader plugin and image name

2012-05-04 Thread Miles J
What version are you using? On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote: > > This is my behavior setup: > > public $actsAs = array( > 'Uploader.Attachment' => array( > 'image_upload' => array( > 'name'=> 'formatFileName', >

Re: Problem with Miles J. Uploader plugin and image name

2012-05-03 Thread Miles J
Are you trying to overwrite the original image with the resized one? Try adding overwrite = true to the resize transformation. On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote: > > This is my behavior setup: > > public $actsAs = array( > 'Uploader.Attachment' => array( >

Re: Best IDE for CakePHP 2.1

2012-04-11 Thread Miles J
Most IDEs all do the same thing, so how did none of those meet your needs? For reference, I use PHPStorm. On Wednesday, April 11, 2012 10:23:46 PM UTC-7, Reza Talamkhani wrote: > > Hi, > I Need an IDE for CakePHP 2.1 that integerated with cake console and > suggestion... > I test eclipse, netbea

Re: mysql gone away

2012-04-03 Thread Miles J
Are these PDFs being created in the CLI/cron? If not, they should be. On Tuesday, April 3, 2012 12:54:27 AM UTC-7, Sandy wrote: > > HI There, > > I'm facing a big problem with cakephp 1.2 > > first one is that cakephp is creating connection with mysql using > mysql_pconnect, but in database.php

Re: Using Cupcake Forum with CakePHP 2.0

2012-04-02 Thread Miles J
Version 3.0 of the forum is for CakePHP 2.0. https://github.com/milesj/cake-forum For future reference, you can check the compatibility section in the readme. On Monday, April 2, 2012 9:17:33 AM UTC-7, WhyNotSmile wrote: > > I'm trying to integrate the Cupcake forum (version 2.3) with my app, >

Re: Image Upload

2012-04-01 Thread Miles J
You can't save files with AJAX. Are you using a JS script that's using the iframe hack? On Saturday, March 31, 2012 12:41:41 PM UTC-7, aSh!Q's wrote: > > I wanted to upload a picture of the user via ajax. I checked the media > plugin but found it a little bit hard seeing all those instructions.

Re: Cost of cakePHP2 developers

2012-03-29 Thread Miles J
Really depends on location. I've seen wages ranging from $30 an hour up to $80 an hour. On Wednesday, March 28, 2012 3:03:47 AM UTC-7, DerekGardiner wrote: > > Does anyone know what the typical hourly rate of a cakephp dev (in > USD) would be? For a junior, intermediate and senior developer? --

Re: Controller can't access the Session

2012-03-29 Thread Miles J
On a side note, you are including tons of models. You don't need to include every model if specific models have associated models you can utilize. You should also load models on a per action basis using loadModel(). On Sunday, March 18, 2012 5:37:02 PM UTC-7, Felipe Roman wrote: > > Hi, > > Has

Re: Is it possible to implement a "no answer" null value on a boolean field?

2012-03-27 Thread Miles J
You shouldn't be using booleans as keys, just use strings. $options = array('1' => 'yes', '0' => 'no'); echo $this->Form->input('music', array('options' => $options, 'empty' => 'no answer')); On Tuesday, March 27, 2012 2:16:28 PM UTC-7, Daniel wrote: > > Is it possible to implement a "no answ

Re: milesj ​cake-auto_login I can't get it working

2012-03-26 Thread Miles J
This doesn't work with AJAX as it uses the beforeRedirect() method callback to process logic. You can save the cookie yourself though: $this->AutoLogin->save($username, $password); -Miles On Monday, March 26, 2012 5:01:41 AM UTC-7, heohni wrote: > > Hi, > > I downloaded the version 3.4. > I ad

Re: Where to save utility routines

2012-03-22 Thread Miles J
If you also need to use it outside of the view, you can just create a static class and include it, then use the methods statically in the view. SomeClass::staticMethod(). On Wednesday, March 21, 2012 12:01:20 PM UTC-7, Graham wrote: > > Dear all, still new to CakePHP but learning all the time. >

Re: Upgrading to 2.1

2012-03-16 Thread Miles J
You should probably do the 1.x -> 2.0 first then the 2.0 -> 2.1. http://book.cakephp.org/2.0/en/appendices/2-0-migration-guide.html http://book.cakephp.org/2.0/en/appendices/2-1-migration-guide.html On Friday, March 16, 2012 7:53:39 AM UTC-7, rainerpl wrote: > > Hi > > Could somebody point me to

Re: recursive attr in Model not worked in cake2.1

2012-03-14 Thread Miles J
Wasn't recursive deprecated? Use the containable behavior. On Monday, March 12, 2012 6:54:17 PM UTC-7, piku wrote: > > I just used cake2.1 ,but Model section when i try to use $this- > >Model(alias name)->recursive =1 > it did not work , but when i used same code in cake 1.3 it works , > could

Re: How to remove a field from $this->request->data so that it is not saved?

2012-03-14 Thread Miles J
Or you can just use the whitelist in Model::save($this->request->data, true, array('fieldName')). On Wednesday, March 14, 2012 10:15:30 AM UTC-7, Daniel wrote: > > How do I remove a field from $this->request->data so that it is not > saved / touched on the database when doing a $this->User->save

Re: @Miles J - Uploader

2012-03-11 Thread Miles J
and I couldn't be any happier with it ;) > > Tanks a bunch Miles. > > Regards, > ED > > On Saturday, March 10, 2012 1:52:29 AM UTC-5, Miles J wrote: >> >> Does the debug() statement appear when doing a model delete? >> >> On Friday, March 9, 2012

Re: @Miles J - Uploader

2012-03-09 Thread Miles J
Does the debug() statement appear when doing a model delete? On Friday, March 9, 2012 9:25:09 PM UTC-8, CrotchFrog wrote: > > It's correctly generating the path and works fine when manually deleting > with Uploader. > > On Friday, March 9, 2012 1:30:31 PM UTC-5, Miles J

Re: @Miles J - Uploader

2012-03-09 Thread Miles J
Can you throw some debug($path)'s in Uploader.delete() to see if its generating the correct absolute path. On Thursday, March 8, 2012 9:38:05 PM UTC-8, CrotchFrog wrote: > > Using Cake 2.1 & Uploader 3.3 > > 'Uploader.Attachment' => array( > 'fileName' => array( > 'name' => 'generateFilename', >

Re: @Miles J - Uploader

2012-03-08 Thread Miles J
File deletion during row deletion works fine in my test cases. What versions are you using? (I haven't touched file deletion in a long time) Whats your behavior settings look like? What type of association? Or is it direct? On Thursday, March 8, 2012 12:56:50 AM UTC-8, CrotchFrog wrote: > > @Mil

Re: Undefined controller: Controller!

2012-03-08 Thread Miles J
Is there a reason why you are calling redirect() twice? On Thursday, March 8, 2012 8:08:39 AM UTC-8, muka wrote: > > Hi, > I got a strange behaviour ajax-sending a form. > In controller the record is saved correctly but I get a 404 response > withᅵ "Missing Controller, Error: Controller could

Re: Cake PHP (Bug even still exists in cake php2)

2012-03-08 Thread Miles J
I don't quite understand OP. On Thursday, March 8, 2012 6:40:15 AM UTC-8, Phil wrote: > > Bad programming by cake php here. This bug still exists in version > 2. Why does it rely on a css file existing? A lot of people will > alter the default template first (removing the default cake stuff),

Re: How to set up Debug Kit

2012-03-06 Thread Miles J
It seems like you should understand basic web development and PHP first. On Tuesday, March 6, 2012 12:01:59 PM UTC-8, kalai wrote: > > Hi when i am Setting up Debugkit, > > i came through this "set the debug mode to at least 1." > > I DON"T no how to set up debug mode to at least 1 > > > Ca

Re: Date out of the V2.1 Stable

2012-02-29 Thread Miles J
Release candidates for the most part wont change much from the stable release. The only differences would be bug fixes, so feel free to use it. On Tuesday, February 28, 2012 8:33:55 AM UTC-8, fitoussi...@gmail.com wrote: > > Hi all, > > I currently work in a web agency and we wonder, when the st

Re: Using char(36) as a uuid

2012-02-29 Thread Miles J
Whats the reason for disliking auto-incrementing numbers? Its probably the best thing about databases. On Wednesday, February 29, 2012 6:53:38 AM UTC-8, Ighor Martins wrote: > > Hello, > > I was thinking about the use of integer as primary key of the table or use > a char(36) as UUID in the enti

Re: How to handle FILE input type when saving form information?

2012-02-24 Thread Miles J
Use one of the many file uploading plugins out there. Or just use copy() or move_uploaded_file(). On Feb 24, 7:57 am, "reynie...@gmail.com" wrote: > Hi: > I'm having some problems handling file uploads and database saving. I have > a table where I need to store the route where uploaded files are

Re: HtmlHelper::div close tag?

2012-02-21 Thread Miles J
The only real use for generating HTML with the helper is when you are packaging markup from within a helper. Just manually write it in the view. On Feb 21, 7:20 am, Jeremy Burns | Class Outfit wrote: > I went down the whole Html->tag route once and then methodically went through > and unpicked i

Re: Different frontend and backend controllers

2012-02-03 Thread Miles J
If I recall correctly, controllers within folders support was removed in 2.x to encourage the use of plugins. Someone correct me if I am wrong. On Feb 3, 7:45 am, Stephen wrote: > Sounds like a good set up, I don't suppose you have an open source copy of > the admin system you use for 1.x? I wou

Re: Different frontend and backend controllers

2012-02-02 Thread Miles J
Use plugins. In my projects I have an "admin" plugin, which works wonderfully and I don't have to deal with prefixes, which I also dislike. On Feb 2, 10:05 am, Thaissa Mendes wrote: > Depends on how the app is built. I make backend and frontend > separately, so backend would have list/add/edit/de

Re: creating your custom translate function

2012-01-25 Thread Miles J
Just create a different one, ___() or _(), if it's really that much of a problem. On Jan 25, 3:19 pm, AD7six wrote: > On Jan 25, 10:55 pm, Tilen Majerle wrote: > > > this is just, like request for new feature, maybe it's cool, maybe not, > > this will developers say :) > > Why would you want to

Re: redirect doesn't work when controller function is called from JS-function

2012-01-22 Thread Miles J
Well if it is an AJAX call, just do a redirect in the JS within the response. location.href = newUrl; Or location.reload(true); To refresh the current page. On Jan 22, 10:10 am, Tilen Majerle wrote: > you are calling POST call via AJAX request, so, you can't use > $this->redirect() in control

Re: How to Change Pre-Defined Index Page

2012-01-22 Thread J.
Sorry, it's home.ctp On 22 jan, 17:39, "J." wrote: > Create index.ctp in pages. Will auto replace index. > > On 22 jan, 16:20, Keith Yeoh wrote: > > > > > > > > > Hi there, > > > I have been go through the research on how to change

Re: How to Change Pre-Defined Index Page

2012-01-22 Thread J.
Create index.ctp in pages. Will auto replace index. On 22 jan, 16:20, Keith Yeoh wrote: > Hi there, > > I have been go through the research on how to change the pre-defined > index page. > > The pre-defined index page means when you enter (http://localhost/ > abc123) the Cake PHP configuration pa

Saving relationships

2012-01-22 Thread J.
I'm making a follower system ala Twitter. Here is my UsersController : class UsersController extends AppController { public $name = 'Users'; public $helpers = array('Html', 'Form', 'Paginator'); var $hasAndBelongsToMany = array( 'Followed' => array( 'className' => 'User', 'joinT

Re: java script detection at the time of site load

2012-01-20 Thread Miles J
Always gotta be a smart ass. Its *not* possible to detect JS with PHP outright. Detecting if a cookie exists isn't really detecting it, it's a workaround. On Jan 20, 12:52 am, AD7six wrote: > On Jan 19, 7:51 pm, Miles J wrote: > > > Right but I would rather just set a c

Re: java script detection at the time of site load

2012-01-19 Thread Miles J
Right but I would rather just set a cookie via JS and check it on the PHP side. Same effect. But now a days, you shouldn't have to worry about the user not having JS enabled. On Jan 19, 12:57 am, AD7six wrote: > On Jan 18, 10:04 pm, Miles J wrote: > > > You can't detec

Re: java script detection at the time of site load

2012-01-18 Thread Miles J
You can't detect if JS is enabled via PHP. On Jan 18, 7:28 am, bujanga wrote: > https://www.google.com/search?q=javascript+version+check > > On Wed, Jan 18, 2012 at 6:52 AM, vaibhav pathak > > > > > > > > wrote: > > Please any one can tell me how i can detect that java script of > > browser is o

Re: Users can only edit or delete themselves

2012-01-16 Thread J.
I was just trying this, but it says Undefined variable: id [APP/ Controller/UsersController.php, line 71] But line 71 being$id = $this->isEditable($id); It should be defined ? Full code for help : private function isEditable($id) { if ($this->Auth->user('role') ==

Re: Users can only edit or delete themselves

2012-01-16 Thread J.
So, Last post I hope ! Here is the UsersController : private function isEditable($id) { if ($this->Auth->user('role') == 'admin') { // if they are admin, so return the original id they wanted to edit return $id;

Re: Users can only edit or delete themselves

2012-01-16 Thread J.
Ok, so here is my User model : public function isEditable($id) { if ($this->Auth->user('role') == 'admin') { // if they are admin, so return the original id they wanted to edit return $id; } // if they a

Re: Users can only edit or delete themselves

2012-01-15 Thread J.
Thanks for the clarification, but still, users aren't allowed to edit only themeselves with this method. If I dot this : $this->Auth->allow('edit'); any user can edit any other user. I want them to only edit their own account. If logged user id is 4, I want him to be only able to edit User acc

Re: Users can only edit or delete themselves

2012-01-15 Thread J.
;User->id) { return true; } } return false; } On 15 jan, 16:26, "J." wrote: > I tried everything and I still don't understand why this isn't working > in my UsersController : > > public function isAuthorized($user) { >         if (parent::i

Re: Users can only edit or delete themselves

2012-01-15 Thread J.
ser->id === $this- >Auth->user('id'))) { return true; } return false; } Any idea ? Thanks a lot. On 15 jan, 11:43, "J." wrote: > Ok, I modified the UsersController like this : > >     public function isAuthorized($user)

Re: Users can only edit or delete themselves

2012-01-15 Thread J.
} but it doesn't seem to work. Any help ? Thanks a lot. On 15 jan, 11:38, "J." wrote: > I think I'm near the solution, but I need help for finishing the > code : > > Here is my app controller : > >     public function isAuthorized($user) { >

Re: Users can only edit or delete themselves

2012-01-15 Thread J.
I think I'm near the solution, but I need help for finishing the code : Here is my app controller : public function isAuthorized($user) { if (isset($user['role']) && $user['role'] === 'admin') { return true; //Admin can access every action } return false; /

Re: Users can only edit or delete themselves

2012-01-14 Thread J.
But I want admins to be able to edit/delete any user too, is that possible ? On 14 jan, 19:34, jeremyharris wrote: > If you only want users to delete themselves, why not just handle that in > your delete method? > > public function delete() { > $id = $this->Auth->user('id'); > // etc > > > > > >

Users can only edit or delete themselves

2012-01-14 Thread J.
I was following the blog tutorial that showed how to protect posts, but in my app, any user can edit any other user... So I wanted to protect the edit and delete functions of my UsersController. This is what I'm trying right now : public function isLoggedUser() { if ($user['Us

Re: How can I run some code only once per day?

2012-01-11 Thread Miles J
@jeremy - Now that is sick. Was trying for so long to cache SQL data via a behavior but never thought to use a datasource as well. Will give this a try. On Jan 11, 1:23 pm, jeremyharris wrote: > Cool, hope it works out for you! -- Our newest site for the community: CakePHP Video Tutorials http

Re: Problem with Security

2012-01-11 Thread Miles J
n other controller for > > admin? > > > Where should I put this App::uses? Can I put this somwhere in > > AppController? > > > I have added that into the login function and now that is working. > > > jmail > > > On 11 Sty, 03:28, Miles J wrote: >

Re: Problem with Security

2012-01-10 Thread Miles J
Add this to the top: App::uses('Security', 'Utility'); On Jan 10, 6:25 pm, jmail wrote: > Hi all! > > I am preparing some login action in my app. I have made view > > <%=$this->Form->create('User', array('action' => > 'login','inputDefaults' => array('label' => false,'div' => false)));%> >      

Re: Fatal error: Class 'security' not found... in cake 2

2012-01-09 Thread Miles J
It should be needed, it defines the package to import from. On Jan 9, 12:12 pm, Daniel wrote: > Thanks.  I'm guessing Utility is not neccessarily needed? > > On Jan 9, 6:15 pm, Miles J wrote: > > > > > > > > > First off, security should be capitali

Re: Fatal error: Class 'security' not found... in cake 2

2012-01-09 Thread Miles J
First off, security should be capitalized. Secondly, import it: App::uses('Security', 'Utility'); On Jan 9, 10:09 am, Daniel wrote: > I imported some code from a cake 1.3 application to cake 2, now I get > an error on the following line: > $this->data['User']['password'] = security::hash($this->

Re: Starting with 1.13 or 2.0

2012-01-08 Thread Miles J
Start with 2.0! On Jan 8, 2:11 pm, Jerome Heuze - HEUZE Production wrote: > Hello Everyone! > Here is my new year resolution - start using CakePHP for my web apps > projects... > > So for me to start should i be using/learning 1.x or 2.x version of > CakePHP? > > You might want to know more about

Re: how to use the formatFileName option of the Uploader plugin of Miles Johnson?

2012-01-08 Thread Miles J
I noticed my docs are a bit out of date, updated them. On Jan 7, 12:02 pm, franck wrote: > Hi guys, > > I am a real newbie in cakephp, I used to play with Symfony. > > I am trying to use the Uploader plugin of Miles Johnson to upload some > pictures and attach them to a table, it sounds very good

Re: how to use the formatFileName option of the Uploader plugin of Miles Johnson?

2012-01-08 Thread Miles J
The function needs to be global, so take it out of the model. On Jan 7, 12:02 pm, franck wrote: > Hi guys, > > I am a real newbie in cakephp, I used to play with Symfony. > > I am trying to use the Uploader plugin of Miles Johnson to upload some > pictures and attach them to a table, it sounds ve

Re: Different localization phrase

2012-01-04 Thread Miles J
Believe its not possible to show them all on one page. Someone correct me if I am wrong. On Jan 4, 6:57 am, "Constantin.FF" wrote: > I need to translate several phrases into different from the current > language. > If I write __('Title') I get it in the current language set in the > session. How

Re: Redirect a user if he wants to see a page when logged in

2012-01-03 Thread J.
Ok I reread some of the above comment, didn't knew what render was, so I searched a little, and this works: Session->check('Auth.User.id')) { echo $this->element('home_logged'); } else { echo $this->element('home'); } ?> Thank

Re: Redirect a user if he wants to see a page when logged in

2012-01-03 Thread J.
'Auth.User.id')) { echo("LOGGED CODE"); } else { echo("NOT LOGGED CODE"); } ?> because in homepage B code there's a lot of other if() {} , and $this- >Html->url and it uses User model in some foreachs. Is there a best way to do this ? Thanks a lot On

Re: Cake optimization

2012-01-02 Thread Miles J
http://milesj.me/blog/read/caching-queries On Jan 2, 10:09 pm, AD7six wrote: > On Jan 3, 6:55 am, Dee Johnson wrote: > > > > > > > > > > > I would like to have somewhere ~1 sec load time > > > I actually figured out the problem though.  When using persistModel = true > > it actually caused ALOT

Re: Display both featured AND last posts.

2012-01-02 Thread J.
s', $this->Post->find('all', array('conditions' => > array('Post.featured' => '1'),'limit' => 10))); > $this->set('posts2', $this->Post->find('all',array('conditions' => > array('Post

Re: Display both featured AND last posts.

2012-01-02 Thread J.
#x27; => 10))); $posts2 = $this->set('posts', $this->Post- >find('all', array('conditions' => array('Post.featured' => '1'),'limit' => 10))); And if I do a it doesn't work... On 2 jan,

Re: Redirect a user if he wants to see a page when logged in

2012-01-02 Thread J.
2/01/2012 14:42, Tilen Majerle ha scritto: > > > > > > > > > you want to display some content only, if user is logged in right ? > > > you can do in a view something like that > > > if ($this->Session->check('Auth.User.id <http://Auth.U

Display both featured AND last posts.

2012-01-02 Thread J.
I want to display both feat. and last posts on my home page. So, in my Pages controller, I have this : $this->loadModel('Post'); $posts = $this->set('posts', $this->Post->find('all', array('conditions' => array('Post.featured' => '1'),'limit' => 10))); and in my v

Redirect a user if he wants to see a page when logged in

2012-01-02 Thread J.
I want to display a complete other homepage when user is logged in, but I don't want him to access the logged out user. I thought I could use something like this : Session->check('Auth.User.id')) { echo("logged"); } ?> and replacing the echo by $this->redirect, but this doesn't work in a View.

Ajaxing a $this->Item->find('all') - twitter style.

2011-12-28 Thread J.
Long story short, I want to display all owned items on profiles, but I don't want to paginate it. Is it possible to display only, like 10 items with a find all, and when the user is scrolling, it lad 10 more, and 10 more etc... like with twitter tweets ? Perhaps with an ajax helper ? Thanks for y

Re: Paginate an array

2011-12-28 Thread J.
   ) >        ); >        $this->set('items', $this->paginate('Item') >    } > > how can this works ?? :D "var" inside method ? :) > -- > Lep pozdrav, Tilen Majerlehttp://majerle.eu > > 2011/12/28 J. > > > > > > > > > Foun

Re: Paginate an array

2011-12-28 Thread J.
Found it. Seems my paginators were deprecated. I used this : Paginator->numbers(); ?> Moreover, the VAR had to be declared before the functions. On 28 déc, 12:29, "J." wrote: > Here is my controller : > > class ItemsController extends AppController { &g

Re: Paginate an array

2011-12-28 Thread J.
> this:http://book.cakephp.org/2.0/en/core-libraries/components/pagination.html > -- > Lep pozdrav, Tilen Majerlehttp://majerle.eu > > 2011/12/26 euromark > > > > > > > > > you are probably looking for > >http://book.cakephp.org/view/1231/Paginatio

Paginate an array

2011-12-26 Thread J.
People here are of great help, so I figured out I may ask here. I have an Item controller (An Item is a post on my website) with this function : public function index() { $this->set('items', $this->Item->find('all', array('limit' => 5 ))); } When in view, I echo it out this like

Re: Use classes from a different controller

2011-12-26 Thread J.
26 déc, 12:38, Tilen Majerle wrote: > http://book.cakephp.org/2.0/en/models/retrieving-your-data.htmllook at > this post :) > -- > Lep pozdrav, Tilen Majerlehttp://majerle.eu > > 2011/12/26 J. > > > > > > > > > Thanks ! This worked : > > > $this

Re: Use classes from a different controller

2011-12-26 Thread J.
as > well > > so it boils down to > $this->Model->ownPosts($uid) > > etc > > On 25 Dez., 19:13, "J." wrote: > > > > > > > > > Hello. > > > I'm building an app derivated from the cakephp blog tutorial. > > > On t

Use classes from a different controller

2011-12-25 Thread J.
Hello. I'm building an app derivated from the cakephp blog tutorial. On the User profils, I want to display which posts they own (my posts have a owner_id field) with a foreach. But to use the classes from my Posts Controller in my UsersController, I used this code : App::import('Controller', '

Re: Using Model constants all over app

2011-12-23 Thread Miles J
Thats the only good way of mimicking enums in PHP. Since constants are static by nature, just call them whereever you need them. If the order class is not in scope within the page, either load the model, or include it with App. Really your only options. On Dec 23, 5:50 am, func0der wrote: > i fou

Re: Organizing Controllers into subfolders in CakePHP 2

2011-12-21 Thread Miles J
Yeah but that doesn't correlate to a 1-to-1 relationship to controllers. I've had apps with 60+ models but maybe only 20-30 controllers. But again it depends on the app. On Dec 21, 12:05 pm, Brad Koch wrote: > So, in summary: > * Don't use subfolders anymore. > * If you want to start making part

Re: Organizing Controllers into subfolders in CakePHP 2

2011-12-20 Thread Miles J
Well my question is, why do you have so many controllers? Secondly, use plugins. Its basically a more advanced replacement for what you need. On Dec 20, 12:41 pm, Brad Koch wrote: > Alright, that makes sense.  Point of clarification, what's the > preferred convention on this now then?  Should yo

Re: i18n extract in plugins cakephp 2.0

2011-12-19 Thread Miles J
app/Plugin//Locale/eng/LC_MESSAGES/.po On Dec 19, 10:20 am, Cayetano Soriano wrote: > Hi i used  the console, for extract .po, from plugin, the problem, is > that I create a directory in my app/Plugins// called > Locale, and copy my .po, but it doesn't work, in app/Locale , it works > perfectly,

Re: best use of var $uses in a controller

2011-12-19 Thread Miles J
What euromark said. If the model is the primary usage within the controller, I use the $uses and any associations off of the user. If I really need an external model, I would use loadModel(). For example in a users controller, only user would be in $uses. On Dec 19, 4:31 pm, euromark wrote: > I

Re: Black hole 404 error with radio buttons

2011-12-14 Thread Miles J
Add this to your before filter. $this->Security->disabledFields = array('selected'); http://milesj.me/blog/read/security-protection On Dec 14, 12:16 pm, eugenefphillips wrote: > I am using CakePHP 1.3, and I keep getting a black hole error.  The > error is happening in the _validatePost functio

Re: Testing image upload

2011-12-12 Thread Miles J
That doesn't actually test if files are uploaded and image transformations worked. On Dec 12, 7:12 am, Matteo Landi wrote: > On Mon, Dec 12, 2011 at 4:46 AM, leigh wrote: > > Hi Matteo, > > > Wrap move_uploaded_file and is_uploaded_file inside the controller > > > function moveUploadedFIle($file

Re: How to Redirect from a Behavior?

2011-12-09 Thread Miles J
Why do you need to go to this page? You could always just use regular PHP: header('Location: /url/'); exit(); On Dec 9, 6:22 pm, zuha wrote: > Ha, I know you'll all say... ah, you're breaking MVC so let me explain > the situation in case anyone cares to have it.  But if you don't, I'm just

Re: FileUploader component

2011-12-09 Thread Miles J
gt; > > But, as far as I am using cake 1.3 and I am a very new in this... I am > > not able to make run anyone of them. > > > Any recomendation? > > > Thanks. > > J. Pablo. > > > -- > > Our newest site for the community: CakePHP Video > > Tuto

Re: request says put instead of post

2011-12-08 Thread Miles J
What are your HTTP headers? On Dec 8, 1:44 pm, euromark wrote: > thats really weird. > happening on windows/wamp - php5.3.8 > maybe some bug? > > the firefox firebug debug data for POST reads: > > Parameter application/x-www-form-urlencoded > _method PUT > data[UserInfo][country_id...    1 > data

  1   2   3   4   5   6   7   8   9   10   >