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)
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
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
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
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
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
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
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
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
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
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
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
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
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).
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
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,
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
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?
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)
{
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
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?
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.
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
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
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
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
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
27 matches
Mail list logo