Re: date display

2010-04-20 Thread violet nunda
thank you very much for the immediate response,i figured out that it was
because of the css settings in the cake.generic.css.now forms are displaying
well,now have to work on making the Interface appear better.i am also trying
to work on implementing sending email to someone using phpmailer-cakePHP.i
tried to follow the cook book,but now i dont see the functionality working.i
was refering to the following link:
http://bakery.cakephp.org/articles/view/sending-email-with-phpmailer

they stated 5 major functionalities i had 2 build,of which i only created
empty files as i didnt know whether there where supposed to be lines of code
inside them.
5 functionalities:
You will create:

1. cakePHP component
2. a vendor package
3. view for plain text email body
4. view for HTML email body
5. a function in your controller to send mail.
i really want to have this functionality,thank you in advance Cricket


On Tue, Apr 20, 2010 at 5:47 PM, cricket  wrote:

> On Apr 20, 5:30 am, OpnetITGuru  wrote:
> > hi i am getting a very bad date output on my form,i am still new in
> > cakePHP framework.i want it to display in one horizintal line i.e
> > showing  in the following manner (YMD) in a sigle horizontal  line not
> > in vertical format like this:year displaying  in one line followed by
> > month in another line.
> >
> > code in the form:  > echo $form->input('date logged',array('type'=>'date',
> 'format'=>'Y-M-
> > D'));
> > ?>
>
> I think this is due to the HTML elements not having enough space and
> wrapping. Are these displayed inside a table cell?
>
> 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 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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 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: View (form->input) - Disable word wrap?

2010-04-20 Thread sebb86
John

Thanks a lot for all your help.
In your example, is the cake.generic.css file the original?

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 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: How to output UTF-8 sign?

2010-04-20 Thread John Andersen
Try to add a CSS class to the sort link and then use CSS to add
something to the link.
For example:

[code]
$paginator->sort('id', 'id', array('class' => 'asc');
[/code]

and when clicked on, change into:

[code]
$paginator->sort('id', 'id', array('class' => 'desc');
[/code]

Then with CSS make the sort link have an after symbol:

[code]
.asc{
   background:url(up_arrow.png) no-repeat top right;
   padding-right:8px;
}
.desc{
   background:url(down_arrow.png) no-repeat top right;
   padding-right:8px;
}
[/code]

I haven't tested the above pseudo code :) but maybe it can be done!
The padding ensures that the background image will be visible to the
right of the link text - assuming you can make an arrow that is max 8
pixels wide.
Enjoy,
   John

On Apr 21, 8:54 am, sebb86  wrote:
> Addition:
> [code]
> ↑
> [/code]
>
> also works. But also _not_ inside the paginate source code.
> Any ideas?
>
> Thanks if someone can help!
> [snip]

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 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: Proper way to handle empty localization strings?

2010-04-20 Thread O.J. Tibi
Oh, and by the way, a follow up tip: if you need to embed variable
values INSIDE your translation strings, you may want to use sprintf()
and named parameters for argument swapping. Check http://php.net/sprintf
for details on these.

Cheers again!

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 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: Proper way to handle empty localization strings?

2010-04-20 Thread O.J. Tibi
Now I got your point.

The thing is, Gettext (the translation that lots of applications
implement, not just CakePHP) works in a way that if there are no
message strings in the specified language that are found corresponding
to the message id, then the message id itself will be returned. The
obvious advantage for this is that you don't need to create another PO
file in the base language that you're working on, and all you need to
do is generate files for the other languages that your application
will be supporting.

If you're trying to say that, for example, one word for the English
language can be used in different context to cater to an implicit
meaning BUT you might need to use other words in another language to
convey meaning in another context, then you might be off better to
create language-neutral message ids. The minor downside for this is
you also have to generate the PO file in your base language.

As you have suggested, you may have to add another level of grouping
for your message ids, like "MessageGroup.SubkeyOrWord.Variation1",
"MessageGroup.SubkeyOrWord.Variation2" and so on.

Let's say we have the following:



Submit, variation 1

(en)
msgid "MyApplication.Submit.1"
msgstr "SUBMIT"

(sv)
msgid "MyApplication.Submit1"
msgstr "GODKÄNN"



But then you could be using SUBMIT in another Swedish context:



Submit, variation 1

(en)
msgid "MyApplication.Submit.2"
msgstr "SUBMIT"

(sv)
msgid "MyApplication.Submit2"
msgstr "SKAPA"



Notice how the translations are keyed like "MyApplication.Submit.1"
and  "MyApplication.Submit.2". That's a viable workaround IMHO.

Hope this helps, cheers!

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 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: How to output UTF-8 sign?

2010-04-20 Thread sebb86
Addition:
[code]
↑
[/code]

also works. But also _not_ inside the paginate source code.
Any ideas?

Thanks if someone can help!

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 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: Joining Data for Auth Component to read

2010-04-20 Thread thatsgreat2345
Auth component only stores values that are in the users table, so you
can grab the user id using $this->Auth->user('id') and then do a find.
Or alternatively you can use $this->Auth->login and once if it
successfully logs in then do a find on the group data and store it in
the session for later use especially if you are going to be accessing
it a lot. But if you only need it in one place I'd just recommend
doing the find when it is needed.

On Apr 20, 5:52 pm, capo64  wrote:
> Hi I have a setup with Users and Groups.
>
> I've been reading user data using this in my views:
> $session->read('Auth.User.full_name'); ..etc
>
> Now I need to access information about the group of the user. How can
> I go about doing this?
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: reuseable Code with cakePHP

2010-04-20 Thread John Andersen
If the tree helper does not work in one of your cases, then compare
them and see what you have done different!
Also make sure that your data is in accordance with what the tree
helper expects.
Enjoy,
   John

On Apr 20, 7:04 pm, davido  wrote:
> Hello!
>
> I´m a newbie in cakephp so long.
>
> I have two controller that use the treehelper. On one it works and on
> the other it does not.
>
> Tree Helper:
>
> Ex:http://www.schwarzefrauen.at/sidebars(works)
>      http://www.schwarzefrauen.at/tags(works not!)
>
> Basically my understandings are to customize cakephp framework for the
> need of the application. Basically I underlay the same problem
> everytime when I work with reuseable code like in the example above
> and in the implemantation of a news plugin.
>
> Plugin:
>
> Ex:http://www.schwarzefrauen.at/about(works)
>      http://www.schwarzefrauen.at/news(works not!)
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: 'multiple' validation rule

2010-04-20 Thread Jeremy Burns
Might it be something to do with the field name? What happens if you rename it 
to election_office?

Jeremy Burns
jeremybu...@me.com
On 21 Apr 2010, at 05:47, cricket wrote:

> On Apr 20, 11:33 pm, cricket  wrote:
>> Oh, poop! Never mind, it works now. Sorry for the noise.
>> 
> 
> Poop, indeed. It's busted again. I had it working, but then saving
> wasn't happening. Now I've got save() working, but this validation is
> cocked up.
> 
> select(
>   'ElectionOffice',
>   $offices,
>   null,
>   array('multiple' => 'checkbox', 'checked' => true)
> ) ?>
> 
> error('ElectionOffice') ?>
> 
> Election model:
> var $validate = array(
>   'deadline' => array(
>   'rule' => 'date',
>   'required' => true,
>   'allowEmpty' => false,
>   'message' => 'You must declare a deadline date.'
>   ),
>   'ElectionOffice' => array(
>   'rule' => array('multiple', array('min' => 1)),
>   'required' => true,
>   'message' => 'Please select at least one Office'
>   )
> );
> 
> If the 2nd rule is present, the save() doesn't work. Additionally, the
> error message displays just the first letter, "P". And I have to put
> the call to $form->error() because nothing shows up, otherwise.
> 
> Criminy!
> 
> 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 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

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 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: 'multiple' validation rule

2010-04-20 Thread cricket
On Apr 20, 11:33 pm, cricket  wrote:
> Oh, poop! Never mind, it works now. Sorry for the noise.
>

Poop, indeed. It's busted again. I had it working, but then saving
wasn't happening. Now I've got save() working, but this validation is
cocked up.

select(
'ElectionOffice',
$offices,
null,
array('multiple' => 'checkbox', 'checked' => true)
) ?>

error('ElectionOffice') ?>

Election model:
var $validate = array(
'deadline' => array(
'rule' => 'date',
'required' => true,
'allowEmpty' => false,
'message' => 'You must declare a deadline date.'
),
'ElectionOffice' => array(
'rule' => array('multiple', array('min' => 1)),
'required' => true,
'message' => 'Please select at least one Office'
)
);

If the 2nd rule is present, the save() doesn't work. Additionally, the
error message displays just the first letter, "P". And I have to put
the call to $form->error() because nothing shows up, otherwise.

Criminy!

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 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


Joining Data for Auth Component to read

2010-04-20 Thread capo64
Hi I have a setup with Users and Groups.

I've been reading user data using this in my views:
$session->read('Auth.User.full_name'); ..etc

Now I need to access information about the group of the user. How can
I go about doing this?

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 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: Is it possible

2010-04-20 Thread kani
Tnx

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 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: 'multiple' validation rule

2010-04-20 Thread cricket
Oh, poop! Never mind, it works now. Sorry for the noise.

On Apr 20, 11:30 pm, cricket  wrote:
> Cake 1.2.6
>
> Can anyone explain how this is supposed to work? As is too often the
> case, the cookbook example is very unclear. For one thing, how does
> one specify which field this rule applies to?
>
> This is what I have now (the 'ElectionOffice' rule):
>
> class Election extends AppModel
> {
>         var $hasMany = array('ElectionBallot');
>         var $hasAndBelongsToMany = array('ElectionOffice');
>
>         var $validate = array(
>                 'deadline' => array(
>                         'rule' => 'date',
>                         'required' => true,
>                         'allowEmpty' => false,
>                         'message' => 'You must declare a deadline date.'
>                 ),
>                 'ElectionOffice' => array(
>                         'rule' => array('multiple', array('min' => 1)),
>                         'required' => true,
>                         'message' => 'Please select at least one Office'
>                 )
>         );
>
> }
>
> ElectionsController:
>
> public function admin_add()
> {
>         if (!empty($this->data))
>         {
>                 $this->Election->set($this->data);
>
>                 if ($this->Election->save())
>                 {
>                         $this->flash(
>                                 'Election created',
>                                 array('action' => 'index')
>                         );
>                 }
>         }
>         $offices = $this->ElectionOffice->find('list');
>         $this->set(compact('offices'));
>
> }
>
> form:
>
> select(
>         'ElectionOffice.id',
>         $offices,
>         null,
>         array('multiple' => 'checkbox', 'checked' => true)
> ) ?>
>
> PS: 'checked' => true isn't working either. 'selected' didn't work and
> I found a comment online saying to use 'checked'. What's the proper
> param?
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: Is it possible

2010-04-20 Thread nurvzy
Yes.

On Apr 20, 9:28 pm, kani  wrote:
> $this->Model->Model->Model->Save();
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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


'multiple' validation rule

2010-04-20 Thread cricket
Cake 1.2.6

Can anyone explain how this is supposed to work? As is too often the
case, the cookbook example is very unclear. For one thing, how does
one specify which field this rule applies to?

This is what I have now (the 'ElectionOffice' rule):

class Election extends AppModel
{
var $hasMany = array('ElectionBallot');
var $hasAndBelongsToMany = array('ElectionOffice');

var $validate = array(
'deadline' => array(
'rule' => 'date',
'required' => true,
'allowEmpty' => false,
'message' => 'You must declare a deadline date.'
),
'ElectionOffice' => array(
'rule' => array('multiple', array('min' => 1)),
'required' => true,
'message' => 'Please select at least one Office'
)
);
}

ElectionsController:

public function admin_add()
{
if (!empty($this->data))
{
$this->Election->set($this->data);

if ($this->Election->save())
{
$this->flash(
'Election created',
array('action' => 'index')
);
}
}
$offices = $this->ElectionOffice->find('list');
$this->set(compact('offices'));
}

form:

select(
'ElectionOffice.id',
$offices,
null,
array('multiple' => 'checkbox', 'checked' => true)
) ?>

PS: 'checked' => true isn't working either. 'selected' didn't work and
I found a comment online saying to use 'checked'. What's the proper
param?

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 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: _controller convention

2010-04-20 Thread Miles J
There is no real reason. Just makes it easier to differentiate files
that are open in your editor.

On Apr 20, 8:14 pm, Bryan Lim  wrote:
> But don't the model and view need a _model or _view then?
>
> what is the rationale behind having a _controller?
>
> Thanks!
> Bryan
>
> On Apr 20, 10:57 pm, cricket  wrote:
>
>
>
> > On Apr 20, 1:21 am, Bryan Lim  wrote:
>
> > > Hi all,
>
> > > according to the convention
>
> > > why is only controller named by "_controller" ? while model and view
> > > aren't following..
>
> > I think it's more an object-oriented convention than specific to Cake.
> > The class names need to be unique.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.To post to this group, send email 
> > tocake-...@googlegroups.com
> > To unsubscribe from this group, send email 
> > tocake-php+unsubscr...@googlegroups.comfor more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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


Is it possible

2010-04-20 Thread kani
$this->Model->Model->Model->Save();

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 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: where do i put the external library in cakephp

2010-04-20 Thread Bryan Lim
I see. Thank you!!

On Apr 20, 11:36 pm, Walther  wrote:
> Either one.
>
> CakePHP is designed so that you only need one copy of the CakePHP
> files even if you have lots of CakePHP applications. vendors is for
> files that should be accessible to all apps, and app/vendors is for
> only that one application.
>
> On Apr 20, 5:08 am, Bryan Lim  wrote:
>
>
>
> > do i put it at vendors or app/vendors?
>
> > it is supposed to be used in one of the controller.
>
> > On Apr 19, 4:02 am, thatsgreat2345  wrote:
>
> > > Put it in vendors folder.
> > > Here is an example showing you how to import a vendor if it doesn't
> > > follow cake conventions naming 
> > > wise.http://book.cakephp.org/view/579/Loading-Files
>
> > > On Apr 18, 12:29 pm, Bryan Lim  wrote:
>
> > > > hi all,
>
> > > > if i am using the twitterlibphp library, where should i put this
> > > > library in?
>
> > > > so that require "twitter.lib.php"; will work?
>
> > > > thanks,
> > > > bryan
>
> > > > Check out the new CakePHP Questions 
> > > > sitehttp://cakeqs.organdhelpotherswith their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google 
> > > > Groups "CakePHP" group.> To post to this group, send 
> > > > emailtocake-...@googlegroups.com
> > > > To unsubscribe from this group, send email 
> > > > to>cake-php+unsubscr...@googlegroups.comfor more options, visit this 
> > > > group athttp://groups.google.com/group/cake-php?hl=en
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups 
> > > "CakePHP" group.To post to this group, send 
> > > emailtocake-...@googlegroups.com
> > > To unsubscribe from this group, send email 
> > > tocake-php+unsubscr...@googlegroups.comfor more options, visit this group 
> > > athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.> To post to this group, send email 
> > tocake-...@googlegroups.com
> > To unsubscribe from this group, send email 
> > to>cake-php+unsubscr...@googlegroups.comfor more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.To post to this group, send email tocake-...@googlegroups.com
> To unsubscribe from this group, send email 
> tocake-php+unsubscr...@googlegroups.comfor more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: _controller convention

2010-04-20 Thread Bryan Lim
But don't the model and view need a _model or _view then?

what is the rationale behind having a _controller?

Thanks!
Bryan

On Apr 20, 10:57 pm, cricket  wrote:
> On Apr 20, 1:21 am, Bryan Lim  wrote:
>
> > Hi all,
>
> > according to the convention
>
> > why is only controller named by "_controller" ? while model and view
> > aren't following..
>
> I think it's more an object-oriented convention than specific to Cake.
> The class names need to be unique.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.To post to this group, send email tocake-...@googlegroups.com
> To unsubscribe from this group, send email 
> tocake-php+unsubscr...@googlegroups.comfor more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: Checkbox

2010-04-20 Thread Lady Baleseng
when i put the  die(debug($this->data)); i get the following error.

*app\controllers\areas_hazards_controller.php* (line *23*)

Array
(
[AreasHazard] => Array
(
[area_id] => 22
[hazard_id] => 15
[Control] => Array
(
[0] => 13
)

)

)


//-//-//-//-//-//--
Controllers---//-//-//-//-//-//-//


find below my code



AreasHazard->recursive = 0;
$this->set('areasHazards', $this->paginate());
}

function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid AreasHazard.', true));
$this->redirect(array('action'=>'index'));
}
$this->set('areasHazard', $this->AreasHazard->read(null, $id));
}
function add() {
 $hzds = $this->AreasHazard->Hazard->findall();
 $this->set('hzds',$hzds);
if (!empty($this->data)) {
 die(debug($this->data));
$this->AreasHazard->create();
if ($this->AreasHazard->save($this->data)) {
if($this->AreasHazard->saveAll($this->data, array('validate' =>
'first'))){
$this->Session->setFlash(__('The AreasHazard has been
saved', true));
$this->redirect(array('action'=>'index'));
}} else {
$this->Session->setFlash(__('The AreasHazard could not be
saved. Please, try again.', true));
}
}
$hazards = $this->AreasHazard->Hazard->find('list');
$areas = $this->AreasHazard->Area->find('list');
$controls = $this->AreasHazard->Control->find('list');
$this->set(compact('hazards', 'areas', 'controls'));

}


function edit($id = null) {
 $hzds = $this->AreasHazard->Hazard->findall();
 $this->set('hzds',$hzds);
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid AreasHazard', true));
$this->redirect(array('action'=>'index'));
}
if (!empty($this->data)) {
if ($this->AreasHazard->save($this->data)) {
$this->Session->setFlash(__('The AreasHazard has been
updated', true));
$this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash(__('The AreasHazard could not be
updated. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->AreasHazard->read(null, $id);
$hazards = $this->AreasHazard->Hazard->find('list');
$areas = $this->AreasHazard->Area->find('list');
$controls = $this->AreasHazard->Control->find('list');
$this->set(compact('hazards','areas','controls'));
}

}


function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for AreasHazard',
true));
$this->redirect(array('action'=>'index'));
}
if ($this->AreasHazard->del($id)) {
$this->Session->setFlash(__('AreasHazard deleted', true));
$this->redirect(array('action'=>'index'));
}
}

}
?>




//-//-//-//-//-//-- Models
---//-//-//-//-//-//-//

 array('numeric'),
'area_id' => array('numeric'),
'control_id' => array('numeric')

);


function beforeValidate() {
// join hobbies into csv
if(!empty($this->data['Areashazard']['controls'])) {
$this->data['Areashazard']['controls'] = join(',',
$this->data['Areashazard']['controls']);
}

return true;
}

//The Associations below have been created with all possible keys, those
that are not needed can be removed
var $belongsTo = array(
'Hazard' => array(
'className' => 'Hazard',
'foreignKey' => 'hazard_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'Area' => array(
'className' => 'Area',
'foreignKey' => 'area_id',
'conditions' => '',
'fields' => '',
'order' => ''
),

'Control' => array(
'className' => 'Control',
'foreignKey' => 'control_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);

}
?>


//-//-//-//-//-//-- add.ctp
---//-//-//-//-//-//-//



create('AreasHazard');?>

 
input('area_id',array('type'=>'text','length'=>10));
?>

Hazard
  
 >

  


  input(
   'Control',
   array(
   'type' => 'select',
   'multiple' => 'checkbox'
   ),
   $controls
);
?>
end('Submit');?>





link(__('Back', true),
array('action'=>'index'));?>





//-//-//-//-//-//-- index.ctp
---//-//-//-//-//-//-//




cou

Re: NewBie Help Creating a simple Cake Blog, Return 404 Error

2010-04-20 Thread Sam Sherlock
in config/core.php set debug to 2 - nothing leaps out as the cause

and if you have bake set up why not bake all your MVC - less prone to typo
error

also since the cake google group is so active and cake q&a is set up I think
your better off using those official resources

- S


On 20 April 2010 18:34, netpumber  wrote:

> Hi!!
>
> I create a post in unofficial forum but as i can see there are no
> active members there...
>
> So if you can help me with my question please answer here (if you
> haven't got a forum account)
>
> Here is the post
>
> http://www.cakephpforum.net/index.php?showtopic=2041&st=0&#entry6964
>
> if you want i will rewrite it and here.. but if you can see it from
> the forum i think its ok!
>
> Thanks a lot guys for your time :)
>
> 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 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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 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: Routes - combine Custom expressions and `The pass key`

2010-04-20 Thread cricket
On Apr 20, 4:23 pm, tersmitten  wrote:
> Is it possible to use both the `expression` validation and `pass key`
> in one route? I would like to do something like:
>
>   Router::connect(
>     '/events/index/:year-:month-:day',
>     array(
>       'controller' => 'events',
>       'action' => 'index',
>     ),
>     array(
>       'year' => $Year,
>       'month' => $Month,
>       'day', $Day,
>       'pass' => array('year', 'month', 'day')
>     )
>   );
>
> But if I visit /events/index/2010-04-1434, 2010-04-1434 is passed to
> the controller while it's not a valid `day` I would say. What I'm
> trying to do is both `url validation` and `easy passing`. Is this
> possible, and how?

Use these regexps:

Router::connect(
'/events/:year/:month/:day,
array(
'controller' => 'events',
'action' => 'index'
),
array(
'year' => '2[0-9]{3}',
'month' => '0[1-9]|1[012]',
'day' => '0[1-9]|1[0-9]|2[0-9]|3[01]',
'pass' => array('year', 'month', 'day')
)
);

function index($year = null, $month = null, $day = null)
{
...

This way, you do not need 'index' in the URL.

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 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: Annoying letter in layout positioned in top left corner when changing sever

2010-04-20 Thread mpeshev
I found the issue. I deleted the whole project from the dev server and
redeployed it from the test one. Everything was OK except the
debugging info at the bottom. Replacing the core.php with the
deployment one got the bug popped up again. So there was a small 'd'
before the PHP tag in core.php in the config folder.

This should have happen during deployment as a bug in uploading files
if a server has crashed meanwhile. Sorry for keeping you busy with
that issue, but I did check out my controllers and views - never
thought of checking the configs as well :)

Thanks again for the brainstorming - config/core.php replaced && case
closed.

On Apr 20, 11:11 pm, MST  wrote:
> I had this same problem a couple of months ago.  I ended up using a
> hex editor to delete a few characters off the beginning of the file,
> which fixed it.  I still have no clue what may have caused it to
> appear in the first place.  If you try it, don't forget to make a
> backup copy of your file :)
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: mac users, which ide are you using to develop cakephp?

2010-04-20 Thread skitle
Coda. Disclaimer: You will hate every other editor once you use it.

On Apr 20, 10:24 am, Jamie  wrote:
> Textmate. It's worth it.
>
> On Apr 18, 9:14 pm, Bryan Lim  wrote:
>
>
>
>
>
> > Hi all,
>
> > mac users, which ide are you using to develop cakephp? to compile and
> > to debug?
>
> > I search the group here and realised this discussion is dated back to
> > 2009. So, I want to know if there's any changes?
>
> > thanks,
> > Bryan
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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


Advanced search form

2010-04-20 Thread viis
Is there anywhere a sample of an advanced search form that could be
used for advanced search

- where the user can select different criteria of search

( for example product type, select price range, select location,
color,  etc.)

would appreciate to see some code

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 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


Routes - combine Custom expressions and `The pass key`

2010-04-20 Thread tersmitten
Is it possible to use both the `expression` validation and `pass key`
in one route? I would like to do something like:

  Router::connect(
'/events/index/:year-:month-:day',
array(
  'controller' => 'events',
  'action' => 'index',
),
array(
  'year' => $Year,
  'month' => $Month,
  'day', $Day,
  'pass' => array('year', 'month', 'day')
)
  );

But if I visit /events/index/2010-04-1434, 2010-04-1434 is passed to
the controller while it's not a valid `day` I would say. What I'm
trying to do is both `url validation` and `easy passing`. Is this
possible, and how?

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 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


Plugin to App Containable Behavior Not Working

2010-04-20 Thread slickricky


I think this question will be clear from this example...

Why doesn't this work when placed in a plugin
$this->Timesheet->contain('TimesheetTime.Project');

It works if you move it to the main /app/controllers

BTW, I'm specifically referring to ".Project" (read: dot Project)

Where as this does work in the plugin
$this->Timesheet->contain('TimesheetTime');

And if I move to the timesheet_times_controller.php in the plugin this
works...
$this->Timesheet->contain('Project');


So this is revolving around the second level of recursion not working
in plugins.   (Because yes, the model TimesheetTime is associated with
Project), but it still throws the error...  Model "TimesheetTime" is
not associated with model "Project"

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 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


NewBie Help Creating a simple Cake Blog, Return 404 Error

2010-04-20 Thread netpumber
Hi!!

I create a post in unofficial forum but as i can see there are no
active members there...

So if you can help me with my question please answer here (if you
haven't got a forum account)

Here is the post

http://www.cakephpforum.net/index.php?showtopic=2041&st=0&#entry6964

if you want i will rewrite it and here.. but if you can see it from
the forum i think its ok!

Thanks a lot guys for your time :)

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 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: How to make a view that interacts using multiple models

2010-04-20 Thread cricket
On Apr 20, 3:34 am, "Pablo Vergara B." 
wrote:
>
> Well this is the thing:
> I'm making small invoice system. I already made my small database
> design (which can be seen in the image below), models and their
> associations, default controllers and views (using the cake bake
> script).
> I tried to follow ALL the cakePHP conventions and rules to make myself
> the things easier and it seems it worked.
>
> http://imgur.com/AqIAq.png"; title="Hosted by
> imgur.com">http://imgur.com/AqIAq.png
>
> http://imgur.com/AqIAq.png(direct link if the html link doesn't
> works)

As I understand the question, this is the view for
FacturasController::index. So, you want to display a list of invoices,
along with the Product name and the Client details. So, if your
associations are all correct, you should be able to do a find('all')
from Factura and it will pull in the Linea, Product, and Client
details. Try setting 'recursive' to 2 and see what it returns. Even
better, use ContainableBehavior:

$this->set(
'data',
$this->Factura->find(
'all',
'contain' => array(
'Linea' => array(
'Product'
),
'Cliente'
)
)
);

I think that should work. Make sure to add Containable to the Facturs
model's $actsAs array (or to AppModel's to make it available
everywhere).

Add debug($data) at the top of your view to see the array structure.

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 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: Annoying letter in layout positioned in top left corner when changing sever

2010-04-20 Thread MST
I had this same problem a couple of months ago.  I ended up using a
hex editor to delete a few characters off the beginning of the file,
which fixed it.  I still have no clue what may have caused it to
appear in the first place.  If you try it, don't forget to make a
backup copy of your file :)

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 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


Fwd: Fatal Error Class I18n not found

2010-04-20 Thread Amber Hill
-- Forwarded message --
From: Amber Hill 
Date: Mon, Apr 19, 2010 at 6:09 PM
Subject: Fatal Error Class I18n not found
To: cake-php@googlegroups.com


Hello frnds,

I have created a table and ran bake to create models, view and controller.
But it gave me this error "Fatal Error Class I18n not found".
Can u plz help me as to how can I resolve the issue.

Thanks, Appreciate it.





-- 
Warm Regards
Amber Hill

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 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: Is it possible to write common code in one function and i have to call that function when i was required

2010-04-20 Thread Fernando Z. Bob
Maybe you can do something like this:


APP_CONTROLLER:
function _mycode(){
$x = 8;
$y = 10;
return $x + $y;
}



USERS CONTROLLER:

function something(){
echo $this->_mycode();
}

function something_else(){
echo $this->_mycode();
}



Bye

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 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: Annoying letter in layout positioned in top left corner when changing sever

2010-04-20 Thread John Andersen
I would think that the issue should be in one of the view files as it
appears in the body part.
But as Cricket stated, the BOM (as it is named) is not the reason for
the "d" and I even tried to write the hexadecimal codes in a page and
even saved one of my views with the BOM, nothing happened!

Is there some javascript which runs and inserts elements in your html
on load?
Do you have any CSS which inserts something before or after an
element?

I am just throwing ideas up into the sky, but hopefully one of them
may ring a bell :)
Enjoy,
   John

On Apr 20, 8:34 pm, mpeshev  wrote:
> Tried changing the encoding of the master layout, unfortunately
> nothing happens.
>
[snip]

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 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: Bookmarkable AJAX URLs

2010-04-20 Thread jacmoe
A page reload doesn't have to mean that your chat is reloaded.
Especially not if the chat is ajax-only.
That should be independent of which page the user is on.
Think parallel.

On Apr 20, 7:57 am, Dmitry Shevchenko  wrote:
> Thank you for you advices, but I can't stop using ajax on my site, I
> have a chat window on my pages, so if page will reloaded - I have to
> relogin user to chat - this will overload chat server.
> I knew about SEO problems, but I think we could fix it by sitemap and
> robots.txt
>
> So I needed a solution, how to wrote correct route with using # ,
> like- domain.com/#/controller/action/params
> I need  to explaine route ignor first #
>
> Something simmilar to facebook urls - where most of all urls have a #!/
> url
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: Blog Tutorial: Link doesn't work

2010-04-20 Thread John Andersen
I haven't changed any paths in the configuration, so you should be
able to just move your cake directory and the application directory to
the root level. Make sure you always make a backup before doing
something like this :)

Also I am using virtual servers in my apache configuration, so my
application URL always is the application/webroot directory, not the
application directory.
Enjoy,
   John

On Apr 20, 8:00 pm, Cake-it  wrote:
> Could you tell me what I need to adjust in order to achieve a
> directory structure like yours? Are there any changings in the config
> file necessary?
>
> On 19 Apr., 18:34, John Andersen  wrote:
>
>
>
> > I can't tell you, as I have cake and my app at the root level and uses
> > apache virtual servers to ensure that the correct app is connected.
>
> > My hierarchy looks like:
> > ...htdocs/cake
> > ...htdocs/28871 = app 1
> > ...htdocs/28872 = app 2
> > etc.
>
> > and my virtual servers points to /28871/webroot and /28872/webroot
> > respectively.
>
> > Hopefully someone else may be able to help you with this issue. Did
> > you try my last suggestion in my previous post?
> > Enjoy,
> >    John
>
> > On Apr 19, 7:14 pm, Cake-it  wrote:> I have my 
> > cake folder at the same hierarchy as the app folder. But the
> > > entire project is located in a subfolder, which has the same name:
> > > cake because I have also other projects running on this server. My
> > > hierarchy looks like this:
> > > ...htdocs/cake
> > > ...htdocs/cake/app
> > > ...htdocs/cake/cake
>
> > > Does cake have a problem with this directory structure? What do I have
> > > to do in order to get the project running?
>
> > > Thanks and best regards
>
> > > Cake-it
>
> > [snip]
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: Annoying letter in layout positioned in top left corner when changing sever

2010-04-20 Thread mpeshev
Tried changing the encoding of the master layout, unfortunately
nothing happens.

On Apr 20, 5:45 pm, John Andersen  wrote:
> How does your layout file look like?
> Which variable is being output after the body tag? - the
> $content_for_layout or other?
>
> With regard to the view files and saving as unicode/utf-8, my issue is
> that if you save them as unicode, an additional 4 bytes (maybe 2) are
> added to the beginning of the file, and that may be the reason for the
> "d" in your presentation. Hopefully someone will correct me, should I
> be wrong :)
>    John
>
> On Apr 20, 4:29 pm, mpeshev  wrote:
>
> > John,
>
> > According to Firebug the 'd' is the first symbol after the body tag,
> > but the CSS link tag is next to the 'd'. This is not the case when I
> > open the source code of course.
>
> > It is like that:
>
> > ...
> > 
> > d
> > 
> > ...
>
> > All my project is UTF-8 as well as the other projects of mine (I do
> > use Cyrillic symbols). The same project is mirrored on my test server
> > (different machine, same hosting provider) with no such bug. I've set
> > the encoding in the config and database files.
>
> > I've removed all blank spaces in my app_controller and my layouts. Any
> > other ideas?
>
> > Thanks for the help so far.
>
> [snip]
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: Bookmarkable AJAX URLs

2010-04-20 Thread Miles J
Then make the chat AJAX only, not the page. AJAX is primarily used for
small sections on the site.

On Apr 19, 10:57 pm, Dmitry Shevchenko  wrote:
> Thank you for you advices, but I can't stop using ajax on my site, I
> have a chat window on my pages, so if page will reloaded - I have to
> relogin user to chat - this will overload chat server.
> I knew about SEO problems, but I think we could fix it by sitemap and
> robots.txt
>
> So I needed a solution, how to wrote correct route with using # ,
> like- domain.com/#/controller/action/params
> I need  to explaine route ignor first #
>
> Something simmilar to facebook urls - where most of all urls have a #!/
> url
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: modelClass value changing - bug of feature?

2010-04-20 Thread Miles J
The $modelClass is only created when you do not define the $uses.

On Apr 20, 8:45 am, Leonid Mamchenkov  wrote:
> Hi,
>
> On Tue, Apr 20, 2010 at 18:04, jharris  wrote:
>
> > Since you're using multiple models in your controller (the $uses var),
> > I think Cake is just getting confused. On construct, it probably pulls
> > the model name from the controller name (like how you used
> > Inflector::singularize()) before it loads models. Then, in the actions
> > it probably pulls the first model in the $uses array because the
> > models have been loaded. In this case, Log.
>
> OK, thanks.  That's exactly what I ended up doing.  Added a method to
> app_controller.php which looks like this:
>
>    function getModelClass() {
>         return Inflector::singularize($this->name);
>     }
>
> Works like a charm. :)
>
> > I would recommend against the $uses array unless absolutely necessary.
> > Use App::import() to bring it in, or ClassRegistry::init() to load it
> > when needed. Or bind the Log model to your Ship one, if appropriate.
>
> Is there somewhere I can read more on about this?  I've been following
> 'The Book' so far.
>
> --
> Leonid Mamchenkovhttp://mamchenkov.net
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: Blog Tutorial: Link doesn't work

2010-04-20 Thread Cake-it
Could you tell me what I need to adjust in order to achieve a
directory structure like yours? Are there any changings in the config
file necessary?

On 19 Apr., 18:34, John Andersen  wrote:
> I can't tell you, as I have cake and my app at the root level and uses
> apache virtual servers to ensure that the correct app is connected.
>
> My hierarchy looks like:
> ...htdocs/cake
> ...htdocs/28871 = app 1
> ...htdocs/28872 = app 2
> etc.
>
> and my virtual servers points to /28871/webroot and /28872/webroot
> respectively.
>
> Hopefully someone else may be able to help you with this issue. Did
> you try my last suggestion in my previous post?
> Enjoy,
>    John
>
> On Apr 19, 7:14 pm, Cake-it  wrote:> I have my cake 
> folder at the same hierarchy as the app folder. But the
> > entire project is located in a subfolder, which has the same name:
> > cake because I have also other projects running on this server. My
> > hierarchy looks like this:
> > ...htdocs/cake
> > ...htdocs/cake/app
> > ...htdocs/cake/cake
>
> > Does cake have a problem with this directory structure? What do I have
> > to do in order to get the project running?
>
> > Thanks and best regards
>
> > Cake-it
>
> [snip]
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: App::import()

2010-04-20 Thread davido
Hello!

Thank you a lot!

I see!



On 20 Apr., 18:02, cricket  wrote:
> On Apr 20, 11:52 am, davido  wrote:
>
> > Hello!
>
> > I´m a newbie in cakephp so long. My question is: which class does
> > App::import() belongs to?
>
> It's the import() method of App class. See:
>
> http://api.cakephp.org/class/app
>
> The class is loaded by default. Calling the method like this means
> that you're not using a specific instance of the class.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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


reuseable Code with cakePHP

2010-04-20 Thread davido
Hello!

I´m a newbie in cakephp so long.

I have two controller that use the treehelper. On one it works and on
the other it does not.

Tree Helper:

Ex: http://www.schwarzefrauen.at/sidebars (works)
  http://www.schwarzefrauen.at/tags (works not!)

Basically my understandings are to customize cakephp framework for the
need of the application. Basically I underlay the same problem
everytime when I work with reuseable code like in the example above
and in the implemantation of a news plugin.

Plugin:

Ex: http://www.schwarzefrauen.at/about (works)
  http://www.schwarzefrauen.at/news (works not!)

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 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: App::import()

2010-04-20 Thread cricket
On Apr 20, 11:52 am, davido  wrote:
> Hello!
>
> I´m a newbie in cakephp so long. My question is: which class does
> App::import() belongs to?

It's the import() method of App class. See:

http://api.cakephp.org/class/app

The class is loaded by default. Calling the method like this means
that you're not using a specific instance of the class.

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 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: Print the AROS tree?

2010-04-20 Thread cricket
On Apr 19, 5:09 pm, xtraorange  wrote:
> Howdy all..
>
> Still not comfortable with cakephp yet.  What I'm looking to do here
> is just print the AROS tree structure so I can verify everything is
> where it should be (and so I can learn how to work with it later).
> How would I go about doing this?

You can get the AROs from inside your controller by going through the
ACL:

$data = $this->Acl->Aro->find(
'threaded',
array(
'recursive' => -1
)
);

The recursive param is important as you'll otherwise likely run out of
memory if you have many records.

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 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


App::import()

2010-04-20 Thread davido
Hello!

I´m a newbie in cakephp so long. My question is: which class does
App::import() belongs to?

Thank you for any answers!

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 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: Annoying letter in layout positioned in top left corner when changing sever

2010-04-20 Thread mpeshev
Cricket, as I mentioned in my previous comment, this is the output
from my Firebug. In my source code, the scripts/styles/meta are in the
head section as it should be. 'd' also doesn't exist in the whole
source. Really seams like some kind of buffer or filter that alters
the code in some way :\

John, I used to have a similar UTF problem in plain PHP, but never had
it in Cake. Is it possible to be a server/PHP configuration issue to
be set in php.ini?

Btw now I noticed that even empty view (actually a part of the admin
that has to be redirected) opens with a blank page with 'd'.

On Apr 20, 6:17 pm, cricket  wrote:
> On Apr 20, 9:29 am, mpeshev  wrote:
>
> > John,
>
> > According to Firebug the 'd' is the first symbol after the body tag,
> > but the CSS link tag is next to the 'd'. This is not the case when I
> > open the source code of course.
>
> > It is like that:
>
> > ...
> > 
> > d
> > 
>
> You should have that link tag inside the head, not the body.
>
> The "d" might be due to a string/array mixup when printing.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: date display

2010-04-20 Thread cricket
On Apr 20, 5:30 am, OpnetITGuru  wrote:
> hi i am getting a very bad date output on my form,i am still new in
> cakePHP framework.i want it to display in one horizintal line i.e
> showing  in the following manner (YMD) in a sigle horizontal  line not
> in vertical format like this:year displaying  in one line followed by
> month in another line.
>
> code in the form:                  echo $form->input('date logged',array('type'=>'date', 
> 'format'=>'Y-M-
> D'));
>         ?>

I think this is due to the HTML elements not having enough space and
wrapping. Are these displayed inside a table cell?

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 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: modelClass value changing - bug of feature?

2010-04-20 Thread Leonid Mamchenkov
Hi,

On Tue, Apr 20, 2010 at 18:04, jharris  wrote:
>
> Since you're using multiple models in your controller (the $uses var),
> I think Cake is just getting confused. On construct, it probably pulls
> the model name from the controller name (like how you used
> Inflector::singularize()) before it loads models. Then, in the actions
> it probably pulls the first model in the $uses array because the
> models have been loaded. In this case, Log.

OK, thanks.  That's exactly what I ended up doing.  Added a method to
app_controller.php which looks like this:

   function getModelClass() {
return Inflector::singularize($this->name);
}

Works like a charm. :)

> I would recommend against the $uses array unless absolutely necessary.
> Use App::import() to bring it in, or ClassRegistry::init() to load it
> when needed. Or bind the Log model to your Ship one, if appropriate.

Is there somewhere I can read more on about this?  I've been following
'The Book' so far.

--
Leonid Mamchenkov
http://mamchenkov.net

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 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: where do i put the external library in cakephp

2010-04-20 Thread Walther
Either one.

CakePHP is designed so that you only need one copy of the CakePHP
files even if you have lots of CakePHP applications. vendors is for
files that should be accessible to all apps, and app/vendors is for
only that one application.

On Apr 20, 5:08 am, Bryan Lim  wrote:
> do i put it at vendors or app/vendors?
>
> it is supposed to be used in one of the controller.
>
> On Apr 19, 4:02 am, thatsgreat2345  wrote:
>
>
>
> > Put it in vendors folder.
> > Here is an example showing you how to import a vendor if it doesn't
> > follow cake conventions naming 
> > wise.http://book.cakephp.org/view/579/Loading-Files
>
> > On Apr 18, 12:29 pm, Bryan Lim  wrote:
>
> > > hi all,
>
> > > if i am using the twitterlibphp library, where should i put this
> > > library in?
>
> > > so that require "twitter.lib.php"; will work?
>
> > > thanks,
> > > bryan
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups 
> > > "CakePHP" group.> To post to this group, send email 
> > > tocake-...@googlegroups.com
> > > To unsubscribe from this group, send email 
> > > to>cake-php+unsubscr...@googlegroups.comfor more options, visit this 
> > > group athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.To post to this group, send email 
> > tocake-...@googlegroups.com
> > To unsubscribe from this group, send email 
> > tocake-php+unsubscr...@googlegroups.comfor more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: Problem with Auth Component hashes

2010-04-20 Thread Stefano Martins
Duh, I forgot about the salt value and added the user in the users
table without it.

Thanks, people!

On 19 abr, 04:50, WebbedIT  wrote:
> If wanting to compare your hashed password with a salt inflected
> hashed string use
>
> if ($password == $this->Auth->password($password_confirm))
>
> or
>
> if ($password == Security::hash(Configure::read('Security.salt') .
> $password_confirm)
>
> HTH
>
> Paul
>
> On Apr 18, 5:24 pm, Zaky Katalan-Ezra  wrote:
>
>
>
> >  I think the Auth uses a salt.
>
> > On Sun, Apr 18, 2010 at 6:43 PM,StefanoMartins wrote:
>
> > > Hello folks,
>
> > > As I was studying CakePHP and the Auth Component, I've found out that
> > > it's not using sha1 hashes - or at least it doesn't seems to - by
> > > default. I had to manually set it to use md5 hashes, following the
> > > instructions given by the Cookbook. For the string "stefano", Cake's
> > > generating the "35b914b05db99937e255f0eaebd3ac89f804a1cc", while the
> > > sha1() function generates the
> > > "80980fcaf2ab3f243874695f57b2ed065d8e67e4" hash for the "stefano"
> > > string.
>
> > > Am I doing something wrong?
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > > with their CakePHP related questions.
>
> > > 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.comFor
> > >  more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> > --
> > Regards,
> > Zaky Katalan-Ezra
> > QA Administratorwww.IGeneriX.com
> > Sites.IGeneriX.com
> > 054-7762312
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: mac users, which ide are you using to develop cakephp?

2010-04-20 Thread Jamie
Textmate. It's worth it.

On Apr 18, 9:14 pm, Bryan Lim  wrote:
> Hi all,
>
> mac users, which ide are you using to develop cakephp? to compile and
> to debug?
>
> I search the group here and realised this discussion is dated back to
> 2009. So, I want to know if there's any changes?
>
> thanks,
> Bryan
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: Annoying letter in layout positioned in top left corner when changing sever

2010-04-20 Thread cricket
On Apr 20, 10:45 am, John Andersen  wrote:
> How does your layout file look like?
> Which variable is being output after the body tag? - the
> $content_for_layout or other?
>
> With regard to the view files and saving as unicode/utf-8, my issue is
> that if you save them as unicode, an additional 4 bytes (maybe 2) are
> added to the beginning of the file, and that may be the reason for the
> "d" in your presentation. Hopefully someone will correct me, should I
> be wrong :)

I believe you're thinking of the byte order marker (BOM). I don't
think it's that, as it would be at the very beginning of the file.
Also, it wouldn't (AFAIK) be interepreted by the browser as a "d".
See:

http://unicode.org/faq/utf_bom.html#BOM

No, I don't understand all of that completely :-0 I ran into this
issue once when receiving files from another developer who used
Homesite on Windows.

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 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: Annoying letter in layout positioned in top left corner when changing sever

2010-04-20 Thread cricket
On Apr 20, 9:29 am, mpeshev  wrote:
> John,
>
> According to Firebug the 'd' is the first symbol after the body tag,
> but the CSS link tag is next to the 'd'. This is not the case when I
> open the source code of course.
>
> It is like that:
>
> ...
> 
> d
> 

You should have that link tag inside the head, not the body.

The "d" might be due to a string/array mixup when printing.

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 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: how to get count of users for each event

2010-04-20 Thread cricket
On Apr 19, 10:54 pm, mdb  wrote:
> Hello
>
> Thanks for the reply.
>
> I think i didnt explain properly. The sample you show is for view page
> of each event.
>
> But my requirement is for the event display grid where you wont have a
> event id
>
> we get all events and display in a grid. In that grid we add one more
> column "no. of registrations",
> where we get the count of users registered.

If you used counterCache, your events table would have an extra
column, event_registration_count, that you can use in any view.

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 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: Special Cade for belongsTo association

2010-04-20 Thread cricket
On Apr 19, 5:46 pm, MikeBates  wrote:
> I'm trying to limit an association between 2 models using the conditions key.
> It works great in the 'parent' Model, but I can't work out how to get it
> working properly in the 'child' Model.
>
> Here's the relevant info from the models:
> Product( 'id', 'name' );
> ProductLoan( 'id', 'product_number', 'product_numbr_is_id' );
>
> The hasMany association works fine in the Product Model:
> var $hasMany = array(
>                 'ProductLoan' => array(
>                         'className' => 'ProductLoan',
>                         'foreignKey' => 'product_number',
>                         'dependent' => false,
>                         'conditions' => array(
>                                 'ProductLoan.product_number_is_id' => 1
>                         )
>                 );
>
> But I can't work out how to do the same thing in the belongsTo association
> in ProductLoan Model:
> var $belongsTo = array(
>                 'Product' => array(
>                         'className' => 'Product',
>                         'foreignKey' => 'product_number',
>                         'conditions' => array(
>                                 'ProductLoan.product_number_is_id' => 1
>                         ),
>                         'fields' => '',
>                         'order' => ''
>                 )
>         );

This will associate each Product with the full set of ProductLoan that
have product_number_is_id == 1. You need to refine that to associate
it to a specific record:

var $belongsTo = array(
'Product' => array(
'className' => 'Product',
'foreignKey' => 'product_number',
'conditions' => array(
'ProductLoan.product_number_is_id' =>
1,
'Product.id` =>
'ProductLoan.product_number'
),
'fields' => '',
'order' => ''
)
);

I think.

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 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: modelClass value changing - bug of feature?

2010-04-20 Thread jharris
Since you're using multiple models in your controller (the $uses var),
I think Cake is just getting confused. On construct, it probably pulls
the model name from the controller name (like how you used
Inflector::singularize()) before it loads models. Then, in the actions
it probably pulls the first model in the $uses array because the
models have been loaded. In this case, Log.

I would recommend against the $uses array unless absolutely necessary.
Use App::import() to bring it in, or ClassRegistry::init() to load it
when needed. Or bind the Log model to your Ship one, if appropriate.

In any case, try moving 'Ship' to the first item of the $uses array
and see if that works. I'd say this method is still unreliable.

hth



On Apr 20, 3:54 am, Leonid Mamchenkov  wrote:
> Hello,
>
> I came across a weird behaviour that I cannot figure out.  The API
> documentation for Controller class (http://api.cakephp.org/class/
> controller) describes the modelClass property in the following way:
>
> "This controller's primary model class name, the
> Inflector::classify()'ed version of the controller's $name property.
> Example: For a controller named 'Comments', the modelClass would be
> 'Comment'"
>
> This sounds exactly like what I need.  However, when I try to use, it
> doesn't always work this way.  Maybe because my controller is using
> several models, and the "primary" model is not the first one in the
> list.
>
> class ShipsController extends AppController {
>   var $name = 'Ships';
>   var $uses = array('Log', 'Ship');
>
>   function __construct() {
>     parent::__construct();
>     # die($this->modelClass); # prints out 'Ship' and dies, as
> expected
>   }
>
>   function index() {
>     die($this->modelClass); # prints out 'Log' and dies. Why Log?
>   }
>
> }
>
> I first noticed the problem using CakePHP 1.2.4.  I upgraded to
> CakePHP 1.2.6, but the problem is still there.  I checked and re-
> checked all my ShipsController and AppController code to make sure I
> don't modify the modelClass or any related logic.
>
> Can anyone shed some light on this issue?
>
> I can avoid this issue altogether by always putting the primary model
> of the controller as first item of the $uses list, or call
> Inflector::singularize($this->name), but it doesn't sound elegant,
> since the functionality is there and should work.
>
> Thanks.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: _controller convention

2010-04-20 Thread cricket
On Apr 20, 1:21 am, Bryan Lim  wrote:
> Hi all,
>
> according to the convention
>
> why is only controller named by "_controller" ? while model and view
> aren't following..

I think it's more an object-oriented convention than specific to Cake.
The class names need to be unique.

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 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 for different role users

2010-04-20 Thread cricket
On Apr 20, 3:16 am, Iqbal Santyaswardan  wrote:
> Ok, thanks, Cricket, I'll try that.  (I wonder what "slug" is...)

A slug is a URL-friendly name for an article, person, etc. Good for
search engines. So, if you had a user, Tom Sawyer, you could, eg. view
their profile from:

/users/tom-sawyer

Or, an article:
/blog/my-blog-post-title

> So it is the User that hasone [teacher/student] and not the other way
> around?

It's just one way to do it. I suppose one could do it the other way,
yes.

> Are teacher/student models still extensions of the user model
> or not?

In this example, no. They're associated with User model. You could
also have the other models extend the User class. I did do that once
but ran into all sorts of problems. But that was very early in my
experience with Cake so I was probably doing something wrong. I really
can't say which way is best.

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 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: Annoying letter in layout positioned in top left corner when changing sever

2010-04-20 Thread John Andersen
How does your layout file look like?
Which variable is being output after the body tag? - the
$content_for_layout or other?

With regard to the view files and saving as unicode/utf-8, my issue is
that if you save them as unicode, an additional 4 bytes (maybe 2) are
added to the beginning of the file, and that may be the reason for the
"d" in your presentation. Hopefully someone will correct me, should I
be wrong :)
   John

On Apr 20, 4:29 pm, mpeshev  wrote:
> John,
>
> According to Firebug the 'd' is the first symbol after the body tag,
> but the CSS link tag is next to the 'd'. This is not the case when I
> open the source code of course.
>
> It is like that:
>
> ...
> 
> d
> 
> ...
>
> All my project is UTF-8 as well as the other projects of mine (I do
> use Cyrillic symbols). The same project is mirrored on my test server
> (different machine, same hosting provider) with no such bug. I've set
> the encoding in the config and database files.
>
> I've removed all blank spaces in my app_controller and my layouts. Any
> other ideas?
>
> Thanks for the help so far.
[snip]

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 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: Checkbox

2010-04-20 Thread cricket
On Apr 20, 5:40 am, Lady Baleseng  wrote:
> thank you very much for the multiple checklist.it worked partly.i am able to
> pick the existing hobbies in my system,but now in my view form wen i tick
> the hobbies that i want added it does not add them,after i click on the
> submitt button.
>
> i also want to be able to edit the checklist at edit form.

What does your controller code look like? Also, what does the
submitted data look like? Add this:

function add()
{
   if (!empty($this->data))
   {
  die(debug($this->data));


That will display the submitted data array.

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 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: View (form->input) - Disable word wrap?

2010-04-20 Thread John Andersen
Just for your information, I have provided an example of your form,
available at:
http://jaa.myftp.org:28880/examples/seb88

There is a zip-file of the view file too, so you can compare with
yours.

The example is presented in IE and FF in the same way, without changes
to the CSS.
Enjoy,
   John

On Apr 20, 4:52 pm, sebb86  wrote:
> Okay, its done.
>
> Firefox solution:
> [code]
> .input
> {
>   width:45em;
>   float:none;
>
> }
>
> .input label
> {
>   width:25%;
>   float:left;
>
> }
>
> .input input
> {
>   width:50%;}
>
> [/code]
>
> Internet Explorer 8 solution:
> [code]
> .input
> {
>   width:45em;
>   float:none;
>
> }
>
> .input label
> {
>   width:25%;
>   float:none;
>
> }
>
> .input input
> {
>   width:50%;}
>
> [/code]
>
> Addition: maybe i've changed some source code in the cake.generic.css
> file.
> Unfortunately i cant find a solution for both, but its okay...
>
> Thanks a lot John!!!

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 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: How to make a view that interacts using multiple models

2010-04-20 Thread Mariano Agustin Reyes
Hola,
  Como va??? Yo soy de Argentina. Espero que sea esto lo que estabas
buscando, sino contame en español lo que necesitas y veo si te puedo dar una
mano. El único problema que tuve con una consulta similar a esta es que no
la pude ordenar por todos los campos, y no encontré como hacer eso por
ahora, pero el listado me lo hizo OK.

function index() {
  $this->Factura->recursive = 0;
  $this->paginate = array(
'Factura' => array(
  'joins' => array(
array(
  'table' => 'clientes',
  'alias' => 'Cliente',
  'type' => 'inner',
  'conditions' => array(
'Factura.cliente_id = Cliente.id'
  )
),
array(
  'table' => 'lineas_facturas',
  'alias' => 'LineasFactura',
  'type' => 'inner',
  'conditions' => array(
'Factura.id = LineasFactura.factura_id'
  )
),
array(
  'table' => 'lineas',
  'alias' => 'Linea',
  'type' => 'inner',
  'conditions' => array(
'Linea.id = LineasFactura.linea_id'
  )
),
array(
  'table' => 'productos',
  'alias' => 'Producto',
  'type' => 'inner',
  'conditions' => array(
'Linea.producto_id = Producto.id'
  )
)
  ),
  'fields' => array('Factura.numeroFactura', 'Factura.fecha',
'Cliente.rut', 'Cliente.apellidos', 'Cliente.nombres',
'Producto.descripcion', 'Linea.cantidad', 'Producto.precio')
)
  );
  $data = $this->paginate('Factura');
  $this->set('facturas', $data);
}

Saludos
Notinyes

PD: Acá te mandé el paginate, pero un find sería bastante similar.

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 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: View (form->input) - Disable word wrap?

2010-04-20 Thread sebb86
Okay, its done.

Firefox solution:
[code]
.input
{
  width:45em;
  float:none;
}

.input label
{
  width:25%;
  float:left;
}

.input input
{
  width:50%;
}
[/code]


Internet Explorer 8 solution:
[code]
.input
{
  width:45em;
  float:none;
}

.input label
{
  width:25%;
  float:none;
}

.input input
{
  width:50%;
}
[/code]

Addition: maybe i've changed some source code in the cake.generic.css
file.
Unfortunately i cant find a solution for both, but its okay...

Thanks a lot John!!!

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 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


modelClass value changing - bug of feature?

2010-04-20 Thread Leonid Mamchenkov
Hello,

I came across a weird behaviour that I cannot figure out.  The API
documentation for Controller class (http://api.cakephp.org/class/
controller) describes the modelClass property in the following way:

"This controller's primary model class name, the
Inflector::classify()'ed version of the controller's $name property.
Example: For a controller named 'Comments', the modelClass would be
'Comment'"

This sounds exactly like what I need.  However, when I try to use, it
doesn't always work this way.  Maybe because my controller is using
several models, and the "primary" model is not the first one in the
list.

class ShipsController extends AppController {
  var $name = 'Ships';
  var $uses = array('Log', 'Ship');

  function __construct() {
parent::__construct();
# die($this->modelClass); # prints out 'Ship' and dies, as
expected
  }

  function index() {
die($this->modelClass); # prints out 'Log' and dies. Why Log?
  }
}

I first noticed the problem using CakePHP 1.2.4.  I upgraded to
CakePHP 1.2.6, but the problem is still there.  I checked and re-
checked all my ShipsController and AppController code to make sure I
don't modify the modelClass or any related logic.

Can anyone shed some light on this issue?

I can avoid this issue altogether by always putting the primary model
of the controller as first item of the $uses list, or call
Inflector::singularize($this->name), but it doesn't sound elegant,
since the functionality is there and should work.

Thanks.

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 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


date display

2010-04-20 Thread OpnetITGuru
hi i am getting a very bad date output on my form,i am still new in
cakePHP framework.i want it to display in one horizintal line i.e
showing  in the following manner (YMD) in a sigle horizontal  line not
in vertical format like this:year displaying  in one line followed by
month in another line.

code in the form: input('date logged',array('type'=>'date', 
'format'=>'Y-M-
D'));
?>


this is my schema:


--
-- Table structure for table `operators`
--

CREATE TABLE `operators` (
  `hazard_id` int(10) unsigned NOT NULL,
  `area_id` int(10) unsigned NOT NULL,
  `rating_id` int(10) unsigned NOT NULL,
  `staff_id` int(10) unsigned NOT NULL,
  `date` datetime NOT NULL,
  `status_description` varchar(45) NOT NULL,
  `status` varchar(10) NOT NULL,
  `capturer_name` varchar(45) NOT NULL,
  `date_time` datetime NOT NULL,
  KEY `fk_operators_hazards` (`hazard_id`),
  KEY `fk_operators_areas` (`area_id`),
  KEY `fk_operators_ratings` (`rating_id`),
  KEY `fk_operators_staff` (`staff_id`)
);

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 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: Annoying letter in layout positioned in top left corner when changing sever

2010-04-20 Thread mpeshev
John,

According to Firebug the 'd' is the first symbol after the body tag,
but the CSS link tag is next to the 'd'. This is not the case when I
open the source code of course.

It is like that:

...

d

...

All my project is UTF-8 as well as the other projects of mine (I do
use Cyrillic symbols). The same project is mirrored on my test server
(different machine, same hosting provider) with no such bug. I've set
the encoding in the config and database files.

I've removed all blank spaces in my app_controller and my layouts. Any
other ideas?

Thanks for the help so far.

On Apr 20, 12:45 pm, John Andersen  wrote:
> Is it showing inside the body tag or before the html tag?
>
> If inside the body tag, check that your view files have not been saved
> as UTF8/unicode files, as that will add some additional information at
> the beginning of the file.
>
> If before the html tag, check your php files for data outside the  php ?> tags.
> Enjoy,
>    John
>
> On Apr 20, 12:28 pm, mpeshev  wrote:
>
>
>
> > I developed a small CMS with a really simple design for a school
> > course. When deploying on production, I have a small 'd' letter in the
> > top left corner that I cannot remove. It doesn't exist in my source
> > code, but it's caught by Firebug as the first symbol in my body.
>
> > I suppose it is kind of a buffer that outputs every time, but I have
> > no idea where or what kind of buffer.
>
> > I don't have any disturbing filters in my app_controller nor such a
> > symbol in the layout. On the other hand, this one works OK on another
> > server in the same hosting company.
>
> > By the way it is more of a PHP question than Cake related I think, the
> > symbol is output before the layout is fully loaded when refreshing.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: mac users, which ide are you using to develop cakephp?

2010-04-20 Thread tracyfloyd
+1 for TextMate

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 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: Media plugin: user model won't validate if the media file is not submitted

2010-04-20 Thread Nasko
After more thorough debugging, I've come to the conclusion that the
above IF test - if (!isset($Model->data[$Model->alias]['file'])) is
true, because in plugins/media/models/behaviors/transfer.php:213 there
are these lines:

if (TransferValidation::blank($file)) {
/* Set explicitly null enabling allowEmpty in rules act 
upon
emptiness */
return $Model->data[$Model->alias]['file'] = null;
}
This is exactly where the array at index 'file'  is being null-ed..

Is this by design and how am I to go about allowing my model to be
submitted without the media file?

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 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


Media plugin: user model won't validate if the media file is not submitted

2010-04-20 Thread Nasko
Hey all,

I would really be thankful for any tips as to what I might be doing
wrong.

I'm using Media plugin v. 0.60 with CakePHP 1.2.6 stable

Here's my setup: http://pastebin.com/QzsY6wNR

When I submit the media file, everything is okay. But if a file is not
submitted, i'm not getting the record inserted at all although all
validations return true.

As far as I've managed to debug execution flow of the add() action, it
all gets ruined around these lines:

plugins/media/model/behaviors/media.php:121:

if (!$Model->exists()) {
if (!isset($Model->data[$Model->alias]['file'])) {
unset($Model->data[$Model->alias]);
return true;
}
} else { ... }


This leads to having $this->data = array[0] after all behaviors'
callbacks have been executed


Am I failing to configure something so that new records do not depend
on the file being uploaded?

Thanks in advance!

Greetings,
Nasko

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 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: Is it possible to write common code in one function and i have to call that function when i was required

2010-04-20 Thread John Andersen
Or you can do one of the following:
1) If the redundant code is only used in one controller/model, then
extract the redundant code as a new private function in the controller/
model and call it where you need it from the other functions.
2) If the redundant code is used in more than one controller/model,
then extract the redundant code as a new function in the
app_controller/app_model and call it where you need it from the other
functions in each controller/model.
3) If the redundant code can be defined as an independent
functionality, then go with Edinei Luis Cipriani solution.
Enjoy,
   John

On Apr 20, 12:13 pm, Edinei Luis Cipriani  wrote:
> You can make a Componenthttp://book.cakephp.org/view/64/Creating-Components
>
> Best regards
[snip]

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 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: Annoying letter in layout positioned in top left corner when changing sever

2010-04-20 Thread John Andersen
Is it showing inside the body tag or before the html tag?

If inside the body tag, check that your view files have not been saved
as UTF8/unicode files, as that will add some additional information at
the beginning of the file.

If before the html tag, check your php files for data outside the  tags.
Enjoy,
   John

On Apr 20, 12:28 pm, mpeshev  wrote:
> I developed a small CMS with a really simple design for a school
> course. When deploying on production, I have a small 'd' letter in the
> top left corner that I cannot remove. It doesn't exist in my source
> code, but it's caught by Firebug as the first symbol in my body.
>
> I suppose it is kind of a buffer that outputs every time, but I have
> no idea where or what kind of buffer.
>
> I don't have any disturbing filters in my app_controller nor such a
> symbol in the layout. On the other hand, this one works OK on another
> server in the same hosting company.
>
> By the way it is more of a PHP question than Cake related I think, the
> symbol is output before the layout is fully loaded when refreshing.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: Checkbox

2010-04-20 Thread Lady Baleseng
thank you very much for the multiple checklist.it worked partly.i am able to
pick the existing hobbies in my system,but now in my view form wen i tick
the hobbies that i want added it does not add them,after i click on the
submitt button.

i also want to be able to edit the checklist at edit form.

On Mon, Apr 19, 2010 at 7:16 AM, cricket  wrote:

> On Apr 18, 6:24 pm, tomolang  wrote:
> > Hi im new in cakephp. so far i like it. but i have one problem.
> >
> > I dont know how to create checkboxs.
> >
> > I have a table that called hobbies and i would like to use checkboxs
> > to allow the users to select the hobbies they prefer and save this to
> > a table. then later the user can go and edit the selection.
> >
> > how do i do this.
>
> First, make sure your associations are correct.
>
> User model:
>
> var $hasAndBelongsToMany = array('Hobby');
>
> Hobby model:
>
> var $hasAndBelongsToMany = array('User');
>
> In your UsersController:
>
> function edit($id = null)
> {
>if (!empty($this->data))
>{
>...
>}
>
>/* this code will run when the user first loads the edit view,
> * as well as when the save is unsuccessful and form is re-displayed
> */
>$this->set(
>'hobbies',
>$this->User->Hobby->find('list')
>);
> }
>
>
> view:
>
> echo $form->input(
>'Hobby',
>array(
>'type' => 'select',
>'multiple' => 'checkbox'
>),
>$hobbies
> );
>
> 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 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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 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


Annoying letter in layout positioned in top left corner when changing sever

2010-04-20 Thread mpeshev
I developed a small CMS with a really simple design for a school
course. When deploying on production, I have a small 'd' letter in the
top left corner that I cannot remove. It doesn't exist in my source
code, but it's caught by Firebug as the first symbol in my body.

I suppose it is kind of a buffer that outputs every time, but I have
no idea where or what kind of buffer.

I don't have any disturbing filters in my app_controller nor such a
symbol in the layout. On the other hand, this one works OK on another
server in the same hosting company.

By the way it is more of a PHP question than Cake related I think, the
symbol is output before the layout is fully loaded when refreshing.

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 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


How to make a view that interacts using multiple models

2010-04-20 Thread Pablo Vergara B.
Hello guys from the community. This is my first post (well, it's a
question anyways) since I joined the group because I'm very new to
this amazing framework. Please sorry if my English is far from being
perfect, I'm trying to do my best even if it's not my native language.
(I'm from Chile, Latin America)

Well this is the thing:
I'm making small invoice system. I already made my small database
design (which can be seen in the image below), models and their
associations, default controllers and views (using the cake bake
script).
I tried to follow ALL the cakePHP conventions and rules to make myself
the things easier and it seems it worked.

http://imgur.com/AqIAq.png"; title="Hosted by
imgur.com">http://imgur.com/AqIAq.png

http://imgur.com/AqIAq.png (direct link if the html link doesn't
works)

My problem is that I can't find how to make a view (for the "index"
action) where I could have and handle this information:
- Invoice number (numeroFactura into "facturas" table)
- Invoice date (fecha into "facturas" table)
- Rut (rut inro "clientes" table)
- Names (nombres into "clientes" table)
- Last names (apellidos into "clientes" table)
- Product name (descripcion into "productos" table)
- Product quantity (cantidad into "lineas" table, lineas table is for
the "invoice lines")
- Product value (precio ino "productos" table)

Should I make this view customizing the "lineas_facturas" default view
for the "index" action? or ..
Can I even make the view I need customizing the "facturas" or "lineas"
default view for the "index" action? Maybe using some kind of tricky
code to relate the models I need to get the data from?

Thanks in advance people, I'm still a newbie but I don't give up! Even
if I have to read in English being an Spanish language native guy,
this framework worth it!
Greetings from Chile!

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 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: Is it possible to write common code in one function and i have to call that function when i was required

2010-04-20 Thread Edinei Luis Cipriani

You can make a Component
http://book.cakephp.org/view/64/Creating-Components

Best regards
On 20/04/2010, at 05:52, Narendra Padala wrote:


Hi all..!
I am new to cakephp i have problem, i have to use same code in
multiple functions, example



My Problem is, how can i avoid this code redundancy , Is their any the
common code will write one file and i have to include file, or i have
to write the common code in one function and
i have to call in the controller functions. Please help me
outthanks in advance

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  
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


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 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


Is it possible to write common code in one function and i have to call that function when i was required

2010-04-20 Thread Narendra Padala
 Hi all..!
 I am new to cakephp i have problem, i have to use same code in
multiple functions, example



My Problem is, how can i avoid this code redundancy , Is their any the
common code will write one file and i have to include file, or i have
to write the common code in one function and
i have to call in the controller functions. Please help me
outthanks in advance

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 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: drop-down list - displayed values

2010-04-20 Thread Jeremy Burns
Not sure if this is your issue, but by default it will show a drop down made up 
by the 'id' and 'name' columns. If it can't find those it reverts to a plain 
text field.

Jeremy Burns
jeremybu...@me.com
On 19 Apr 2010, at 18:51, morficus wrote:

> Hey guys,
> 
> I'm new to cakePHP and I love it. But I have ran in to a little snag
> with the auto-baked views.
> 
> In them, I have a drop-down list which shows what group or client a
> certain user is to be associated with (when creating new user
> account). The issue... is that in on view the drop-down list box shows
> the name of the items, but in other places it shows the ID's
> How do I get it to show the names? I've looked at the model's and they
> appear to be correct - so maybe I chose the wrong datatype when adding
> data validation to the views? I've also made sure that my DB rows are
> following the cakePHP naming conventions.
> 
> I could always manually re-write the particular view, but for the
> future... I would like to no have to do this.
> Thanks in advance :-)
> 
> 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 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

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 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 for different role users

2010-04-20 Thread Iqbal Santyaswardan
Ok, thanks, Cricket, I'll try that.  (I wonder what "slug" is...)

So it is the User that hasone [teacher/student] and not the other way
around?  Are teacher/student models still extensions of the user model
or not?

iqbal s.

On Wed, Apr 14, 2010 at 10:07 AM, cricket  wrote:
> On Apr 13, 2:44 am, iqbal-san  wrote:
>> Hello,
>>
>> I'm wondering how best to define the models for users with roles,
>> where I want to save a different set of data for each role.  Plus,
>> there will be relationships between the roles.  For example, there is
>> user type student and user type teacher, where a teacher have many
>> students.  Both type of users have some similar methods and attributes
>> (e.g. can log into the system, both attend school during the same
>> academic year), but each also have its own unique attributes and
>> functions.
>>
>> Currently I'm trying to set teacher and students as an extension of
>> the User model, but I found some hassle in bringing up each role's
>> data, for example after login.
>>
>> Should they be totally separate models? but then how to handle the
>> login?
>>
>> I didn't find enough info by googling, but perhaps i entered the wrong
>> term?  If this have been discussed in this group before, please point
>> me in the right direction.
>
> I've run into this problem several times now and have tried a few
> different solutions. The latest is to include model & association_key
> columns in the users table. I then also include a $user_id in the
> associated tables. This is actually working quite well. One thing I
> really didn't like doing was creating the user_id column as allowing
> NULL. It was either that, or setting the users table columns as NULL.
> Chicken & egg issue when first creating a user.
>
> So, here's a few notes about what I did, adjusted for your scenario.
>
> Usermodel:
>
> var $hasOne = array(
>        'Student' => array(
>                'className'  => 'Student',
>                'foreignKey' => 'user_id',
>                'dependent' => true
>        ),
>        'Teacher' => array(
>                'className'  => 'Teacher',
>                'foreignKey' => 'user_id',
>                'dependent' => true
>        ),
>        'Administrator' => array(
>                'className'  => 'Administrator',
>                'foreignKey' => 'user_id',
>                'dependent' => true
>        )
> );
>
> Of course, you'll end up with empty arrays for the model the User
> isn't. But I never run a find on User anyway.
>
> var $actsAs = array(
>        'Sluggable' => array(
>                'translation' => 'utf-8',
>                'separator' => '-',
>                'label' => array('first_name', 'last_name'),
>                'length' => 64,
>                'overwrite' => true
>        ),
>        'AutoField' => array(
>                'full_name' => array(
>                        'fields' => array('first_name', 'last_name'),
>                        'mask' => '%s %s'
>                )
>        )
> );
>
>
> Student:
>
> var $belongsTo = array(
>        'User' => array(
>                'className' => 'User',
>                'foreignKey' => 'user_id'
>        )
> );
>
> This could go in AppModel except that each User type may have
> different things I need contained. Also there are other models, not
> associated with User, that I want to find by slug.
>
> public function findBySlug($slug)
> {
>        return $this->find(
>                'first',
>                array(
>                        'fields' => array('*'),
>                        'conditions' => array('User.slug' => $slug),
>                        'contain' => array(
>                                'User' => array(
>                                        'fields' => array(
>                                                'User.email',
>                                                'User.first_name',
>                                                'User.last_name',
>                                                'User.slug'
>                                        )
>                                )
>                        )
>                )
>        );
> }
>
> Note that you can have User model in the conditions, just like a table
> in a left join.
>
>
> I create each type in UsersController:
>
> /**
>  * Add a new User.
>  * A new Administrator, Member, or Affiliate will also be created.
>  *
>  * @param       void
>  * @returns     void
>  */
> function admin_add($model = null)
> {
>        if (!empty($this->data))
>        {
>                $model = $this->data['User']['model'];
>
>                if ($this->User->{$model}->save($this->data))
>                {
>                        $association_key = 
> $this->User->{$model}->getLastInsertID();
>                        $this->data['User']['association_key'] = 
> $association_key;
>
>                        $password = $this->Password->create();
>                        $this->data['User']['password'] = $password['hash'];
>
>