Re: Is there any way to incldue all models automatically

2011-01-31 Thread Shinya Koizumi
I just took over the project going and was built on cakephp so i need to continue developing on the cakephp. Not going back at the moment. On Sat, Jan 29, 2011 at 1:20 PM, Ryan Schmidt google-2...@ryandesign.comwrote: On Jan 29, 2011, at 05:21, Shinya Koizumi wrote: What other

Re: Numeric Keys with Form Select

2011-01-31 Thread Shinya Koizumi
Hopefully form can be created in oop way, too. $form = new Select(); $form - multiselection = true $form -addItem(1, 'item1'); On Sun, Jan 30, 2011 at 10:27 PM, andy_the ultimate baker anandghaywankar...@gmail.com wrote: hi, ur issue is very often, now use echo $this-Form-

binary tree

2011-01-31 Thread fadh
hallo baker how to create binary tree in cakephp. i only know how to create tree, not a binary tree. thanks. -- 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

Re: binary tree

2011-01-31 Thread Dr. Tarique Sani
If you know how to make a tree then make one where every node has just two (or less) child nodes you will end up with a binary tree. Cheers Tarique On Mon, Jan 31, 2011 at 3:07 PM, fadh e.fad...@gmail.com wrote: hallo baker how to create binary tree in cakephp. i only know how to

Re: binary tree

2011-01-31 Thread fadhli
hi Mr Tarique i use tree only for category. and menu, 1, id 2, parent_id, 3 name, i realy stuck to make binary tree http://book.cakephp.org/view/1339/Tree said To use the tree behavior, your database table needs 3 fields as listed below (all are ints): - parent - default fieldname is

Re: binary tree

2011-01-31 Thread Dr. Tarique Sani
* *Yes tree behaviour is the way to go Start by reading and trying out the examples given at http://book.cakephp.org/view/1341/Basic-Usage It has all the details you need OR better start by understanding what a Binary tree is http://en.wikipedia.org/wiki/Binary_tree Cheers Tarique On Mon, Jan

Re: need help

2011-01-31 Thread Amit Badkas
Hi, By setting 'empty' to false won't display the empty option but you need to set an extra option having label as 'select state', right? For this, set 'empty' = 'select state' instead of false in the 4th argument of select(). Hope that helps. Amit Badkas PHP Applications for E-Biz:

Sorting by a (second level) associated model using paginate helper

2011-01-31 Thread Pete
Dear all, I suspect this is either really easy or very hard. I've been through endless apparently similar questions on here but haven't been able to figure out the answer. I have a Quote model, which I am trying to list in a view. Quote belongsTo Attendance which belongs to Person. I am trying

Error NewBe

2011-01-31 Thread sadeepap
Hi , I am a new comer to Cake and has the following error message in one of my codes. Notice (8): Undefined index: User [APP\controllers \users_controller.php, line 28] Code at users_controller.php ?php class UsersController extends AppController { var $name='Users'; var $uses =

Re: Error NewBe

2011-01-31 Thread Joshua Muheim
You should check first whether your $someone array has a key User before trying to access it: http://php.net/manual/en/function.isset.php This is a PHP issue, not a CakePHP one. :-) On Mon, Jan 31, 2011 at 9:07 AM, sadeepap sadeepa.palliyag...@gmail.com wrote: Hi , I am a new comer to Cake

Re: Error NewBe

2011-01-31 Thread Taffarel de Lima
try some like this $someone = $this-User-find('first', array('conditions'=array('User.username'=$this-data['User']['username'])); should return an array. 2011/1/31 Joshua Muheim psybea...@gmail.com You should check first whether your $someone array has a key User before trying to access

redirecting post data from a form

2011-01-31 Thread ojonam
Hello all, I have a flow in which I have a general form (Form 1), which accepts different types of inputs (each of which is handled by a different controller). So when I get information from the form regarding the type of input, I would like to redirect to the corresponding controller

SecondController extends FirstController extends AppController: not supported? --psybear

2011-01-31 Thread psybear83
Hey everybody I'm refactoring an application with some controllers and wanted to divide them into a group X (that needs some components) and a group Y that needs some other components. My idea: class AppController { var $components = array('Html', 'Form'); } class XController extends

Re: SecondController extends FirstController extends AppController: not supported? --psybear

2011-01-31 Thread Tilen Majerle
Yes this is true, cakephp check if parent controller of 'SomeController' is 'AppController' but in your case this is 'XController' btw: for your applications probably more than 80% did the community...u 've made here probably 1000 noob's questions -- Lep pozdrav, Tilen Majerle

Re: Select Box - Table or Tinyint?

2011-01-31 Thread LipeDjow
For these cases I use the array_source DataSource (https://github.com/ cakephp/datasources). It allows us to use an array as if it were a database, allowing even the relationships between models. I recommend a look. HTH. LipeDjow -- Our newest site for the community: CakePHP Video Tutorials

Containable Query Slow - Am I doing it wrong?

2011-01-31 Thread TimG
Hey, This code below works well but the query is really slow. It adds five seconds more to the page request time. Am I doing something wrong or is it just the way it is? Also, is there a way to do this with a custom query and would it be any quicker? Thanks in advance!

Re: Containable Query Slow - Am I doing it wrong?

2011-01-31 Thread Jeremy Burns | Class Outfit
Looks alright. What are the indexes and relationships like on the db? Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 31 Jan 2011, at 17:23, TimG wrote: Hey, This code below works well but the query is really slow. It adds five seconds more to the page

Re: Containable Query Slow - Am I doing it wrong?

2011-01-31 Thread Tilen Majerle
i think (i'm not sure), but in contain key you should not use 'fields', 'conditions' and so on keys, because this you should do when you make a model associations, so you should do just this {{{ $this-Category-Behaviors-attach('Containable'); $tempCategories = $this-Category-find('all', array(

Re: Containable Query Slow - Am I doing it wrong?

2011-01-31 Thread Jeremy Burns | Class Outfit
AFAIK there is no problem using a fields key inside 'contain'. It's a good way of drawing back less data. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 31 Jan 2011, at 17:33, Tilen Majerle wrote: i think (i'm not sure), but in contain key you should not

Re: Containable Query Slow - Am I doing it wrong?

2011-01-31 Thread Tilen Majerle
ok, thanks for this informations... :D -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/1/31 Jeremy Burns | Class Outfit jeremybu...@classoutfit.com AFAIK there is no problem using a fields key inside 'contain'. It's a good way of drawing back less data. Jeremy Burns *Class Outfit*

Re: SecondController extends FirstController extends AppController: not supported? --psybear

2011-01-31 Thread Jamie
Yeah, if you want to have an indeterminate depth of nested controllers (which is fine), and you want to use Cake's component merging stuff, then as far as I can tell you'll have to implement your own version of Controller::__mergeVars() in your AppController class. - Jamie On Jan 31, 6:24 am,

Re: redirecting post data from a form

2011-01-31 Thread Warren
Another alternative would be save the data you need in the other controller to the session using the session component which makes the data available anywhere. You could create a temporary session key, store it there, then when you are done with it, delete the session data. On Jan 31, 5:42 am,

Re: Containable Query Slow - Am I doing it wrong?

2011-01-31 Thread TimG
Here is the model for Category: var $hasAndBelongsToMany = array( 'Product' = array( 'className' = 'Product', 'joinTable' = 'categories_products', 'foreignKey' = 'category_id', 'associationForeignKey' = 'product_id' )

Re: Select Box - Table or Tinyint?

2011-01-31 Thread Stephen
Hi LipeDjow This may be a noob question, but how do you use the array_source DataSource? Can you provide an example usage for this scenario. -- Kind Regards Stephen @ NinjaCoderMonkey www.ninjacodermonkey.co.uk -- Our newest site for the community: CakePHP Video Tutorials

Re: need help

2011-01-31 Thread cricket
On Mon, Jan 31, 2011 at 7:37 AM, Amit Badkas amit.sanis...@gmail.com wrote: Hi, By setting 'empty' to false won't display the empty option but you need to set an extra option having label as 'select state', right? For this, set 'empty' = 'select state' instead of false in the 4th argument of

Re: Configuration

2011-01-31 Thread cricket
On Sun, Jan 30, 2011 at 11:55 AM, tom tb...@live.co.uk wrote: Create a database table with the correct fields, perhaps called 'Settings'. You can then create (or bake) a model and controller to go with the table. The controller only needs an edit action. The action should get the id for

Re: Configuration

2011-01-31 Thread elias
Hi, Everyone, thanks a lot for all this information! Given the fact that the id could change, I have changed tom's tutorial (thx!) a bit, making it able to function without the core.php editing and being more flexible. (When you add a new field in the database, it automatically get's added to

Re: Configuration

2011-01-31 Thread elias
And I also see that I still have an error when visiting other controllers/models then settings :). Let's see if I can fix it, then I will re update my code. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site

Re: Configuration

2011-01-31 Thread elias
It was easy. I just had to use loadModel to make sure the Setting model is loaded, also in different controllers. ?php class AppController extends Controller { function beforeFilter() { * $this-loadModel('Setting');* $this-pfSettings = $this-getSettings();

Re: Is there any way to incldue all models automatically

2011-01-31 Thread elias
This is probably the answer what you are looking for: *$this-loadModel('modelname');* Of course replace modelname with the model you want to load, (singular). Just had to use it myself :). -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new

Re: Configuration

2011-01-31 Thread elias
And for the cache to work, this would be the completed code :p. ?php class AppController extends Controller { function beforeFilter() { $this-loadModel('Setting'); $this-pfSettings = $this-getSettings(); $this-set('site_name', $this-pfSettings['name']); }

Re: Configuration

2011-01-31 Thread elias
And to make it complete, my last update.. :). You would want to put LoadModel inside the if that checks if the cache is still existing. Otherwise it just adds overhead, and their is no point in using the cache. This is the code: ?php class AppController extends Controller { function

Re: Please help me! almost got crazy...with Tree behavior..

2011-01-31 Thread rahul jeevan
hi wat is the actual problem On Mon, Jan 31, 2011 at 11:15 AM, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: He had $actAs instead of $actsAs, so the behaviour wasn't loading. It's a common mistake. Jeremy Burns *Class Outfit* * * jeremybu...@classoutfit.com

$html-image no show

2011-01-31 Thread ugarch
Hello, (I am new in CakePHP) I setup a cake project on my local. http://localhost/~Alejandro/Alvaro/ I'm running MacOs Snow Leopard. I already set my Alejandro.conf: DocumentRoot /Users/Alejandro/Sites/ Directory /Users/Alejandro/Sites/ Options Indexes MultiViews FollowSymlinks

Newbie file upload question

2011-01-31 Thread Paul Wheatley
Hi, Very new to CakePHP and my first post here, I am loving Cake so far but have run up against a small hurdle. Can anyone point me in the direction of instructions on creating a form with a file upload field? It's for a registration form where the user uploads normal stuff (name, address,

Re: Please help me! almost got crazy...with Tree behavior..

2011-01-31 Thread Jeremy Burns | Class Outfit
He was getting errors when calling a Tree helper method. As the array of helpers was set up incorrectly ($actAs instead of $actsAs) the helper wasn't loaded, so the method failed. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 31 Jan 2011, at 13:19, rahul

Re: Newbie file upload question

2011-01-31 Thread newguy
Hi there This should be helpful: http://cakebaker.42dh.com/2006/04/15/file-upload-with-cakephp/ thanks On Jan 31, 12:00 pm, Paul Wheatley mr.paul.wheat...@hotmail.com wrote: Hi, Very new to CakePHP and my first post here, I am loving Cake so far but have run up against a small hurdle. Can

Re: Newbie file upload question

2011-01-31 Thread Sam Sherlock
If your getting started with file uploads looking at existing code could help you get started - otherwise you should ask a more specific question :) its simple so long as you don't use swfupload; here are some links

Has anyone used Geonames without webservice?

2011-01-31 Thread Dave Maharaj
Just wondering is anyone has used the geonames database with cake but with own database, not thru webservices? I know it's a monster database in size but I do not like the idea of using a service that's not on my own server. If it goes down then it affects my site so just curious if anyone has

app_controller not allowing inheritance into child controllers for Auth ?

2011-01-31 Thread OldWest
I have my UsersController which of course extends my app_controller. In my app_controller I have my $components defined as such: $components = array('Acl', 'Auth', 'Session', 'RequestHandler'); When I try to access my users index view, I get an error (which means that the Auth component has

AjaxHelper

2011-01-31 Thread elias
I tried searching for tutorials on the web, but I couldn't find any. Maybe I am using the wrong keywords, but I hope someone here, could help me out. I have a blog - like model, and a tag model, that is associated with it (hasMany). So I can assign tags to new posts. But adding a new tag, makes

Re: AjaxHelper

2011-01-31 Thread Shinya Koizumi
How about setting up a new input box tag with add button and add tags to hidden input so when save the post on submit it is available from control and don't need to use any ajax but javascript in client side? On Mon, Jan 31, 2011 at 1:28 PM, elias elias.leco...@gmail.com wrote: I tried

Re: Has anyone used Geonames without webservice?

2011-01-31 Thread Shinya Koizumi
I think it's difficult to download all the stuff in local and how do you maintain? I think google map api is your best choice. What you can do is save the unique query( keyword and resolved lat,lon ) in database so that for popular places you don't always have to go to web service . On Mon, Jan

Internationlization Doesn't Seem to Work.

2011-01-31 Thread andrewperk
Hello, I'm trying to get my application to use a different language using cake's i18n. I believe I have my application set up properly. core.php Configure::write('Config.language', 'ger'); Posts Controller Flash message: $this-Session-setFlash(__('You must be registered before you can ask a

Re: $html-image no show

2011-01-31 Thread cricket
On Mon, Jan 31, 2011 at 8:27 AM, ugarch ugarc...@gmail.com wrote: Hello, (I am new in CakePHP) I setup a cake project on my local. http://localhost/~Alejandro/Alvaro/ I'm running MacOs Snow Leopard. I already set my Alejandro.conf: DocumentRoot /Users/Alejandro/Sites/ Directory

Re: app_controller not allowing inheritance into child controllers for Auth ?

2011-01-31 Thread cricket
On Mon, Jan 31, 2011 at 4:02 PM, OldWest ja...@jasonwydro.com wrote: I have my UsersController which of course extends my app_controller. In my app_controller I have my $components defined as such: $components = array('Acl', 'Auth', 'Session', 'RequestHandler'); When I try to access my

Re: $html-image no show

2011-01-31 Thread ugarch
Thank you very much for your response ... I liked the element idea but my problem is that sometimes in the banner div i need to place images and sometimes videos or a picture slider. That is why I decided to set the $banner from the controller the way I did. But my problem is more related to paths

Re: $html-image no show

2011-01-31 Thread cricket
On Mon, Jan 31, 2011 at 8:23 PM, ugarch ugarc...@gmail.com wrote: Thank you very much for your response ... I liked the element idea but my problem is that sometimes in the banner div i need to place images and sometimes videos or a picture slider. You could set a variable, eg. $banner_type,

Views with Joined Models

2011-01-31 Thread Hill180
I am sorry for the basic question.. but here goes. I will use Blog Posts as an Example I have the following models: Author Post Tags All the associations are fine as the scaffold pages are working without a problem. I have a page under the Author Controller the standard view: function

Re: Sorting by a (second level) associated model using paginate helper

2011-01-31 Thread javier ader
Hi. I am not sure, but why about: echo $this-Paginator-sort('Name', 'Person.first_name'); (that is, without prefix Attendance; btw, the normal sintax for this parameter is Model.Field, not Model1.ModelRelated2.ModelRelated3Field) -- Our newest site for the community: CakePHP Video

Re: $html-image no show

2011-01-31 Thread Sam Sherlock
I had cake working in a windwow 2k dir ages ago but twice on xp and currently windows 7 users dir cake just does not work for me when I nearly had it once paths to images would be tricky so sticking with vhosts :) - S On 1 February 2011 02:11, cricket zijn.digi...@gmail.com wrote: On

Uploading Image with MeioUpload and No Table

2011-01-31 Thread Arak Tai'Roth
Hey there, So, something I've been stumbling around for a little bit now and can't seem to find any references regarding. I am using MeioUpload for my image file upload behaviour. It's working great, no issues there. However, I am now using it on a form that isn't linked to a database, as no

Re: SecondController extends FirstController extends AppController: not supported? --psybear

2011-01-31 Thread Ryan Schmidt
On Jan 31, 2011, at 08:24, psybear83 wrote: I'm refactoring an application with some controllers and wanted to divide them into a group X (that needs some components) and a group Y that needs some other components. My idea: class AppController { var $components = array('Html', 'Form'); }

Re: CakePHP 1.3.7 released

2011-01-31 Thread mark_story
I've not heard of this issue. Has anyone bothered to open a ticket for it? Issues without tickets never get fixed :) -Mark On Jan 28, 7:33 am, Sergei yatse...@gmail.com wrote: Thanks, looks good. However, model-delete() is still broken, generates wrong join if it hasmany. S. On Jan 20,

Re: Containable Query Slow - Am I doing it wrong?

2011-01-31 Thread Dr. Tarique Sani
Paste the query(s) that is being generated Cheers Tarique On Mon, Jan 31, 2011 at 11:47 PM, TimG t...@gurske.com wrote: Here is the model for Category: var $hasAndBelongsToMany = array( 'Product' = array( 'className' = 'Product', 'joinTable' =

Re: Has anyone used Geonames without webservice?

2011-01-31 Thread Dr. Tarique Sani
Unless you find a way to cache the query results the queries are going to be slow - specially if you are doing precise calculations. Another trick would be to use your database only as a fallback when the webservice is not available Cheers Tarique On Tue, Feb 1, 2011 at 2:02 AM, Dave Maharaj

Re: Views with Joined Models

2011-01-31 Thread Dr. Tarique Sani
Your Author model needs to be related to Post model - Author hasMany Post and then $this-set('author', $this-Author-read(null, $id)); Do a debug on your author array in your view and figure out what is happening :-) Cheers Tarique On Tue, Feb 1, 2011 at 3:49 AM, Hill180 hill...@gmail.com

Re: Views with Joined Models

2011-01-31 Thread hill180
My apologies for not explaining better: Controller: The view has the following: $this-set('author', $this-Author-read(null, $id)); The View Contains the Following ?php $i = 0; foreach ($author['Post'] as $post): $class = null;

Re: Sorting by a (second level) associated model using paginate helper

2011-01-31 Thread Amit Badkas
Hi, As per the code at http://api13.cakephp.org/view_source/controller/#l-1060and http://api13.cakephp.org/view_source/controller/#l-1128 , I don't think paginate() can sort using the field of model which has more than one level deep relation with the paginated model. Amit Badkas PHP

Re: Views with Joined Models

2011-01-31 Thread Amit Badkas
Hi, You need to get posts alongwith their tags for a single author, right? Attach 'containable' behavior to AppModel (or the Author model, as per your need) and in controller's action, put the code something like $this-Author-contain(array( 'Post' = array(