FindAll vs Query in Component

2006-08-25 Thread c_doug
Can anyone tell me why when using a query instead of FindAll in a component I get and Undefined Index error? Although I get this error it does output an array in the debug info. I can't find any good info or examples. I am not sure if it is due to needing a different output in the view (element)

Re: FindAll vs Query in Component

2006-08-25 Thread c_doug
I wonder what the solution to make up for the table reference is. I could try findAll again (although it doesn't seem to like my mySQL date function). It would be nice to learn how to make the output work with a query as well. Chris, do you think it is specific to use in a component or from

Re: FindAll vs Query in Component

2006-08-25 Thread c_doug
nate, do you know how to use a date function in the findAll parameters? 'DISTINCT `Post`.`created`', I am using mySQL and using all variations of month(`Post`.`created`). Maybe there is a built in function for use in Cake.?. --~--~-~--~~~---~--~~ You received

Re: Alternating Row Colors

2006-08-24 Thread c_doug
I would be curious how you could add a style to a particular td using an array like that also. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to

Date Format in Query

2006-08-24 Thread c_doug
I am trying to make a Archives (by month) section in a blog. How can I format a date for use in a query? Example so far: $cmonth = date_format(Post.created, 'F'); $data = $Post-query('SELECT DISTINCT `' .$cmonth. '` FROM posts'); I was trying to Select Distinct by Month but this only outputs

Re: Date Format in Query

2006-08-24 Thread c_doug
Ridicule? Sorry, I have found it difficult to find info on things that are simple to accomplish in other languages. I am sure that is understandable. As far as I know there is not even a book on CakePHP at this time. I primarily work in Usability/UI Design. As far as server-side I have

Re: Date Format in Query

2006-08-24 Thread c_doug
I am sure everyone here knows this but here is a good link on the topic: I've seen too many applications performing date calculations at the code level when the same can be done using built-in MySQL functions. http://www.databasejournal.com/features/mysql/article.php/2172731

Re: Date Format in Query

2006-08-24 Thread c_doug
Actually that is a pretty funny quote. I am thinking of putting a sign in our room that says Save yourself some ridicule for everyone who comes in with questions or requests. I'ts kind of like the angry IT guy on SNL. --~--~-~--~~~---~--~~ You received this

Re: Date Format output

2006-08-23 Thread c_doug
Can the time helper apply a mask in the view (for example MM/DD/)? If not, is the best way to do it to modify the time helper itself in the helpers directory? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Date Format output

2006-08-23 Thread c_doug
Right, that's what I was sort of thinking. I think getting more into helpers is going to interesting. Thanks, again. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email

Re: Alternating Row Colors

2006-08-23 Thread c_doug
This worked well but I wonder if there is an easier way to use the helper in just the tr tag itself. Ruby, for instance, uses a little 'cycle' scriptlet within the tag. Ex: %=cycle(white, gray) I am just curious if it is possible without making the table info into an array. I found it pretty

Re: Date Format output

2006-08-23 Thread c_doug
Thanks for the added advice. That worked really well. I made a new slightly modified function in the time helper and used: echo $html-link($time-niceMonth($a['Post']['created']), /posts/)? So simple once you get the basic idea. --~--~-~--~~~---~--~~ You

Date Format output

2006-08-21 Thread c_doug
Can someone give me an idea of how to output a date in a certain format? In this case I am trying to only output the month in the view. Can I add a simple function to: $a['Post']['created'] to make it output just a month or various date formats? I have searched but haven't been able to apply

Re: Date Format output

2006-08-21 Thread c_doug
Thanks, I'll have to try that once I get a little more advanced. I am trying to apply different variations of PHP date functions to it. I am hoping to put a simple function around the 'created' variable above. Something like: date('mask', created).

Alternating Row Colors

2006-08-19 Thread c_doug
Can anyone tell me how to alternate row colors in CakePHP? Is it similar to doing it in regular PHP? Ex: $row_color = ($row_count % 2) ? $color1 : $color2; $row_count++; --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: output DISTINCT records

2006-08-19 Thread c_doug
Thanks. I wasn't aware of the search link you posted. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group,

Re: output DISTINCT records

2006-08-19 Thread c_doug
I did search the group previously and found the topic linked from the page you posted. I just haven't been able to get it to translate to what I am doing yet. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake

output DISTINCT records

2006-08-18 Thread c_doug
I know how to easily select only distinct records in SQL. However in CakePHP when using a data model without SQL what is the best way to only output distinct records? Should that be done near the '-findAll()' in the controller or near the 'php foreach' in the view?

Filtering Data

2006-08-18 Thread c_doug
Can something like this be modified to only output records with a certain category_id for instance: function view($id) { $this-Post-id = $id; $this-set('data', $this-Post-read()); } I have created a new method and modified it slightly: function cat($id) {

Dynamic Links

2006-08-18 Thread c_doug
Can anyone tell me how to make a link name and location dynamic based on the data variables? Generic example: ?php foreach ($data as $post): ? tr td?php echo $post['Post']['id']?/td td?php echo $post['Post']['name']?/td /tr ?php endforeach; ? ?php echo

Re: Filtering Data

2006-08-18 Thread c_doug
Thanks, I'll try that as soon as I get a chance. Can you please tell me how (or if it is possible) to have multiple conditions in the array? Similar to: WHERE category_id = 1 AND author = 'me'. Also at what point of complexity or when is it just better to use SQL in your model?

CakePHP Syntax

2006-08-18 Thread c_doug
Does anyone have a recommendation for the best place to learn the basic (and advavanced) meanings of the CakePHP syntax? Is it part of the regular PHP syntax? I am new to CakePHP and PHP for that matter. I just completed the blog tutorial and am trying to expand it from there. Thanks.

Re: output DISTINCT records

2006-08-18 Thread c_doug
Anyone? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more

Re: output DISTINCT records

2006-08-18 Thread c_doug
You're right. Although, I wonder if there is a way to do it with model objects rather than SQL.?. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to

Re: Dynamic Links

2006-08-18 Thread c_doug
That worked. Thanks a lot. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL

Re: Filtering Data

2006-08-18 Thread c_doug
Btw, the above example worked. Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to

Re: output DISTINCT records

2006-08-18 Thread c_doug
Is it possible to do something like this? $this-set('data', $this-Post-findAll(array('DISTINCT categories.name', 'Post.category_id'=$id))); as in putting DISTINCT in the array? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the