Re: Question about relationships, extending the blog tutorial

2010-02-23 Thread WebbedIT
^^ What @Andy says is right. Simple rule of thumb for hasMany/hasOne - belongsTo relationships ... whichever model your foreign_key is in, it belongs to the other model. Welcome to CakePHP, it should make learning complex PHP a lot easier for you. I sometimes wish I hadn't taught myself a lot

Re: After the Cake is baked...

2010-02-23 Thread WebbedIT
Is your website's subject matter a particularly sensitive/illegal one? If not then I'm unsure what you're worried about? There's possible compliance with Disability Discrimination Act, Distance Selling Regulations and a few terms and conditions to state that user contributed content contains the

Re: Tree Behaviors, Move Functions

2010-02-23 Thread WebbedIT
@Ross: glad to hear there is a glimmer of hope now :) @Hiero: I'm not using 1.3, but confident that the core will not be the issue. 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: Another saveAll() problem

2010-02-23 Thread WebbedIT
You state that the associations follow: Paper hasMany Chart Paper hasMany Table Paper hasMany Document Yet your model defines hasOne associations, and all associate to the same model without any info on their foreign key, conditions etc? You need to clarify your associations are correct

Need help with custom validation please

2010-02-23 Thread mivogt-LU
hi there, I have some problems doing my first cake and adding some validation methods on my own. It would be great if someone in here might give me a good start and help me to do my first steps ... I am using 2 models linked with each other lodgings : id, roomnumber, amountofbeds, ...

Re: Need help with custom validation please

2010-02-23 Thread Jeremy Burns
The data is accessible via $this-data. If you debug it you'll see the shape of the array so you check values within it (something like $this-data['Model']['field']. Your custom validation function should return either true or false. If it returns false, your validation error should be set for

how to adress specific data from related models?

2010-02-23 Thread mivogt-LU
I am newbie to cakephp and after some looking up in books and google I need still help to start with cake... I try to do my first application and am using several models linked to tables and with relations between the models. i.e. model lodgings with the numberOfBeds and a model

Re: Answering a recurring challenge from clients

2010-02-23 Thread WebbedIT
@Zaky: I think you missed a very important point before having a dig at various developers in the CakePHP community. The question was about a client asking for Drupal, so we're not talking about a Mail Server are we? I am 150% certain that everyone in the community would use an established Mail

Re: how to adress specific data from related models?

2010-02-23 Thread Jeremy Burns
Turn on debugging (Configure::write('debug', 2); within /app/config/core.php) and type debug($this-data); (and perhaps die; as well) at the top of your controller function and you'll see exactly what's been posted. Then it's a case of accessing the right part of the array to get the values you

Re: Need help with custom validation please

2010-02-23 Thread mivogt-LU
Hi Jeremy, thank you, might I ask if I got the point: .. (something like $this-data['Model']['field']. .. my database table is namedbooking_positions my php file fot the model named booking_position.php so I have to use $this-data['booking_positions']['amountofadult'] ? TNX Michael On

Re: Answering a recurring challenge from clients

2010-02-23 Thread Jeremy Burns
In my experience, clients always want more than the original scope, always want something very personal to their set up and always want to extend it later - especially when they see first hand what is possible. I agree that Wordpress is the right tool for some cases (especially where there is

Re: Need help with custom validation please

2010-02-23 Thread Jeremy Burns
Probably - it sounds right. Debug $this-data and check. Jeremy Burns jeremybu...@me.com (Skype) +44 208 123 3822 (jeremy_burns) (m) +44 7973 481949 (h) +44 208 530 7573 On 23 Feb 2010, at 08:47, mivogt-LU wrote: Hi Jeremy, thank you, might I ask if I got the point: .. (something like

Re: Need help with custom validation please

2010-02-23 Thread mivogt-LU
Great it works. Thank u so much, Jeremy!! It took me hours for try and error with no result - now the solution is easy and clear and logical :) Think I 'll never forget the mistake and the right way. Thank u again. Michael On 23 Feb., 09:54, Jeremy Burns jeremybu...@me.com wrote: Probably - it

Re: how to adress specific data from related models?

2010-02-23 Thread mivogt-LU
Hello again, Jeremy, sadly inside the posted data there is only the lodging_id. How do I get the value for numberofbeds fromthe lodging-model? As the validation is inside the bookingpositions model and the bookingpositions model only has the lodging_id how do i get the attribute numberofbeds

Re: Data is not saved

2010-02-23 Thread WebbedIT
As John advises, conform to Cake's naming conventions and the problem should sort itself out. http://book.cakephp.org/view/22/CakePHP-Conventions If you were confirming your form should be: echo $form-create(Dealer); echo $form-input(Dealer.name); echo $form-input(Dealer.address); echo

Re: Tree Behaviors, Move Functions

2010-02-23 Thread Ross Haggart
Thanks for your help, if i find anything, i'll update this post. On 23 February 2010 08:13, WebbedIT p...@webbedit.co.uk wrote: @Ross: glad to hear there is a glimmer of hope now :) @Hiero: I'm not using 1.3, but confident that the core will not be the issue. Check out the new CakePHP

Re: how to adress specific data from related models?

2010-02-23 Thread WebbedIT
If I understand your model and field names correctly, after submitting your BookingPosition form which includes the field Lodging.id, you should be able to use: $numberOfBeds = $this-BookingPosition-Lodging-field('numberOfBeds', array('Lodging.id'=$this-data['Lodging']['id'])); For more info on

Re: Need help with custom validation please

2010-02-23 Thread WebbedIT
Your data should have been available at: $this-data['BookingPosition']['amountofadult'] not $this-data['booking_positions']['amountofadult'] Just clarifying this in case other newbies read this post and get confused. Paul. Check out the new CakePHP Questions site http://cakeqs.org and help

Re: Need help with custom validation please

2010-02-23 Thread Jeremy Burns
Good spot Paul - I replied too quickly! Jeremy Burns jeremybu...@me.com On 23 Feb 2010, at 09:21, WebbedIT wrote: Your data should have been available at: $this-data['BookingPosition']['amountofadult'] not $this-data['booking_positions']['amountofadult'] Just clarifying this in case

Product Pagination Question

2010-02-23 Thread Dave
I have this index function function index( $category_id = null ) { if (!$category_id) { $this-Product-recursive = 0; //$this-set('products', $this-paginate()); $this-paginate = array( 'limit' = 2); $products = $this-paginate('Product');

Re: how to adress specific data from related models?

2010-02-23 Thread mivogt-LU
Hello Paul, thank you so much, yes this helps! Michael On 23 Feb., 10:18, WebbedIT p...@webbedit.co.uk wrote: If I understand your model and field names correctly, after submitting your BookingPosition form which includes the field Lodging.id, you should be able to use: $numberOfBeds =

How do I add custom validation in controller?

2010-02-23 Thread Zac Tolley
I have created a form with the html and form helpers and setup validation rules in my model and this seems to work pretty well (anyone got this integrated with jquery?) I have a question though, in my form I have a couple of extra fields, one is a checkbox to accept terms and conditions, and

cakephp find('count') + groub by problem

2010-02-23 Thread alagar
Guys sorry for my English, I'm from Russia. I have the following problem There is a customer table with the fields id and type I make such a request here $result = $this-find ( 'count', array ( 'fields' = 'Client.ClientId', 'group' = 'Client.ClientType')); I want to know the number of customers of

Re: Product Pagination Question

2010-02-23 Thread John Andersen
In the CakePHP book at http://book.cakephp.org/view/166/Pagination-in-Views, nearly at the bottom, is specified how to pass the original parameters in the Paginator. Enjoy, John On Feb 23, 11:53 am, Dave make.cake.b...@gmail.com wrote: I have this index function function index( $category_id

Re: How do I add custom validation in controller?

2010-02-23 Thread anl hp
of course you can!...and you should! ;) CakePHP Models let you spice them with custom validations, when in a validation array you say 'rule' = array() the first parameter of the array can be the name of a custom validation function in your model, then, when validation is fired up, your custom rule

Re: How do I add custom validation in controller?

2010-02-23 Thread WebbedIT
You may want to have a good read of the existing core rules to make sure they can't do what you're after: http://book.cakephp.org/view/134/Core-Validation-Rules And then read the page about custom rules: http://book.cakephp.org/view/150/Custom-Validation-Rules HTH Paul Check out the new

Re: cakephp find('count') + groub by problem

2010-02-23 Thread alagar
problem is in Model __findCount method see http://api12.cakephp.org/view_source/model/#line-2040 On Feb 23, 12:57 pm, alagar ala...@nm.ru wrote: Guys sorry for my English, I'm from Russia. I have the following problem There is a customer table with the fields id and type I make such a

Re: How do I add custom validation in controller?

2010-02-23 Thread jodator
Do it in a model (not controller) - cake flow: var $validate = array( 'accept_terms' = array( 'notEmpty' = array( 'rule' = array('comparison', '!=', 0), 'required' = true, 'message' = 'Musisz zaakceptować regulamin', 'on' =

Re: cakephp find('count') + groub by problem

2010-02-23 Thread alagar
that would solve the problem, you need to write a query in such a way $result = $this-find ( 'all', array ( 'fields' ='count(Client.ClientId)', 'group' = 'Client.ClientType')); On Feb 23, 1:18 pm, alagar ala...@nm.ru wrote: problem is in Model __findCount method  

Re: How do I add custom validation in controller?

2010-02-23 Thread Zac Tolley
Ah but, the thing is I'm verifying fields that are not part of the model, I'm simply verifying that they agree to some terms and that the 2 passwords they entered match Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received

Re: How do I add custom validation in controller?

2010-02-23 Thread Zac Tolley
Though that said, thats what you are saying :) and but the terms thing..? I might just cheat and put in some JS to check that they agree to the terms Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message

Re: How do I add custom validation in controller?

2010-02-23 Thread Jeremy Burns
Check for their presence/value in the controller, and then unset them from the array before saving. Jeremy Burns jeremybu...@me.com On 23 Feb 2010, at 12:16, Zac Tolley wrote: Ah but, the thing is I'm verifying fields that are not part of the model, I'm simply verifying that they agree to

Re: Another saveAll() problem

2010-02-23 Thread Nico
Another thing to check is the beforeSave() method to make sure that returns true. Are any of your other saves to the database working? On Feb 23, 7:48 am, Jeremy Burns jeremybu...@me.com wrote: Have you checked to see if your data array is missing any required fields? If so, it would still

problem updating multiple related table record using save

2010-02-23 Thread John
I have user's profile split into 3 tables)one parent table linked to two child tables(with foreign keys set to id of parent table and both with cascade option set on delete and update). Parent table relate to one record on the two child tables. I have declared $hasmany on main table model (

Howto publish legal notice

2010-02-23 Thread amarradi
Hello, i want publish the legal notice of my page via cakePHP. How do i this? Without an database? Or with an database. I want show only the page with the notice many greetings marcus radisch Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related

Re: Need help with Custom paginate and paginator methods

2010-02-23 Thread WebbedIT
What do you mean by customising the function in the model? Are you doing anything different to that explained at: http://book.cakephp.org/view/164/Pagination HTH Paul. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You

Re: Another saveAll() problem

2010-02-23 Thread Lucca Mordente
Both the data and associations are correct. My mistake was on what Nico said. I've just forgot to return true inside beforeSave() method! Thank you all guys! On 23 fev, 03:30, Nico ngev...@gmail.com wrote: Another thing to check is the beforeSave() method to make sure that returns true. Are

Re: Howto publish legal notice

2010-02-23 Thread WebbedIT
If it's fairly static content and you are happy to edit a view file each time you want to make changes, install cake, add an action to the page controller and a view at /app/views/pages/actionname.ctp and hey presto. You would access this page at http://www.website.com/pages/actionname and one of

Re: Checking existence of variable passed to an element

2010-02-23 Thread WebbedIT
Place the following in the element: ?php if(isset($variableName)): ? // Conditional HTML code here ?php endif; ? HTH Paul. 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

Re: After the Cake is baked...

2010-02-23 Thread WebbedIT
I think the OP put the main emphasis on legal requirements himself, but fair point he did mention running the site as well as administrative and technical issues. I think the subject matters are little too general to be able to recommend a selection of books that will be ideal for you. I am

Need help with Custom paginate and paginator methods

2010-02-23 Thread anju
Im a beginner in cakePHP and can anyone tell me about how to get the output of $paginator-numbers(), after customising the paaginate() function in the model Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message

Re: Another saveAll() problem

2010-02-23 Thread WebbedIT
How the heck did Nico know you had a beforeSave() method created in the model? Wow, he's a mentalist, wonder if he'll give me next week's Lottery numbers? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message

Re: ACL + Auth , admin routing necesario?

2010-02-23 Thread Rafel
Sorry, I thought I was in the spanish group when it sended . I Posted the same question in the correct group, follow the thread there. Thanks for the answer Guille Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this

Re: Howto publish legal notice

2010-02-23 Thread amarradi
Yes, i want edit the legal notice in the texteditor. Do you have any howto, where i found some more informations? On 23 Feb., 17:13, WebbedIT p...@webbedit.co.uk wrote: If it's fairly static content and you are happy to edit a view file each time you want to make changes, install cake, add an

Re: Checking existence of variable passed to an element

2010-02-23 Thread WebbedIT
Place the following in the element: if(isset($variableName)) { // conditional logic goes here } HTH Paul. 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

I can't list my files from the uploads folder (when app is online). Everything works local.

2010-02-23 Thread mattyh88
I work with TinyMCE in my CakeApp. When I press the image icon, it shows the image window. I've added a browse button. (like in the tutorial: http://bakery.cakephp.org/articles/view/adding-a-tinymce-image-browser-the-cakephp-way) All of this works perfectly local. But when I upload it to my

Re: After the Cake is baked...

2010-02-23 Thread Chad Smith
Since everyone is taking the legal avenue with this post I'll take the one that I think the author is more interested in. It's the Where do I go from here after I bake a site? The short answer to that is you customize. Baking only gives you a lot to work with, but is your site ready for the big

Re: allowing people to post profiles on my website, help with, please

2010-02-23 Thread Chad Smith
Hey DrDave, I can see where WebbedIT is coming from with not having a server and what that means. You will need a hosting provider, but you personally will not need a server to access your website. Just an online access so you can see your own site. Now, there is a couple of different ways to

Re: How do I add custom validation in controller?

2010-02-23 Thread anl hp
please don't!! don't check that within the controller and don't even think about check it with javascript!! :'( use Model's custom validation, these don't need fields to be a field of your database, within a custom validation function you can just check if you have a 'terms' field and is true, 1.

Re: problem updating multiple related table record using save

2010-02-23 Thread Lucca Mordente
Make sure the child models have their id setted. CakePHP adds a new record if the id is empty. On 23 fev, 10:59, John johnmeh...@gmail.com wrote: I have user's profile split into 3 tables)one parent table linked to two child tables(with foreign keys set to id of parent table and both with

Checking existence of variable passed to an element

2010-02-23 Thread jbov
I am a bit of newbie with CakePHP and DB-driven sites so bear with me. I have an element that I am displaying on every page, and I am passing one variable to it from every controller function. If I do not pass the variable I get an ugly unknown variable error. I want to ease the requirement of

RE: Product Pagination Question

2010-02-23 Thread Dave
Perfect! Thanks Dave -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of John Andersen Sent: February-23-10 7:29 AM To: CakePHP Subject: Re: Product Pagination Question In the CakePHP book at

Re: Checking existence of variable passed to an element

2010-02-23 Thread Jeremy Burns
if (isset($variable)): do something; else: don't; endif; Jeremy Burns jeremybu...@me.com (Skype) +44 208 123 3822 (jeremy_burns) (m) +44 7973 481949 (h) +44 208 530 7573 On 23 Feb 2010, at 12:49, jbov wrote: I am a bit of newbie with CakePHP and DB-driven sites so bear with me. I have

Custom Datasource for INI files

2010-02-23 Thread john Lange
I'm trying to write a custom datasource that reads and writes INI files (php ini files, not Windows). Even though INI files and databases are fundamentally incompatible in many ways, I never the less would like it to be as compatible with database sources as possible. I've created class IniSource

saveAll() returns false

2010-02-23 Thread Eleazar
Hi all, I'm really not sure if I did something wrong but I couldnt get saveAll to work on a BelongsTo model. I have a login table with different types of users, and I have different tables for each type of user connected with the login table. So for example the `user` table belongs to the login

CakePHP Core on standalone server?

2010-02-23 Thread brutalt.se
Hello, i have one.com as webhost unfortunately they dont support frameworks. So im trying to figure out a way to get around this, is it possible to have cakephp-core on one server ( got a server of my own ). and then have the cakeapp at one.com? Check out the new CakePHP Questions site

Element Cache Config?

2010-02-23 Thread Jimbo2150
Is it possible to use a separate cache config for an element? For instance, I have a global element that I know will be the same across all of my apps, so I have a directory that I want to use to store such cached elements: /path/to/global/tmp/cache/ Whereas the rest of the app is stored in:

Re: I can't list my files from the uploads folder (when app is online). Everything works local.

2010-02-23 Thread brian
Check your error logs and make sure debug is set to 2 (the action that fetches the view probably sets it to 0 if it's an ajax call). On Tue, Feb 23, 2010 at 1:17 PM, mattyh88 mathew.hu...@gmail.com wrote: I work with TinyMCE in my CakeApp. When I press the image icon, it shows the image window.

Re: Question about relationships, extending the blog tutorial

2010-02-23 Thread deek
So I updated my post model to what you see below and now when I go to my index (index.ctp) view that I have listed on my first post nothing shows up. Do I need to add anything in the controllers or the user model? Once get it to show properly how would I call the the User displayname in my

Counting in the Index View

2010-02-23 Thread Scale
I'm very new to cakePHP and the MVC concept in general, so forgive me if there's an obvious answer to this question. In my View function in my Controller I have a find() that counts the number of times a user has voted on an object based on that object's id which is being passed in to the View

Auth/Twitter/Safari issues - logged out of my Cake site after authenticating with Twitter, only on Safari

2010-02-23 Thread mixed blessing
I'm afraid sessions and auth is a place where I never get the big picture, so any advice on where to start looking for a solution for this issue would be much appreciated. I have a site running with CakePHP, and these are the components I use in the user controller:

Default Routes

2010-02-23 Thread p_W
When I am using cake in a development setup, and access the application at http://localhost/, the default routes work just fine. However, when I put the app into production, I seem to have problems if the app's webroot is not set as the documentroot of a virtualhost. E.G., if I have a webserver

Re: Need help with Custom paginate and paginator methods

2010-02-23 Thread ak2010
Hi I'm doing something like this: http://book.cakephp.org/view/249/Custom-Query-Pagination In the controller, i have given code like this $this-paginate = array( 'conditions' = array( 'search_text' =$this-params['named']'s_keyword'], 'action'='index',

Re: Question about relationships, extending the blog tutorial

2010-02-23 Thread Andy Dirnberger
Did you try just using var $belongsTo = array('User');? The values you are supplying for className and foreignKey should be the defaults. If you remove the $belongsTo piece, do your posts show up again? If not, what else did you change? What code do you currently have in your controller? No

Re: Answering a recurring challenge from clients

2010-02-23 Thread LunarDraco
@Zaky: I would have to say that I turn away more work than I ever get to keep in house for the very reasons you mention. If there is already something that does what the customer needs I don't want to reproduce it. For instance, I have some very specialized shopping carts which deal with variable

Re: Another saveAll() problem

2010-02-23 Thread Nico
Not bad for a first post ;) I seem to remember reading about that problem the other day, so it was fresh in my mind. Glad it helped. On Feb 23, 7:04 pm, WebbedIT p...@webbedit.co.uk wrote: How the heck did Nico know you had a beforeSave() method created in the model?  Wow, he's a mentalist,

Re: How do I add custom validation in controller?

2010-02-23 Thread Nico
for what its worth, here's some free code to help with the jquery part (if you still need it) create the form in your view. Add this jquery script: var myAjaxSettings = { type: POST, dataType: json, success: function(data) { if (data['success'] == true) { } else {

Re: Checking existence of variable passed to an element

2010-02-23 Thread Nico
I'm not sure if this is best practice, but I generally put put recurring variables into the beforeRender() method in your controller (or app_controller). That way you'll have at least a default value for your element (if it needs it). If it doesn't, then doing the check in the element should

Re: Question about relationships, extending the blog tutorial

2010-02-23 Thread deek
Well everything seems to be working now with var $belongsTo = array('User'); but I have tried putting ?php echo $post['User'] ['displayname']; ? in my index.ctp and the it does not output any of the information. If I put ?php echo $post['User']['id']; ? or ?php echo $post['User']['username']; ?

CakePHP is stripslashes_deep

2010-02-23 Thread Sai Krishna
Hello, I was trying to play with cakePHP framework, I was trying to develop something in similar lines, just for my learning sake. I could not get this how this you people were able to achieve, when I place cakephp framework under my htdocs in xampp in a folder called app2. Inside this I placed

Re: saveAll() returns false

2010-02-23 Thread Nico
Hi Eleazar. http://book.cakephp.org/view/75/Saving-Your-Data is probably your best bet. I had to read it a couple of times until it made sense. Have you setup your models correctly? ie the User.php should have: var $hasMany=array('Login'); and the Login.php should have var

Re: CakePHP is stripslashes_deep

2010-02-23 Thread Sai Krishna
Sorry for wrong subject line and my bad english Sai Krishna On Wed, Feb 24, 2010 at 12:59 PM, Sai Krishna psaikrishna@gmail.comwrote: Hello, I was trying to play with cakePHP framework, I was trying to develop something in similar lines, just for my learning sake. I could not get this

Re: how to adress specific data from related models?

2010-02-23 Thread Jeremy Burns
If you are doing this from within the BookingPosition model, '$this' points to the BookingPosition model. So by trying to access $this-BookingPosition you are in fact trying to access $this-BookingPosition-BookingPosition, if that makes sense! Instead, try $this-Lodging-field...etc. This should

Re: Counting in the Index View

2010-02-23 Thread Nico
Hi Cale I'm not sure if I've understood your question correctly, but here's what I'd do. Don't do that logic in the controller, but rather move it to the model. (fat models, thin controllers) In your model create a function that returns $timesVoted. That way you can use the same functionality

Re: Question about relationships, extending the blog tutorial

2010-02-23 Thread deek
Also when I try and add a user with this form h1Add User/h1 ?php echo $form-create('User', array('action' = 'register')); echo $form-input('username'); echo $form-input('displayname'); echo $form-input('password'); echo $form-end('Add User'); ? the displayname never makes it

Re: Default Routes

2010-02-23 Thread Nico
Hi Make sure that the .htaccess files have been copied and are working on the production server. On my shared hosting account I've had endless problems and eventually changed my directory layout to get it to work. If you're on shared hosting, you might have to consider moving the webroot