Re: help me about association query

2010-03-17 Thread vcrack
I did try your code but it's return all data business and related data business.. I want to find all category and in array category contain all related business but have X city.. my model.. models/business.php class Business extends AppModel{ var $name = 'Business'; var $belongsTo =

RE: help me about association query

2010-03-17 Thread Alan Asher
I might need to see your models but you probably need to do something like this. $this->Business->find('all,array('conditions'=>array('Business.city'=>$city) ,'contain'=>array('Category'))); The contain clause will make sure to limit your search results to have only categories (as well as the bus

help me about association query

2010-03-17 Thread vcrack
my code I have model Business and model category. i want to find business for all category but from X city.. $this->Business->Category->find('all', array('conditions' => array('Business.city' => $city))); error message : SQL Error: 1054: Unknown column 'Business.city' in 'where clause' I'm sure

Re: Model association through user_id

2010-03-17 Thread abocanegra
Thank you for the response. I was able to get it working finally by the following code int he postscontroller under the add function. $users = $this->Post->User->find('list', array('fields' => array('User.username'))); $this->set(compact('users')); Thanks On Mar 17, 7:27 pm, cric

Re: Model help

2010-03-17 Thread Jeremy Burns
The secret lies in setting up your models correctly. You also will find life easier if you use the field name 'name' instead of 'label'. Doing this means that you can easily create drop downs populated with 'id' and 'name' where 'name' is the displayed value. This is the default Cake convention.

Re: PHP 5.3 open short tag does't working on cakePHP 1.2.6

2010-03-17 Thread LunarDraco
Not sure what editors your using but as soon as I type leaving my cursor ready to enter php commands. I can't remember the last time I worried about typing to many chars. Other than posts and email! ;) I'm sure that some may complain that eclipse is a bloated IDE for simple php editing, and they m

Re: Ideas to manage open voting

2010-03-17 Thread LunarDraco
I'd say without a login that is verified against a real email with a postback token verification there is no real way to do this. You could store a cookie in the browser, which could be cleared by the user and re-vote. You could tie it to the IP like you suggest, but the IP your server see's is onl

Model Associations - just feels wrong

2010-03-17 Thread TheHerk
Here is a link to a screenshot of a class diagram I am working on, with noted model associations. There are several relationships in the diagram that feel wrong to me. The one in the diagram that illustrates this is between ZipLocation and State. In this case, state is enumerated in its own table.

Model help

2010-03-17 Thread Andrew
Hello, Thank you for your time, I am a new user of CakePHP. I recently found CakePHP and am still trying to get used to the MVC architecture. (By the way, it's brilliant). However I'm still getting used to reformatting my SQL into cakephp. My question is as follows. I have an SQL statement that (

Re: Model association through user_id

2010-03-17 Thread cricket
In User model: var $displayField = 'username'; Then find('list') will return an array as id => username On Mar 17, 8:50 pm, abocanegra wrote: > I am trying to learn more about associating through models. My current > issue is that I am attempting to design the post add function that I > created

Model association through user_id

2010-03-17 Thread abocanegra
I am trying to learn more about associating through models. My current issue is that I am attempting to design the post add function that I created following the tutorial so that I can select the user by username rather than user_id. I want to have the value of the drop down be user_id and the opti

Re: different types of Users

2010-03-17 Thread nurvzy
You might find prefixes useful for your solution. You can set prefixes for actions and then only allow users of that group to access those actions. That wouldn't require the ACL and might be what you're after (separation of group logic). In 1.3 you'd set different prefixes in your core.php file

Re: Complex form with fields belonging to fields that belong to the top table

2010-03-17 Thread Gillian
Me going at it from completely the wrong direction from the start makes it make so much more sense. Thank you! On Mar 17, 4:18 pm, cricket wrote: > Grab a list of the types in the CompaniesController: > > $this->set('types', $this->Company->CompanyType->find('list')); > > That produces an array

Re: Problem creating elements with "BAKE"

2010-03-17 Thread cricket
My guess is this is due to CLI version of PHP not having mysql compiled in, or something like that. On Mar 17, 7:03 pm, marcoR-IT wrote: > Hi, > When I try to create some element with the "BAKE" command (Model, View > or Controller), the following message is displayed: > "Fatal error: Call to und

Re: htaccess issue

2010-03-17 Thread cricket
Assuming that your DocumentRoot is above /app, in the *top- level* .htaccess (ie. outside the app dir), add a condition to not rewrite the URL if the request is for the /dev dir: RewriteEngine on RewriteCond%{REQUEST_URI}!^/dev/ RewriteRule^$ app/webroot/[L] RewriteRul

Re: Complex form with fields belonging to fields that belong to the top table

2010-03-17 Thread cricket
Grab a list of the types in the CompaniesController: $this->set('types', $this->Company->CompanyType->find('list')); That produces an array with the PK as key and the name as value. If your table column is not 'name' you should specify it in the CompanyType model: var $displayField = 'your_colum

Re: Mod rewrite to root

2010-03-17 Thread cricket
Use a route: Router::connect( '/:number_code', array( 'controller' => 'numbers', 'action' => 'view' ), array( 'number_code' => '[0-9]{3}-[0-9]{3}-[0-9]{4}', 'pass' => array('number_code') ) );

Problem creating elements with "BAKE"

2010-03-17 Thread marcoR-IT
Hi, When I try to create some element with the "BAKE" command (Model, View or Controller), the following message is displayed: "Fatal error: Call to undefined function mysql_query() in /var/www/ html/webroot/cake/libs/model/datasources/dbo/dbo_mysql.php on line 588" info: database controller: "mys

Re: I have exactly the same error at the same step of the blog tutorial

2010-03-17 Thread cricket
http://catb.org/~esr/faqs/smart-questions.html On Mar 17, 2:36 am, 1001net wrote: > I am using ubuntu 9.04 > > Does anyone has any answer? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are

Re: different types of Users

2010-03-17 Thread cricket
Thanks, all, for the responses. I guess I should have mentioned that I've used ACL before, for an intranet to allow a company's affiliates log in and access many types of files. The requirement was that each group be shown (and be able to download) only certain folders/files. I used ACL and a tree

Re: Ideas for architecting a generic "Payment Gateway" in cake

2010-03-17 Thread Jon Bennett
> 4. different component per gateway I've gone this route, but it's quite hard coded into the all, and certainly the database. if you find a nicer way, I'd be interested. J -- jon bennett - www.jben.net - blog.jben.net Check out the new CakePHP Questions site http://cakeqs.org and help others

htaccess issue

2010-03-17 Thread Dave
I have my app in the folder root. Now i need to make a dev folder in the root also so it i type in site/dev i go to my dev folder not the cake /root /app /cake and /dev How can i do this? Thanks Dave Check out the new CakePHP Questions site http://cakeqs.org and help other

Complex form with fields belonging to fields that belong to the top table

2010-03-17 Thread Gillian
I'm pretty new to Cakephp, so this could be rather simple and I'm just missing it. I'm attempting to set up a form that deals with a lot of tables and models. At the moment, I've set up the company model so that is hasmany company types, and the company_types table so it belongsto company. And i

Ideas to manage open voting

2010-03-17 Thread Amit
I'm working on a site that's going to let people vote on submissions. To encourage interaction I want to let anonymous users vote, but I still want to limit unique visitors to one vote. I know I won't be able ensure 100% adherence unless I require some sort of login, but allowing for this what shou

Re: Tips on performance monitoring / profiling

2010-03-17 Thread Jon Bennett
> Whilst there is the core cache library which is great, do you use any > kind of component in front of this to abstract it?  Or is it a case of > manually checking whether the cached element exists in your controller > action and then if not fetching from the DB? check out Andy Dawson's MiCache a

Mod rewrite to root

2010-03-17 Thread thankyou
Hi , I have a cakephp application where there's a link: http://www.mywebsite.com/numbers/view/112-332-3322 -- BTW...there are a variety of numbers after view/ not just 112-332-3322 I would like to make that viewable to the users as: http://www.mywebsite.com/112-332-3322 Is there a way to use mod-

Intergrating PHPCake into CMS

2010-03-17 Thread Ben
Hello Has everyone had any experience using PHPCake with an Open Source CMS such as silverstripe? Any recommendations you have would be appreciated. Regards Ben Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this m

Re: Tips on performance monitoring / profiling

2010-03-17 Thread Jon Bennett
hi Alex, >> In terms of profiling - it sounds like its the DB that's being >> sluggish, how many hits are you getting? on what spec server? if you >> have access you could run >> http://www.webdevelopmentstuff.com/123/optimizing-mysql-performance-tuning-script.html >> to try and optimise your mysq

Re: different types of Users

2010-03-17 Thread Martin Duris
one of the key to understand is to know how ACL works - tree structure - than its just question of time, to get everything work 2010/3/17 Alejandro Gomez Fernandez : > I'm new usign cake, but not designing information systems in different > platforms, even web. > I think the solution to your dilem

Re: Tips on performance monitoring / profiling

2010-03-17 Thread Christian Leskowsky
You might want to give YSlow / Page Speed a try too. They often turn up an area or 2 worth looking into. On Wed, Mar 17, 2010 at 2:04 PM, Alex Bovey wrote: > On Wed, Mar 17, 2010 at 5:23 PM, Jon Bennett wrote: > >> Has anyone got any tips on performance monitoring and profiling a cake > app? >

Re: Tips on performance monitoring / profiling

2010-03-17 Thread Alex Bovey
On Wed, Mar 17, 2010 at 5:23 PM, Jon Bennett wrote: >> Has anyone got any tips on performance monitoring and profiling a cake app? > > In terms of profiling - it sounds like its the DB that's being > sluggish, how many hits are you getting? on what spec server? if you > have access you could run >

Re: Tips on performance monitoring / profiling

2010-03-17 Thread Jon Bennett
> Has anyone got any tips on performance monitoring and profiling a cake app? In terms of profiling - it sounds like its the DB that's being sluggish, how many hits are you getting? on what spec server? if you have access you could run http://www.webdevelopmentstuff.com/123/optimizing-mysql-perfor

Re: Tips on performance monitoring / profiling

2010-03-17 Thread Jon Bennett
hi Alex, > Has anyone got any tips on performance monitoring and profiling a cake app? > > I'm using containable and number of queries doesn't look too bad but > it's all running pretty slowly at the moment. Use containable, explicitly set the fields you need in every model, tune your database ht

Re: different types of Users

2010-03-17 Thread Alejandro Gomez Fernandez
I'm new usign cake, but not designing information systems in different platforms, even web. I think the solution to your dilemma is using ACL. Yes, I know is at the beginning difficult to understood and implement, but it was designed speciffically to solve this problem. It permits you to assign dif

Re: Subdomain Auth Problem

2010-03-17 Thread Sergey Yalansky
1. Open file cake/libs/session.php 2. Find method __initSession() 3. Comment two lines with ini_set('session.referer_check', $this- >host); 4. Add ini_set('session.cookie_domain', '.yourdomain.com'); before switch (Configure::read('Session.save')) { 5. Clear all cookies in browser for your domain

I have exactly the same error at the same step of the blog tutorial

2010-03-17 Thread 1001net
I am using ubuntu 9.04 Does anyone has any answer? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to ca

Re: .htaccess, possible helpful info for mac users

2010-03-17 Thread dreamingmind
Here's a bit more detail that has turned up: Things are only working at this point from the VirtualHost I set up for the Cake Blog tutorial. My directory /Users/username/Sites/ cakeblog can be accessed simply as "http://cakeblog";. The VirtualHost is set up like this: In httpd.conf add this - Na

Re: different types of Users

2010-03-17 Thread piousbox
First, take a look at ACL component. If you can make it work, that's what you need. (Although it's really confusing, and I don't use it for my needs). If you decide to not use ACL, you'll use Auth component (that's just being able to login; you'd use it with ACL, too), then store your user.id in a

Ideas for architecting a generic "Payment Gateway" in cake

2010-03-17 Thread keymaster
I'd like to build a generic payment interface in cake with the ability to easily plug-in several different gateway implementations. The stubs would be things like: Authorize.Net, LinkPoint, Verisign, paypal, GoogleCO, 2CO, etc. I'm not sure which of several architectural approaches to choose with

Re: Data Validation not working

2010-03-17 Thread logout
I also vote for problems in the path/filename. Be sure exactly what file you edit (the model) - I had exactly the same problem - it turned out that i was editing a wrong file. When I opened the correct one, all worked fine. Your file for the model is inventory.php in the app/models, right? Check

Tips on performance monitoring / profiling

2010-03-17 Thread Alex Bovey
Hi all, Has anyone got any tips on performance monitoring and profiling a cake app? I'm using containable and number of queries doesn't look too bad but it's all running pretty slowly at the moment. Thanks, Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England &

Re: A question about updateAll()

2010-03-17 Thread logout
Well, I figured it out... The key is in the getAffectedRows() function. So, the function now is reduceCredits($id, $amount) { if($this->updateAll( array( 'Manager.credit' => "Manager.credi

A question about updateAll()

2010-03-17 Thread logout
Hi everyone, I have a question regarding the updateAll() function. I use it to reduce or increase credits (not surprisingly) but I have an issue: how can I be sure that all went well. What I mean: I have a method reduceCredits($id, $amount), which is like that: return $this->upd

Re: different types of Users

2010-03-17 Thread Martin Duris
Using ACL can be very confusing, but it also can be usied to create simple accesing rules - you have 3 groups (maybe 4 when couting even visitors - ACL should work fine with that - its just point of view) but i didnt understand completly your problem - you vae problem with that, you dont know what

Re: PHP 5.3 open short tag does't working on cakePHP 1.2.6

2010-03-17 Thread anak newbie
Why i am not thinking to replace short tags using bash script before, damn! Thanks to cricket and piousbox, it's cut my headache :D Surely, i will email if can't find how to replacing with closing tag. Ok, right now there are some people have same thought with me. So i will share my opinion : IM

Re: multiple many to many tables between the same tables cakePHP

2010-03-17 Thread John Tadros
Hello All, Thanks for your replies. But to make sure that I get things right, you mean that I should create a table called "Ratings" and a table called "Privacies" and link "users" and "musics" each with a Many to many relations to each of Ratings and privacies ? Actually in my case, the table mu

Re: simple image gallery

2010-03-17 Thread WebbedIT
$200 for a simple (your choice of name) module/plugin built on an open- source framework, doubt you'll get many takers within this community. Especially when there is no way to preview/demo it without first sending you contact details! The idea of an open-source community built on an open-source f

Re: Help a noob with a session(?) issue

2010-03-17 Thread jorgt...@gmail.com
For anyone who comes across this later, the errors went away when I switched the cache engine in core.php to memcached :) On 16 Mar, 09:07, "jorgt...@gmail.com" wrote: > The tmp directories aren't affected, I only upload the controllers/ > views/layouts that I've modified. The tmp dirs are stil

Re: not working contact grabber in cake

2010-03-17 Thread WebbedIT
That looks like a non cake path to the files generating the errors. What is this contact grabber? Is it a cake plugin or vendor app? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscri

Re: Data Validation not working

2010-03-17 Thread WebbedIT
@sooraj: If using the form helper it automatically includes validation errors unless your suppress it by setting error=>false Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to t

Re: multiple many to many tables between the same tables cakePHP

2010-03-17 Thread WebbedIT
They are two relations so you have two join tables, you just need to define different join tables in each association, plus you need to create a model for the ratings join model as Mateo states above to allow for the rating attribute. HTH Paul Check out the new CakePHP Questions site http://cake

Re: different types of Users

2010-03-17 Thread WebbedIT
My site has Site Manager, Site Admin, Organisation Manager, Organisation Admin, Member and I manage them using a UserGroup model. I then use Auth and set IsAuthorize methods in my controllers to determine who can and can't do what. I found ACL to complex for my needs. HTH Paul Check out the new

Re: Problema con safe_mode y creacion directorio/subdirectorios

2010-03-17 Thread josu jauregui
Gracias por las respuestas. La posibilidad de tener los directorios creados previamente no es posible dado que parte de estructura de directorios se tiene que generar dinámicamente. 8-( He estado mirando y el entorno en el que se implantará la app no tiene safe_mode activado así que en principio no

Re: Validation issues for Contact form (doesn't use database)

2010-03-17 Thread WebbedIT
Haven't read the post in full but think I have something that will help. I have a recurring comments form at the bottom of various modules across my portal site and I created it with the following: $form->create(null, array('url'=>array('action'=>'comment', '#commentForm'), 'id'=>'commentForm'));

Re: Adding a new counter cache

2010-03-17 Thread WebbedIT
Nice idea, thanks for that :) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.co

yui help?

2010-03-17 Thread sooraj francis
I am using cake php and yui. i have a json format data displayed in my view file. now i have to acess those json data using yui datasource My link to page is http://localhost/SPCake/listings/serverpagination/ but this code doesnot seeems to work. var myDataSource = new YAHOO.util.DataSource("ur