Ajax Sort a multicolumn table?

2007-05-15 Thread johnvv
I've seen the tutorial on creating a drag and drop list with Cake Ajax but I am interested in creating a sortable table with clickable columns to sort the table. I do not need it to update the database in any way. Any tutorials, hints, tips, suggestions for this? Thanks John

hasAndBelongsToMany in model with conditions?

2007-05-13 Thread johnvv
I've heard that it's good practice to put associations in the model (rather than using bindModel) but when declairing a HABTM relationship, I can't figure out how to add conditions or variables to the relationship declairation. For example, class Product extends AppModel { var

Best Practices - Associations calling functions

2007-05-13 Thread johnvv
I'm wondering what the best practice is for calling a method from inside one controller that happens to associate with another Model/ Controller. For Instance, if I have a blog post that has many comments and I want to run a method within the CommentsController to format/clean the comment... how

Calculating an Average?

2007-05-13 Thread johnvv
Let's say the blog example has the following associations: Post hasMany Comments Comment hasOne User User hasMany Reviews Currently I have something like this (let me know if I'm doing something n00b) :) class PostsController extends AppController { ... function view($id=NULL){

Re: Associations to reduce # of queries

2007-05-09 Thread johnvv
to make the array nicer. Russell Austin On May 8, 3:04 pm, johnvv [EMAIL PROTECTED] wrote: I'm to new using cake so file this question under 'newbies'... I have the following models: - Product (contains reference to manufacturer_id... and other information) - ProductImage (id,product_id

Re: Associations to reduce # of queries

2007-05-09 Thread johnvv
Ok, I was able to get around the error messages with this: // CategoryController .. function view($id){ .. loadModel('Product'); $p = new Product(); $this-Product = $p-getProductsByCategory($id, $start, $limit, $sort); pr($this); $this-set('category', $this-Category-read()); }

Associations to reduce # of queries

2007-05-08 Thread johnvv
I'm to new using cake so file this question under 'newbies'... I have the following models: - Product (contains reference to manufacturer_id... and other information) - ProductImage (id,product_id,type [thumbnail,medium,large], image_url) - Manufacturer - Category - CategoryProduct (category_id,

Compound Keys in CakePHP

2006-09-25 Thread johnvv
I'm just getting started with CakePHP and would like to know if it can handle compound keys in a database. For example, if you were to add tags to a blog, the schema would roughly be table: article(article_id, article_text, PRIMARY_KEY(article_id)); table: tag (tag_id, tag_word,