Re: I want to select information from a related table inside of my view function and present that information in my view.thtml file

2006-09-09 Thread rnady

As a cakePHP newbie, I know it would be very helpful to be able to have
a "troubleshooting guide" or something along those lines in the manual.
 I am still working on wrapping my head around associations and even
though I saw mentions of debugging I was unable to find the answer to
how to turn it on.  If there were a troubleshooting guide that would
have been where I would have turned first.

I am willing to help to make this a reality.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: I want to select information from a related table inside of my view function and present that information in my view.thtml file

2006-09-09 Thread Chris Hartjes

On 9/8/06, John David Anderson (_psychic_) <[EMAIL PROTECTED]> wrote:
>
>
> On Sep 8, 2006, at 6:23 PM, Chris Hartjes wrote:
>
> > Nate, is there someplace on the CakePHP web site that info could go or
> > should I simple add a blog posting and drive traffic there instead? :)
>
> How about I base a chapter in the manual off of your blog post? :)
>
> -- John

Hey John, that would probably be the best idea.

-- 
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: I want to select information from a related table inside of my view function and present that information in my view.thtml file

2006-09-08 Thread [EMAIL PROTECTED]

How about a FAQ?  Since that is exactly what these are.  Like the 20
most common problems \ questions.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: I want to select information from a related table inside of my view function and present that information in my view.thtml file

2006-09-08 Thread John David Anderson (_psychic_)


On Sep 8, 2006, at 6:23 PM, Chris Hartjes wrote:

> Nate, is there someplace on the CakePHP web site that info could go or
> should I simple add a blog posting and drive traffic there instead? :)

How about I base a chapter in the manual off of your blog post? :)

-- John

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: I want to select information from a related table inside of my view function and present that information in my view.thtml file

2006-09-08 Thread Chris Hartjes

On 9/8/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> That's okay Rnady, Chris doesn't like me either.  Although I have to
> agree, debugging is pretty basic to CakePHP and setting it usually
> shows what is going on to generate the SQL and reveals pretty quickly
> where problems lie.

It's not that I don't like you Troy.  I usually get to know people
before I declare I don't like them. ;)
We just disagree on some issues, that's all.

I've been on the mailing list for a few months now and I agree with
Troy that something needs to be done to point newcomers to CakePHP to
a place where strategies for debugging can be found.  Seeing the same
questions asked over and over again pretty much confirms that.

Nate, is there someplace on the CakePHP web site that info could go or
should I simple add a blog posting and drive traffic there instead? :)

Wow.  Troy and I actually agree on something.
-- 
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: I want to select information from a related table inside of my view function and present that information in my view.thtml file

2006-09-08 Thread rnady

[EMAIL PROTECTED] wrote:
> That's okay Rnady, Chris doesn't like me either.  Although I have to
> agree, debugging is pretty basic to CakePHP and setting it usually
> shows what is going on to generate the SQL and reveals pretty quickly
> where problems lie.
>
> http://manual.cakephp.org/chapter/configuration
>
> The explanation of the DEBUG variable is in this chapter of the manual.
>
>
> Once you actually learn CakePHP you will see this is as rudimentary to
> CakePHP as pouring yourself a glass of water.  It is because of this
> and the lack of understanding what DEBUG settings do and other things
> that get repeated over and over that really gets tiring to people.  And
> think Chris has only been on the list for a little over a month.
>
> In all actuality DEBUG isn't obscure to this group, it is mentioned in
> over 20 pages of posts.  It is obscure in recent posts as most people
> are now seasoned CakePHP users.

Troy,
In general I have been having a blast with CakePHP and I am looking
forward to knowing it well. I agree that debugging is basic to any
development and I have been very frustrated that I was unable to see
the output that would let me debug my problems.  Even though debug is
prevalent here, I did many searches in various ways here and did not
find the answer.  I think what happened was I searched in the Google
groups box instead of the search this group box.  I kept getting
results outside of the cakePHP group - I didn't figure out why until
this afternoon.  I also searched from the cakePHP.org site and looked
all over the manual based on those searches.  Obviously the information
is there, but my point earlier was that I did look for it and didn't
find it and had I found it I wouldn't have iritated anyone with my
question.  I understand how tiring it is when a question gets repeated
over and over again which is why I did all of the searching I did
before posting.

Chris,
You did not give me a stupid anwser - you gave me an answer that has
already and will continue to save me time, energy, effort, etc.  I
appreciate that.  It will probably be a big reason that I will continue
working with CakePHP.  I misspoke when I said that you do not help
people. I had no way of knowing what you have or have not done to help
people.  It was my response to what I felt was you saying that I
shouldn't be trying to develop anything because I wasn't smart enough
to know the basics.  I appologize for my response.  

Rnady


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: I want to select information from a related table inside of my view function and present that information in my view.thtml file

2006-09-08 Thread [EMAIL PROTECTED]

That's okay Rnady, Chris doesn't like me either.  Although I have to
agree, debugging is pretty basic to CakePHP and setting it usually
shows what is going on to generate the SQL and reveals pretty quickly
where problems lie.

http://manual.cakephp.org/chapter/configuration

The explanation of the DEBUG variable is in this chapter of the manual.


Once you actually learn CakePHP you will see this is as rudimentary to
CakePHP as pouring yourself a glass of water.  It is because of this
and the lack of understanding what DEBUG settings do and other things
that get repeated over and over that really gets tiring to people.  And
think Chris has only been on the list for a little over a month.

In all actuality DEBUG isn't obscure to this group, it is mentioned in
over 20 pages of posts.  It is obscure in recent posts as most people
are now seasoned CakePHP users.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: I want to select information from a related table inside of my view function and present that information in my view.thtml file

2006-09-08 Thread Chris Hartjes

I teach my kids that there is no such thing as a stupid question, only
stupid answers.  Did I give a stupid answer?  You thought I did, so
you're probably right.  I'm a big boy and can handle being told that I
was rude to somebody, regardless of what I may think.  I thought I was
providing answers that were pretty obvious, even more so now that you
revealed you're not a hapless newbie and do have experience building
stuff.  My response offended you, and that's too bad.  Chalk it up to
two long weeks of little sleep and too much work.  Next time, I'll
take that deep breath and present the same info without any
commentary.

I do like to help developers fix problems and pass knowledge onto
them.  I write magazine articles, contribute code to open source
projects, and I'm even lucky enough to be speaking at the upcoming
php|works conference about what PHP developers can learn from Ruby on
Rails.  If that doesn't look like a person who likes helping people,
then perhaps I don't understand what it really means to help people.

I'm glad it was only a problem with associations as they are very
tricky if you've never used them before.  Heck, so is MVC.

-- 
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: I want to select information from a related table inside of my view function and present that information in my view.thtml file

2006-09-08 Thread rnady

That was it. Thank you jonlb!
Rnady


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: I want to select information from a related table inside of my view function and present that information in my view.thtml file

2006-09-08 Thread rnady

Chris Hartjes wrote:

> Step #1:  make sure you have your app in SQL debugging mode by making
> sure DEBUG is set to 2 in your core.php config file.
> Step #2: Look at the SQL output it generates and make sure the queries
> are actually pulling the information you are expecting
> Step #3: add a 'debug($data);' statment somewhere in your controller
> so you can actually see how the data array is structured.
>
> I know it looks like I'm picking on Mr. Dustin here, but this is
> *basic* debugging technique.  You can't even begin to build anything
> bigger than "Hello world" if you don't learn how to debug your code
> effectively.  I don't mind helping people out, but it gets harder and
> harder to supress my inner cranky developer when basic debugging rules
> aren't being followed.
>
> Perhaps there should be a chapter in the manual (or someplace else) on
> how to effectively debug CakePHP applications.
>
> I have donned my flame-proof suit and await your responses. ;)
>
> --
> Chris Hartjes
>
> "The greatest inefficiencies come from solving problems you will never have."
> -- Rasmus Lerdorf
>
> @TheBallpark - http://www.littlehart.net/attheballpark
> @TheKeyboard - http://www.littlehart.net/atthekeyboard

Chris,
Thank you for such a great welcome to this group. While I do not agree
with your tone or your statement that I don't know how to follow basic
rules, I will respond with:

#1 -  I have built applications and I know how to debug code, but I am
new to frameworks.

#2 - I spent a significant amount of time trying to figure out how to
turn on the debugging in CakePHP because I saw an obscure reference to
it somewhere in this group, but I could never find anything concrete.
(thank you for providing that)

#3 - I have spent a significant amount of time searching this group,
the manual, the api, and everywhere else I can find for the answers
before posting here and taking up everyone's time.  It was only after
finally recognizing that without the abillity to debug I would have to
put my question out here at the mercy of those who would laugh at me
for such a simple question, that I finally posted.

I back you 100% that there should be something about how to set up
debugging for CakePHP in the manual.  At least now it is here - so
hopefully some other hapless newbie can also find the answer.

I hope that you can teach your inner cranky developer the joy of
helping people even if it is something so obvious as this was (they
appreciate the help).  The next time you feel the urge to berate
someone, take a deep breath and then answer their question without
making them feel subhuman.  
thank you again for your help.
Rnady


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: I want to select information from a related table inside of my view function and present that information in my view.thtml file

2006-09-08 Thread jonlb


rnady wrote:
> [EMAIL PROTECTED] wrote:
> > Use the associations.  Then you can return it with
> > $data['Importance']['importance'].
> >
> > I would imagine this could be quickly accomplished with a belongsTo
> > association.
> >
> > http://manual.cakephp.org/chapter/models
>
> Thanks for your response.I know this should be simple and I feel dumb
> because I can't get it to work.  In my importance.php model I added:
> var $belongsTo = array('Item' =>
>array('className'  => 'Item',
>  'conditions' => '',
>  'order'  => '',
>  'foreignKey' => 'importances_id'
>)
>  );
>
> I already had this in my Item.php model:
> var $hasMany = array('Importance' =>
> array('className'=> 'Importance',
>   'conditions'   => '',
>   'order'=> '',
>   'dependent'=>  true,
>   'foreignKey'   => 'importances_id'
> )
>   );
> After adding the belongsTo in my importance model and
> $data['Importance']['importance'] in my view.thtml I get this error:
> Notice: Undefined index: importance in
> N:\www\cake\app\views\items\view.thtml on line 5
> What am I doing wrong?

Mady,

I believe that part of your problem is that you have the associations
backwards.  "Items" belongsTo "Importance"  and "Importance" hasMany
"Items"

The relationship is a one-to-many with each Importance level having
possibly many related items but each Item can only have one importance
level.  Try switching the two and see if that helps... like so:

In item:

var $belongsTo = array('Importance' =>
array('className'  => 'Importance',
  'conditions' => '',
  'order'  => '',
  'foreignKey' => 'importances_id'
)
  );




In Importance:

var $hasMany = array('Item' =>
 array('className'=> 'Item',
   'conditions'   => '',
   'order'=> '',
   'dependent'=>  true,//<-- Note:
this probably should be false unless you intend for the related items
to be deleted if you delete an importance level.
   'foreignKey'   => 'importances_id'
 )
   );

Hope that helps!

jonlb


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: I want to select information from a related table inside of my view function and present that information in my view.thtml file

2006-09-08 Thread Chris Hartjes

On 9/8/06, rnady <[EMAIL PROTECTED]> wrote:
>
>
> After adding the belongsTo in my importance model and
> $data['Importance']['importance'] in my view.thtml I get this error:
> Notice: Undefined index: importance in
> N:\www\cake\app\views\items\view.thtml on line 5
> What am I doing wrong?
>

(I think I'm getting as old and cranky as Sam DeVore)

Step #1:  make sure you have your app in SQL debugging mode by making
sure DEBUG is set to 2 in your core.php config file.
Step #2: Look at the SQL output it generates and make sure the queries
are actually pulling the information you are expecting
Step #3: add a 'debug($data);' statment somewhere in your controller
so you can actually see how the data array is structured.

I know it looks like I'm picking on Mr. Dustin here, but this is
*basic* debugging technique.  You can't even begin to build anything
bigger than "Hello world" if you don't learn how to debug your code
effectively.  I don't mind helping people out, but it gets harder and
harder to supress my inner cranky developer when basic debugging rules
aren't being followed.

Perhaps there should be a chapter in the manual (or someplace else) on
how to effectively debug CakePHP applications.

I have donned my flame-proof suit and await your responses. ;)

--
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: I want to select information from a related table inside of my view function and present that information in my view.thtml file

2006-09-08 Thread rnady

[EMAIL PROTECTED] wrote:
> Use the associations.  Then you can return it with
> $data['Importance']['importance'].
>
> I would imagine this could be quickly accomplished with a belongsTo
> association.
>
> http://manual.cakephp.org/chapter/models

Thanks for your response.I know this should be simple and I feel dumb
because I can't get it to work.  In my importance.php model I added:
var $belongsTo = array('Item' =>
   array('className'  => 'Item',
 'conditions' => '',
 'order'  => '',
 'foreignKey' => 'importances_id'
   )
 );

I already had this in my Item.php model:
var $hasMany = array('Importance' =>
array('className'=> 'Importance',
  'conditions'   => '',
  'order'=> '',
  'dependent'=>  true,
  'foreignKey'   => 'importances_id'
)
  );
After adding the belongsTo in my importance model and
$data['Importance']['importance'] in my view.thtml I get this error:
Notice: Undefined index: importance in
N:\www\cake\app\views\items\view.thtml on line 5
What am I doing wrong?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: I want to select information from a related table inside of my view function and present that information in my view.thtml file

2006-09-08 Thread [EMAIL PROTECTED]

Use the associations.  Then you can return it with
$data['Importance']['importance'].

I would imagine this could be quickly accomplished with a belongsTo
association.

http://manual.cakephp.org/chapter/models


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



I want to select information from a related table inside of my view function and present that information in my view.thtml file

2006-09-08 Thread rnady

I am very new to CakePHP and I'm pretty sure there is a simple answer
to this problem but i have failed to find it.
I am creating a todo list application in which the user can enter the
name of the item for the list and then select the importance of the
item.  So I have two models: Item and Importance.  In my importance
table I have three levels of importance: A, B, C.  In my
items_controller.php file in my view function I am trying to select the
Letter A, B, or C based on the foreignKey importances_id in my items
table and display that letter instead of the importances_id as it does
by default with scaffolding.  I have tried various things but here is
the latest attempt.

function view($id)
 {
  $this->Item->id = $id;
  $this->set('data', $this->Item->read());
  $im =
$this->Item->finByImportances_id($this->data['Item']['importances_id']);
  $this->set('importances',
$this->Importance->findByImportance($im['Item']['importances_id']));
 }

Here is the view.thtml file:
view 

Importance id:

|  

Item:

Created:

modified:

order:



I am not getting any errors but I am also not returning any value from


What am I doing wrong?

My configuration is
cake: 1.1.6.3264
php 5.1.1
apache: 2.0.55
mysql: 5.0.17
I am running it using the Uniform Server.
thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---