Re: Message users in Cake

2009-03-25 Thread andruu

Create a table called messages with a from_user_id column that relates
back to the user sending the message, a to_user_id which will relate
to the user who is receiving the message. then a body field for the
actual message.

Should be quite simple.

On Mar 25, 8:41 pm, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
 Does anyone know of a good setup where users can send messages back and
 forth to other users? Something like a email app but only its not sent to an
 actual email, just a message on the site its self.

 Thanks

 Dave
--~--~-~--~~~---~--~~
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.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Zero values being submitted as NULL into DB.

2008-12-12 Thread andruu

Thanks Anja,

I actually came up with my own temporary solution, I just changed the
root parent_id to 1.

I think it has something to do with the Tree behavior but I am not
quite sure.


Liebermann, Anja Carolin wrote:
 Hi Andruu,

 I had a problem like that once ans solved it by saving the 0 as String '0'. 
 Weird, but it worked. I guess the 0 was interpretetd as boolean false.

 Anja

 -Urspr�ngliche Nachricht-
 Von: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] Im Auftrag 
 von andruu
 Gesendet: Freitag, 12. Dezember 2008 08:29
 An: CakePHP
 Betreff: Zero values being submitted as NULL into DB.


 Hello, I have a simple form to edit my category model. My category model is 
 using the Tree behavior. When trying to edit/update my model's parent_id if 
 the value is 0 it is being submitted as NULL into the database. The database 
 type is integer.

 I am looking for a solution to preserve the initial value of 0 (zero).

 If I do a pr($this-data) it shows the correct values but when I look in the 
 SQL log I can see that NULL is being submitted.

  Array
 (
 [Category] = Array
 (
 [parent_id] = 0
 [name] = Apparel
 [description] =
 )

 )

 SQL LOG
 UPDATE `categories` SET `parent_id` = NULL, `name` = 'Apparel', `description` 
 = '', `modified` = '2008-12-12 14:27:13' WHERE `categories`.`id` = 7

 Also it works fine if the value is not 0.

 Thanks in advance for any help.
--~--~-~--~~~---~--~~
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.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Zero values being submitted as NULL into DB.

2008-12-11 Thread andruu

Hello, I have a simple form to edit my category model. My category
model is using the Tree behavior. When trying to edit/update my
model's parent_id if the value is 0 it is being submitted as NULL into
the database. The database type is integer.

I am looking for a solution to preserve the initial value of 0 (zero).

If I do a pr($this-data) it shows the correct values but when I look
in the SQL log I can see that NULL is being submitted.

 Array
(
[Category] = Array
(
[parent_id] = 0
[name] = Apparel
[description] =
)

)

SQL LOG
UPDATE `categories` SET `parent_id` = NULL, `name` = 'Apparel',
`description` = '', `modified` = '2008-12-12 14:27:13' WHERE
`categories`.`id` = 7

Also it works fine if the value is not 0.

Thanks in advance for any help.

--~--~-~--~~~---~--~~
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.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: set::combine // form-helper select question

2008-12-11 Thread andruu

I am doing something similar right now using find('list') and then
using Set::insert() and then setting the 'options' option in the input-
field to the variable assigned to the Set::insert().

On Dec 12, 6:08 am, Gaston i...@neeneenee.de wrote:
 I want to combine two lists of news in an select-field. Something
 like:
 select name='mylist'
  option value='123' class='new'latest news/option
  option value='234' class='new'latest news2/option
  option value='567' class='old'older news/option
  option value='789' class='old'older news2/option
 /select

 The both different lists I will get width find()-questions with
 different conditions.
 To make the select field in the written form, I need an array like
 $mylist = array (
                    0 = array('value'=123, 'name'='latest news',
 'class'='new'),
                    1 = array('value'=234, 'name'='latest news2',
 'class'='new'),
                    2 = array('value'=567, 'name'='older news',
 'class'='old'),
                    3 = array('value'=789, 'name'='older news2',
 'class'='old')
 );

 Here my questions:
 can I construct an array like abough with Set::combine?
 (If I use find('list') or    find('all') and set::combine() I get an
 array like $mylist = array('123'='latest news');
 Any ideas?

 Thanks for Your help!

--~--~-~--~~~---~--~~
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.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Model Baker Beta

2008-09-17 Thread andruu

Where can this be downloaded? I saw the video on Youtube.

On Sep 16, 4:50 am, JJ [EMAIL PROTECTED] wrote:
 I've been trying out the Beta version of ModelBaker...Has anyone seen
 or tried it?  It definitely makes building websites a whole lot faster
 and easier.
 Really easy to use, self explanatory.  Especially for newbees cause no
 coding.  If you haven't tried it you might wanna give it a shot.

--~--~-~--~~~---~--~~
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.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



saveAll Problem

2008-07-09 Thread andruu

Hello,

I am having a problem using the saveAll method. I am building a simple
message board application and when trying to use saveAll it hangs for
a few seconds and then shows a white screen with no error.

I have 2 models, ForumThread and ForumPost (ForumPost belongs to
ForumThread and ForumThread hasMany ForumPosts)  and I am trying to
save the two records using saveAll.

Below is the code from my controller and view as well as the array
that is generated by the form.

View:

div id=forums
div id=new_post
h2Post new topic in ?=$category['ForumCategory']['name']?
forums/h2
fieldset
legendWrite your message and submit/legend
?=$form-create('ForumThread', array('action' = 
'add'))?
?=$form-hidden('forum_category_id', array('value' =
$category['ForumCategory']['id']))?
?=$form-input('title', array('class' = 'textbox'))?
?=$form-input('ForumPost.body')?
?=$form-end('Submit New Post')?
/fieldset
/div
/div

Controller:

function add() {
if (!empty($this-data)) {
$this-data['ForumPost']['member_id'] = 
$this-Auth-user('id');
$this-data['ForumThread']['member_id'] = 
$this-Auth-user('id');
// pr($this-data); die;
$this-ForumThread-create();
if ($this-ForumThread-saveAll($this-data)) {
$this-Session-setFlash(__('The ForumThread 
has been saved',
true));
$this-redirect(array('action'='index'));
} else {
$this-Session-setFlash(__('The ForumThread 
could not be saved.
Please, try again.', true));
}
}
}

Array:

Array
(
[__Token] = Array
(
[key] = 200541b16af308be8275485658b7b69b8041ad95
[fields] = b9a30fa56c5607cf2417083a0ad100db05d56f93
)

[ForumThread] = Array
(
[forum_category_id] = 1
[title] = Test
[member_id] = 1
)

[ForumPost] = Array
(
[body] = Test
[member_id] = 1
)

)

I am also using the Security component if that makes a difference.

Any help is greatly appreciated, Thanks.

--~--~-~--~~~---~--~~
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.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Containable Behavior and HABTM

2008-06-12 Thread andruu

Anybody have any suggestions?

On Jun 11, 12:23 pm, dizz [EMAIL PROTECTED] wrote:
 Hello I am trying to use the containable behavior in a category
 controller that habtm posts. In the view action of the category
 controller I am trying to display all posts for the category and also
 all of the posts categories.

 Here is what I am trying to use:

 $this-Category-contain(array('Post' = array('User.name',
 'Category')));

 But I still cannot get the categories for the post.

 If I do something like the following in the category view action I do
 get the categories for the post but I also get all the posts and not
 just the ones tied to the category:

 $this-Category-Post-contain(array('User.name', 'Category.name'));
 pr($this-Category-Post-findAll());

 Any help would be greatly appreciated.
 Thanks

--~--~-~--~~~---~--~~
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.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---