Friday, July 31, 2009

index.php of cakephp's core

Hi, people

i'm using apache2.2 + php5.2 and cake_1.2.3.8166. When i try to acess
localhost/cake_1.2.3.8166, folders and archives which are inside of
the cake appear, and index,php is not shown. However, If a click on
index.php, this page is shown correctly. Why isn't index.php called
automatically?
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Calling component in helpers / Calling models in helpers

I had got your things.
Yes, I know that its bad practice.

But I am working one kind of application. In which later stage, we will need to find way by
which we can enter new functionality in the system easliy. We don't need to touch controller files. We want that if i want to add new functionality than i can easily do by entering few files/settings  with out disturbing earlier code.

By above way, if we make genralized helper  and component than for logic we will need to touch only two files and other small settings. By introducing component to call models, I am also using some what kind of MVC not directly calling modeles from helpers.

I will send details explaination soon in the group.

Thanks for every thing.

Shadab




On Sat, Aug 1, 2009 at 1:46 AM, Miles J <mileswjohnson@gmail.com> wrote:

You are still not understanding what im saying. Either way, its bad
practice to put component code in helpers, if you are then it means
your doing it wrong.



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

Auth component, method login()

Hi all,

I have a question with regards to the login method, which in the blog
tutorial in the manual and other tutorials is left blank and handled
magically by the Auth component.

I am concerned with security when it comes to what is input by the
user. Does the Auth component filter/clean the data behind the scenes?
If so, where can I look under the hood so to speak.

Thanks!
L4C

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

Re: Calling component in helpers / Calling models in helpers

startup(), initialize() and any callbacks, are NOT triggered when
using App::import(). App import simply requires() the file.

On Jul 31, 1:44 pm, "euromark (munich)" <dereurom...@googlemail.com>
wrote:
> actually there might be some occasions where you would need to do that
> - and where you could even call it appropriate
>
> but with core components, this is usually NEVER the case
>
> if you have a component that is totally isolated and does not need any
> startup() or controller related stuff, this works well
> but as soon as this happens (with most of the core components, which
> need again some other components or controller access) this gets
> really ugly
>
> in this case prepare everything inside the controller action and pass
> it along!
>
> On 31 Jul., 22:16, Miles J <mileswjohn...@gmail.com> wrote:
>
> > You are still not understanding what im saying. Either way, its bad
> > practice to put component code in helpers, if you are then it means
> > your doing it wrong.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Ajax link update?

I have an ajax link that will toggle if the user is confirmed or not without reloading the page.

                        <td><?php echo($ajax->link($user['User']['confirmed'], array('controller' => 'users', 'action' => 'confirm/'.$user['User']['id']), array(), 'Update Confirmation for " '.$user['User']['username'].' "'));?></td>


How do I get the link text to update when I click on the link? I am a bit new to using ajax/javascript so any help would be wonderful.

~Michael

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

Re: Calling component in helpers / Calling models in helpers

actually there might be some occasions where you would need to do that
- and where you could even call it appropriate

but with core components, this is usually NEVER the case

if you have a component that is totally isolated and does not need any
startup() or controller related stuff, this works well
but as soon as this happens (with most of the core components, which
need again some other components or controller access) this gets
really ugly


in this case prepare everything inside the controller action and pass
it along!

On 31 Jul., 22:16, Miles J <mileswjohn...@gmail.com> wrote:
> You are still not understanding what im saying. Either way, its bad
> practice to put component code in helpers, if you are then it means
> your doing it wrong.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Calling component in helpers / Calling models in helpers

You are still not understanding what im saying. Either way, its bad
practice to put component code in helpers, if you are then it means
your doing it wrong.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Plural Singular with software

As euromark said, you shoudn't bother, because cakephp doesn't rule foreach conditions. It's interesting to maintain the plural/singular in foreach just to maintain your code cleaner, but in cases like (software, people, etc), don't bother. You'll be able to set any name you want to fetch the results.


Regards.
Thiago Elias.





2009/7/30 euromark (munich) <dereuromark@googlemail.com>

foreach ($software as $sware) {}
would work as well as just
foreach ($software as $s) {}
etc
be creative :)

the scope of this var is so small that you should not bother too much
here


On 30 Jul., 17:34, Manolet Gmail <mano...@gmail.com> wrote:
> Hi, im building an application to collect pieces of software. the problem is
> that "software" dont have a plural form.
> i dont know what to do, i know i can create an inflector but... i dont know
> how to call the array for the foreachs, i mean
>
> foreach ($software(plural) as $software(singular)
>
> i know i can use whatever like $software_many but... im looking for the
> right way to do it..
>
> any ideas?



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

possible to do validation in not current model? where should I put validation??

For example

There are 3 tables "categories", "products" and "sizes", and I'm
working on product page (product.php, products_controller.php,
product.ctp).

The database looks like this.
sizes:
-----------------------
| id |
-----------------------
| category_id |
| size_name |
----------------------

products:
-----------------------
| id |
-----------------------
| sku |
| category_id |
| product_name |
| size_id |
------------------------

categories:
---------------------------
| id |
---------------------------
| category_name |
---------------------------

Product page can add/edit product:
Before I save new product the page also can add new size.

I can verify a product data such as sku value from the model but I
want to also make sure,
user can add new size name if it's not exist in the system(not exist
in size table).

I want to put validation code in model.

Should I put validation code in size.php or product.php

Also if I want validate this then I have to pass category also.
(same size name can be exist if it has different category id)
How can I pass specific value to model so I can set vilification in
mode and not controller?

Or in this case I should just put code in controller?


thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: how to set "CHECKED" with form helper radio

Thank you, Miles for your comment.

mmmm,,,, sometimes I'm confused which one I should use.
I thought I should use form helper instead of html helper.
Also your example is mixed with 'checkbox', I want to use radio botton
not checkbox.
I tried your code just in case but I got an error.

thanks,


On Jul 30, 12:45 pm, Miles J <mileswjohn...@gmail.com> wrote:
> Do not use $form->radio(), you should be using $form->input().
>
> $form->input('Test.test', array('type' => 'checkbox', 'options' =>
> $radio_btn, 'value' => 1));
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: get the controller from the named argument

"Even if this works it will bring a whole lot of other problems. I
don't know what benefit you expect from the chosen url setup, but you
might want to reconsider. "

well, all I wanted to do was to base my choice of controller on the
subdomain.
But I think I'll just make an if-statement out of it.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Paging on associative fields

Hi all.

I'm having problems with sort function. I have two models Task and Employee,
they are related by Employee.nickname.

Sort function works well on main model's fields, but it doesn't work with
its associated field. I've also tried $paginator->sort('Employee',
'Employee.nickname')

Is there anyone who have solved a similar problem?

Best regards.
--
View this message in context: http://www.nabble.com/Paging-on-associative-fields-tp24759009p24759009.html
Sent from the CakePHP mailing list archive at Nabble.com.


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

new line in posts

Hi, i have problem in my application with new lines in posts. CakePHP
probably replace "bad" characters from db results and i need to
str_replace('\n','<br />',$somePost['Post']['text']) to keep new lines
in posts, Can somebody help me with this problem? I tried to search
google and this group, but with no success... Thank you
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Calling component in helpers / Calling models in helpers

Say you are using the Cookie component, and place this in your
beforeFilter().

function beforeFilter() {
$this->Cookie->name = 'COOKIE';
}

If you import the component like so, the above setting WILL NOT be
applied to the imported cookie component, so you will get mixed
results.

App::import('Component', 'CookieComponent');
$Cookie = new CookieComponent();
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Calling component in helpers / Calling models in helpers

Hi Miles,

Thanks for your reply.
Can you please explain " config ($this->Component->foo = 'bar') " in more details?
What is purpose of it? Why we will need to set it in before filter()

It's really appreciated if you can give us one simple example.

Thanks!
Shadab

On Thu, Jul 30, 2009 at 1:50 AM, Miles J <mileswjohnson@gmail.com> wrote:

Well you can import the component, but doing it this way DOES NOT keep
its saved config ($this->Component->foo = 'bar') that you set in the
controllers beforeFilter(), hence why its good to not do this.

App::import('Component', 'ComponentName');
$ComponentName = new ComponentNameComponent();



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

Re: Efficient ways to retrieve data from models with high association depth

On Jul 31, 9:58 am, AD7six <andydawso...@gmail.com> wrote:
> On Jul 31, 12:15 am, Roel <roel....@gmail.com> wrote:
>
> > Ah I like your idea of encapsulating the two finds in a model method.
> > That seems much better than putting the logic in the controller.
> > Thanks.
>
> > Could you please elaborate on the Linkable (and OneQuery) behavior?
> > Anything with regard to optimizing database performance for related
> > models seems relevant to me.
>
> Given that A belongsTo|hasOne B belongsTo|hasOne C belongsTo|hasOne D
> belongsTo|hasOne E etc.
>
> you'll get n queries with cake, and 1 query using Linkable/OneQuery.
> They're used in a similar fashion to containable.
>
> Cheers,
>
> AD

The article by Mark descibes how you can do it by hand
http://mark-story.com/posts/view/using-bindmodel-to-get-to-deep-relations

Cheers,

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

Re: Efficient ways to retrieve data from models with high association depth

On Jul 31, 12:15 am, Roel <roel....@gmail.com> wrote:
> Ah I like your idea of encapsulating the two finds in a model method.
> That seems much better than putting the logic in the controller.
> Thanks.
>
> Could you please elaborate on the Linkable (and OneQuery) behavior?
> Anything with regard to optimizing database performance for related
> models seems relevant to me.

Given that A belongsTo|hasOne B belongsTo|hasOne C belongsTo|hasOne D
belongsTo|hasOne E etc.

you'll get n queries with cake, and 1 query using Linkable/OneQuery.
They're used in a similar fashion to containable.

Cheers,

AD


>
> -Roel
>
> On 30 jul, 21:40, AD7six <andydawso...@gmail.com> wrote:
>
> > On Jul 30, 9:00 pm, Roel <roel....@gmail.com> wrote:
>
> > > I've tried Containable but it doesn't help lower the number of queries
> > > made. In fact in some circumstances Containable creates unnecessary
> > > queries (https://trac.cakephp.org/ticket/5864).
>
> > > To be clear, I have no trouble getting my data. It's just, from a
> > > perspective of someone who handwritten his MySQL queries, CakePHP
> > > could be much more efficient with its database calls.
>
> > > At points I'm a bit torn between writing an app that prioritizes
> > > efficient database queries or Cake's logic. To illustrate:
>
> > > Option 1:
>
> > > $data = $this->Article->read();
>
> > > <queries made (aside from DESCRIBE): 1 + [num_comments]>
>
> > > Option 2:
>
> > > $this->Article->recursive = -1;
>
> > > $articleData = $this->Article->read();
>
> > > $postData = $this->Article->Comment->find('all', array('conditions' =>
> > > array('Comment.article_id' => $this->Article->id)));
>
> > > <queries made (aside from DESCRIBE): 2)>
>
> > > Option 1 is nice and clean, as you would expect from Cake, but it can
> > > potentially mean a lot of database quering. Option 2 on the other hand
> > > doesn't look as slick. It puts some logic in my controller I don't
> > > want there. The related data is split over 2 variables. But the number
> > > of queries is fixed.
>
> > > I'm just curious if this issue also bothers other developers and what
> > > direction do they choose.
>
> > I'd go with the latter - 2 explicit and simple queries (although I
> > think your 1 + number of comments is dependent on the version of cake
> > you're testing with - should be 2 queries anyway).
> > You could create a model method to encapsulate your two finds (and any
> > other logic therin). and even re arrange the resultant array data such
> > that it's the same as calling find with containable.
>
> > The Linkable (or my own OneQuery) behavior is worth using - although
> > in the use case you're presented it's not relevant.
>
> > AD
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: using jquery with cakephp

You use it like you would use jquery normally. Very easy.

On Jul 30, 10:38 am, jeremy <jeffery2k2...@gmail.com> wrote:
> hai guys,
>
> am looking for using jquery with cakephp...
>
> i googled a lot but didnt get appropriate tutorials for this
>
> can anyone send me links or tutorials of perfroming both the client
> side and server side
>
> validations in cakephp using jquery..................
>
> THANZ IN ADVANCE
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Send Simple Mail With CakePHP !

http://book.cakephp.org/view/176/Email

And if that still doesn't help you then you should go to the basics
and re-read the ENTIRE cakeBook.

On Jul 30, 7:27 pm, Abraham Boray <abrahambo...@gmail.com> wrote:
> Well that doesn't help me out , i'm new in CakePHP .
> And I'd like to see a very very simple example to start with =)
>
> I searched the web ,but without getting the point "HOW TO SEND MAIL
> WITH CAKEPHP'
> Hope u undestand me guys
> Regards
> Abraham
>
> On Jul 30, 3:10 pm, brian <bally.z...@gmail.com> wrote:
>
> > Have a look at thishttp://bakery.cakephp.org/articles/view/brief-overview-of-the-new-ema...
>
> > On Thu, Jul 30, 2009 at 10:43 AM, Abraham Boray<abrahambo...@gmail.com> wrote:
>
> > > Hey Guys
>
> > > I have a Contact form Like this :
>
> > > <form action="comments/UserMailToME" method="post"
> > > name="ContactMeBoard" id="ContactMeBoard">         <label
> > > for="textfield">name</label>
> > >         <input type="text" name="textfield" id="textfield" />
> > >         <label for="textfield2">e-mail</label>
> > >         <input type="text" name="textfield2" id="textfield2" />
> > >         <label for="a_url">subject</label>
> > >         <input type="text" name="textfield3" id="textfield3" />
> > >         <label for="textarea">comment</label>
> > >         <textarea name="textarea" id="textarea"  rows="5"></textarea>
> > >         <label for="textarea">&nbsp;</label>
> > >         <input name="input2" type="submit" class="button"
> > > value="Send" />
> > >         <input name="input" type="reset" value="Reset"
> > > class="button" />
> > > </form>
>
> > > In which i have this text boxes::
> > > +Name +E-Mail +Subject +Content
>
> > > /
> > > ***********************************************************************************/
> > > And I want the code 4 simple e-mail sending in My "UserMailToME"
> > > action .
>
> > > Regards
> > > Abraham
>
>
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Thursday, July 30, 2009

Re: Form with saving of true/false/null

I have been giving this some thought and I do get what you mean, but
it is very important that the user can always change e.g. an "yes"
answer into "not info on subject". Database wise I think you are
right, that I should define three different values (no = 0, yes = 1,
no info = 2) instead of using no info = Null.

Thank you very much for your help.

/Anders

On Jul 30, 9:41 am, delocalizer <conrad.leon...@hotmail.com> wrote:
> You sure you want an explicit third option 'no information on the
> subject'? Wouldn't it be better to just have a radio group with 2
> buttons (Yes/No or True/False) with a default value of NULL for that
> field in your database? Or if you really want to have a third option
> to force a user to enter something, mapping to a value other than
> empty string or 'null' might be wise, as depending on how your db
> field is defined, these may not be distinguishable from 'no data
> entered'. The 'right' solution really depends on the particular logic
> of your application - what data your users should enter and how that
> data will be used and analysed once it's in the database.
>
> On Jul 30, 12:40 am, "Richard@Home" <richardath...@gmail.com> wrote:
>
> > I'd use a drop down select instead of an option group.
>
> > This should do the trick:
>
> > <?php echo $form->input("Model.field", array("options"=>array(""=>"No
> > information on subject", true=>"True", false=>"False))); ?>
>
> > On Jul 29, 12:29 pm, Kanten <anders.ho...@gmail.com> wrote:
>
> > > Is there really noone, that can help me with this one?
>
> > > Thanks
> > > Anders
>
> > > On Jul 10, 1:49 pm, Kanten <anders.ho...@gmail.com> wrote:
>
> > > > Hi,
>
> > > > I am making a database for research and for this project I have a lot
> > > > of dichotomous (binary) variables where I need to be able to
> > > > discrimate between true, false and "no information on
> > > > subject" (=null). I would like to store it as a bool field in MySQL.
> > > > User interface wise I was thinking of using radio buttons with the
> > > > option of choosing between the three posibilities.
>
> > > > Is there some easy way of doing this using the builtin form helper, or
> > > > do I need to to modify it somehow?
>
> > > > Thanks
> > > > Anders
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Form with saving of true/false/null

I think I would prefer radio buttons, as I think these are easier to
select then scroll downs when having to enter larger amount of data.
Do you know how I can code this?

/Anders

On Jul 29, 4:40 pm, "Richard@Home" <richardath...@gmail.com> wrote:
> I'd use a drop down select instead of an option group.
>
> This should do the trick:
>
> <?php echo $form->input("Model.field", array("options"=>array(""=>"No
> information on subject", true=>"True", false=>"False))); ?>
>
> On Jul 29, 12:29 pm, Kanten <anders.ho...@gmail.com> wrote:
>
> > Is there really noone, that can help me with this one?
>
> > Thanks
> > Anders
>
> > On Jul 10, 1:49 pm, Kanten <anders.ho...@gmail.com> wrote:
>
> > > Hi,
>
> > > I am making a database for research and for this project I have a lot
> > > of dichotomous (binary) variables where I need to be able to
> > > discrimate between true, false and "no information on
> > > subject" (=null). I would like to store it as a bool field in MySQL.
> > > User interface wise I was thinking of using radio buttons with the
> > > option of choosing between the three posibilities.
>
> > > Is there some easy way of doing this using the builtin form helper, or
> > > do I need to to modify it somehow?
>
> > > Thanks
> > > Anders
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: retrieving data from hasMany configuration

Thank you very much,

This solve my question. But usually DBs have complex relationships,
for example, if I have more deep relationships:

"Comment" --- (hasOne) ---> "User" --- (hasOne) --> Address

How Is it possible retrieve information from Comment Controller like
the next array structure (or something like this)?

Array
(
[Comment] => Array
(
[id] => 121
[text] => Text
[user_id] => 2
)
Array
(
[User] => Array
(
[id] => 12
[name] => Peter
[skill] => Baking Cakes
[adress_id] => 4
)
[Address] => Array
(
[id] => 4
[street] => Elm Street
)
)
)

On Jul 30, 5:21 pm, JamesF <usaexportexpe...@gmail.com> wrote:
> seconded
>
> On Jul 30, 8:16 am, brian <bally.z...@gmail.com> wrote:
>
> > In addition to what James suggested, you should modify the Comment class:
>
> > class Comment extends AppModel {
> >    var $name = 'Comment';
>
> >    var $belongsTo = array('User');
>
> > }
>
> > And give the comments table a user_id column (to match the type of users.id).
>
> > On Thu, Jul 30, 2009 at 1:02 AM, Veoempleo<veoemp...@gmail.com> wrote:
>
> > > Hello,
>
> > > I have a question after reading model developing.
>
> > > I have two models, user that has many comments. I define:
>
> > > <?php
>
> > > class User extends AppModel {
> > >    var $name = 'User';
> > >    var $hasMany = 'Comment';
> > > }
> > > ?>
>
> > > <?php
>
> > > class Comment extends AppModel {
> > >    var $name = 'Comment';
> > > }
> > > ?>
>
> > > From Comment controller, How I could retrieve User information from
> > > Comment row?
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: HABTM search custom query

you need to set the conditions for your query in the $paginate
variable.

$this->paginate = array('whatever models and conditions array')

http://book.cakephp.org/view/249/Custom-Query-Pagination


On Jul 30, 4:48 pm, cookiebaker <rsujee...@gmail.com> wrote:
> Hi,
>  This is my first post and please forgive me if this question is
> already answered. I building a business directory and I encounter a
> problem when searching using paginate.
> This is my simplified database design
> sections ( id, name)
> categories_sections(category_id, section_id)
> categories (id, name, keywords)
> businesses_categories (business_id, category_id);
> businesses (id, name, phone, ..., keywords)
> I want to do a keyword search, it should search the following fields
> businesses.name, businesses.keywords, categories.name and
> categories.keywords for match
> e.g: Business.name LIKE '%$searchTerm%' OR Business.keywords LIKE '%
> $searchTerm%' OR Category.name LIKE '%$searchTerm%' Category.keywords
> LIKE '%$searchTerm%'
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

EmailComponent & DomainKeys - SPF Records - Not Working -Solution-

Hey all I just wanted to share how i got DomainKeys and SPF records to
work with CakePHP's EmailComponent.

The first prerequisite was to obviously enable SPF record and
DomainKeys from cpanel.
(actually i used /usr/local/cpanel/bin/install_domain_keys_installer
myusername (from bash shell))

that was actually a no brainer. the problem was my email headers from
EmailComponent were not authenticating properly, missing DomainKeys
entirely and SPF record returned neutral.

i sent a few test messages from Horde and the DomainKeys and SPF
records were there (after a restart of the exim mail service on my
server).

So why wasn't EmailComponent playing nice?

you need to set the delivery variable in $Email object to:

$this->Email->delivery = 'smtp';

lo and behold everything worked after that. after looking at
EmailComponent more deeply i realized that by default it uses PHP's
mail() function which does not support Domain Keys (or so i believe).

I truly hope this saves someone of few hours.

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

Re: capital letters for models

in the model 
var $useTable = 'USER';


- S


2009/7/31 pete123456 <lumotion@gmail.com>


hi,
i have database tables with capital letters. is it possible to use them?
whenever i try to use USER cake turns it into u_s_e_r. is there a way to
avoid that?

thanks

pete
--
View this message in context: http://www.nabble.com/capital-letters-for-models-tp24750294p24750294.html
Sent from the CakePHP mailing list archive at Nabble.com.





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

capital letters for models

hi,
i have database tables with capital letters. is it possible to use them?
whenever i try to use USER cake turns it into u_s_e_r. is there a way to
avoid that?

thanks

pete
--
View this message in context: http://www.nabble.com/capital-letters-for-models-tp24750294p24750294.html
Sent from the CakePHP mailing list archive at Nabble.com.


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

Re: Auth Component

thanks that seems to work,
no i run into another issue. on my UsersController. the login form shows up
but when i try to login i always get the message "username/password"
correct.
$someone['User']['password'] has the hashpassword but its still not
working.
any hints?

thanks


function login() {

if($someone['User']['password'] == $this->data['User']['password'])
{
echo "not able to get in here"
}

brian-263 wrote:
>
>
> class SomeController extends AppController
> {
> function beforeFilter()
> {
> parent::beforeFilter();
>
> $this->Auth->allowedActions = array('someAction', 'someOtherAction');
> }
>
> On Thu, Jul 30, 2009 at 9:10 PM, pete123456<lumotion@gmail.com> wrote:
>>
>>
>> Hi,
>> i've added var $components = array('Auth'); to my AppController.
>> Now i need to login on every single page, is there a way to remove the
>> Authentication within certain controllers?
>>
>> thanks
>>
>> pete
>> --
>> View this message in context:
>> http://www.nabble.com/Auth-Component-tp24749664p24749664.html
>> Sent from the CakePHP mailing list archive at Nabble.com.
>>
>>
>> >
>>
>
> >
>
>

--
View this message in context: http://www.nabble.com/Auth-Component-tp24749664p24750099.html
Sent from the CakePHP mailing list archive at Nabble.com.


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

Re: Auth Component

True, but only if you pass zero arguements or '*'. I'd forgotten about
that. Otherwise, it amounts to the same thing.

function allow() {
$args = func_get_args();
if (empty($args) || $args == array('*')) {
$this->allowedActions = $this->_methods;
} else {
if (isset($args[0]) && is_array($args[0])) {
$args = $args[0];
}
$this->allowedActions = array_merge($this->allowedActions, $args);
}
}


On Thu, Jul 30, 2009 at 9:47 PM, Miles J<mileswjohnson@gmail.com> wrote:
>
> No you should use allow().
>
> http://book.cakephp.org/view/563/Setting-Auth-Component-Variables
> >
>

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

Re: Free Cake Ebook : How to build your own blog from scratch

Can't you all be a little nicer towards each other? :/

Its great to have non-English tutorials around. There is not non-
English group. It would make sense to prefix your initial posting with
[lang] or [lang-LANG] - that way it won't disturb others.
I mostly disagree with euromark. One thing he mentions is very
important though: You can contribute to the cake manual right here in
the language of your choice. http://book.cakephp.org/view/527/Translations
be aware that you should add to the English version what misses
completely and then translate that to your mother language as well.

Plus: Wikipedia is a source.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Auth Component

No you should use allow().

http://book.cakephp.org/view/563/Setting-Auth-Component-Variables
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Auth Component

class SomeController extends AppController
{
function beforeFilter()
{
parent::beforeFilter();

$this->Auth->allowedActions = array('someAction', 'someOtherAction');
}

On Thu, Jul 30, 2009 at 9:10 PM, pete123456<lumotion@gmail.com> wrote:
>
>
> Hi,
> i've added var $components = array('Auth'); to my AppController.
> Now i need to login on every single page, is there a way to remove the
> Authentication within certain controllers?
>
> thanks
>
> pete
> --
> View this message in context: http://www.nabble.com/Auth-Component-tp24749664p24749664.html
> Sent from the CakePHP mailing list archive at Nabble.com.
>
>
> >
>

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

Auth Component

Hi,
i've added var $components = array('Auth'); to my AppController.
Now i need to login on every single page, is there a way to remove the
Authentication within certain controllers?

thanks

pete
--
View this message in context: http://www.nabble.com/Auth-Component-tp24749664p24749664.html
Sent from the CakePHP mailing list archive at Nabble.com.


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

Re: executing no realtionship tables

you still should set up a Model for your table. there are a number of
methods for working with your data, like var $uses, bindModel, etc

this should get you started:

http://book.cakephp.org/view/86/Creating-and-Destroying-Associations-on-the-Fly

On Jul 30, 4:22 pm, abhishekh <timba...@gmail.com> wrote:
> Hi, I have some static tables in my database. they have no relationship with
> any other tables. That table store read only data. How do I fetch data from
> that table, without writing any custom query, from any model.....?
> --
> View this message in context:http://www.nabble.com/executing-no-realtionship-tables-tp24746659p247...
> Sent from the CakePHP mailing list archive at Nabble.com.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

CakePHP tests execution with phing or any other build tool?

I've created build process for one of our project and now I want to
add some tests to it, for verification of code. Command line
integration is easy, but I couldn't find out the way where build tool
will know if tests were passed or failed. Anyone doing this already?

Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Routing /group/person/post instead of /post/id

Well the link provided should offer enough information.

One thing you could do is (out of the top of my head):

Router::connect('/:group', array('controller' => 'groups', 'action' =>
'view'));
Router::connect('/:group/:user', array('controller' => 'users',
'action' => 'view'));
Router::connect('/:group/:user/:post', array('controller' => 'post',
'action' => 'view'));

Check $this->params in your controller for the variables 'group',
'user' and 'post' and use them in combination with a find('first')
call. Note that this solution will catch the urls for other
controllers. Eg you can't access your 'help' controller with '/help'
unless you explicitly define a route for that. One way around this is
to add a constant at the beginning of your routes

Router::connect('/view/:group')
etc

But there are also many other routing solutions. Such as:

Router::connect('/:group/:user/:post', array('controller' =>
'controller-that-handles-all-levels', 'user' => null, 'post' =>
null));

or even:

Router::connect('/*', array('controller' => 'controller1'));

-> define in Controller1Controller: public function index($group =
null, $user = null, $post = null)

So basically what you want is possible and there are lots of
possibilities.

-Roel

On 30 jul, 00:50, Orson <ors...@gmail.com> wrote:
> I didn't see this situation explained there.
>
> It would need to look up the group, then lookup the person associated
> with that group, then lookup the post associated with that user before
> it could tell the posts controller which post to show.
>
> Ex.:http://example.com/dev/miker/grilled-fish/
> Lookup dev group, find mike,
> Lookup mike user, find post grilled-fish
> call posts controller for id xx associated with grilled-fish
>
> Hopefully that makes more sense.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: get the controller from the named argument

Hi,

I'm not 100% sure but I think the urls you want to use aren't going to
work because of the slashes in the named argument. Now the named
argument 'subdomain' will be 'www' and 'home' will be passed as an
other variable.

Maybe you could do something like this:

url:

/subdomain/www/home

routing:

Router::connect('*/subdomain/:controller/:action/*');

Even if this works it will bring a whole lot of other problems. I
don't know what benefit you expect from the chosen url setup, but you
might want to reconsider.

-Roel

On 30 jul, 19:07, Evert <Compa...@gmail.com> wrote:
> I have a named argument in my URLs, so it could look like this:
>
> /subdomain:www/home
> /subdomain:forum/topic/23
>
> etc..
>
> now I want that some of those named-arguments go to certain
> controllers and all the others go the pages-controller
> but I am a complete noob when it comes to routing. I tried this, but
> obviously it doesn't work:
>
> Router::connect('/:subdomain/*', array('subdomain' => 'forum',
> 'controller' => 'forum'));
> Router::connect('/:subdomain/*', array('subdomain' => 'wiki',
> 'controller' => 'wiki'));
> Router::connect('/:subdomain/*', array('subdomain' => 'docs',
> 'controller' => 'docs'));
> Router::connect('/:subdomain/*', array('subdomain' => '*',
> 'controller' => 'pages'));
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Execute a MS SQL stored procedure and receive values from Output parameter, How?

Any one could give me clue on how to call or execute a MS SQL stored
procedure, passing parameters to it and receiving a value from it
using Output parameters?

I successfully use query() to invoke stored procedures and get result
set but I am not sure how to get the value returns via Output prams
from Stored procedures.

Thank you,
zonium
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Efficient ways to retrieve data from models with high association depth

Ah I like your idea of encapsulating the two finds in a model method.
That seems much better than putting the logic in the controller.
Thanks.

Could you please elaborate on the Linkable (and OneQuery) behavior?
Anything with regard to optimizing database performance for related
models seems relevant to me.

-Roel

On 30 jul, 21:40, AD7six <andydawso...@gmail.com> wrote:
> On Jul 30, 9:00 pm, Roel <roel....@gmail.com> wrote:
>
>
>
>
>
> > I've tried Containable but it doesn't help lower the number of queries
> > made. In fact in some circumstances Containable creates unnecessary
> > queries (https://trac.cakephp.org/ticket/5864).
>
> > To be clear, I have no trouble getting my data. It's just, from a
> > perspective of someone who handwritten his MySQL queries, CakePHP
> > could be much more efficient with its database calls.
>
> > At points I'm a bit torn between writing an app that prioritizes
> > efficient database queries or Cake's logic. To illustrate:
>
> > Option 1:
>
> > $data = $this->Article->read();
>
> > <queries made (aside from DESCRIBE): 1 + [num_comments]>
>
> > Option 2:
>
> > $this->Article->recursive = -1;
>
> > $articleData = $this->Article->read();
>
> > $postData = $this->Article->Comment->find('all', array('conditions' =>
> > array('Comment.article_id' => $this->Article->id)));
>
> > <queries made (aside from DESCRIBE): 2)>
>
> > Option 1 is nice and clean, as you would expect from Cake, but it can
> > potentially mean a lot of database quering. Option 2 on the other hand
> > doesn't look as slick. It puts some logic in my controller I don't
> > want there. The related data is split over 2 variables. But the number
> > of queries is fixed.
>
> > I'm just curious if this issue also bothers other developers and what
> > direction do they choose.
>
> I'd go with the latter - 2 explicit and simple queries (although I
> think your 1 + number of comments is dependent on the version of cake
> you're testing with - should be 2 queries anyway).
> You could create a model method to encapsulate your two finds (and any
> other logic therin). and even re arrange the resultant array data such
> that it's the same as calling find with containable.
>
> The Linkable (or my own OneQuery) behavior is worth using - although
> in the use case you're presented it's not relevant.
>
> AD
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

HABTM search custom query

Hi,
This is my first post and please forgive me if this question is
already answered. I building a business directory and I encounter a
problem when searching using paginate.
This is my simplified database design
sections ( id, name)
categories_sections(category_id, section_id)
categories (id, name, keywords)
businesses_categories (business_id, category_id);
businesses (id, name, phone, ..., keywords)
I want to do a keyword search, it should search the following fields
businesses.name, businesses.keywords, categories.name and
categories.keywords for match
e.g: Business.name LIKE '%$searchTerm%' OR Business.keywords LIKE '%
$searchTerm%' OR Category.name LIKE '%$searchTerm%' Category.keywords
LIKE '%$searchTerm%'

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

executing no realtionship tables

Hi, I have some static tables in my database. they have no relationship with
any other tables. That table store read only data. How do I fetch data from
that table, without writing any custom query, from any model.....?
--
View this message in context: http://www.nabble.com/executing-no-realtionship-tables-tp24746659p24746659.html
Sent from the CakePHP mailing list archive at Nabble.com.


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

Adding an Admin Section/Help with the Acl App in the Cookbook

I would like to add an admin portion to my app.

So far I have followed the Acl example in the Cookbook most of the
way.

What I don't is how the aros work.

If I create a user, how do I (or even can I) choose whether this new
user is an admin or a regular user? Or do I have to create a second
registration form to add admins?

Thanks,
~Sarah


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

Re: cake process sequence

http://book.cakephp.org/view/21/A-Typical-CakePHP-Request

greets
Andreas

lordG schrieb:
> Hi Guys,
>
> Does any know if there is an graph of process flow of how Cake loads
> itself? This would be really helpful.
>
> Thanks.
> G
> >
>

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

Re: how to set "CHECKED" with form helper radio

Do not use $form->radio(), you should be using $form->input().

$form->input('Test.test', array('type' => 'checkbox', 'options' =>
$radio_btn, 'value' => 1));
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Efficient ways to retrieve data from models with high association depth

On Jul 30, 9:00 pm, Roel <roel....@gmail.com> wrote:
> I've tried Containable but it doesn't help lower the number of queries
> made. In fact in some circumstances Containable creates unnecessary
> queries (https://trac.cakephp.org/ticket/5864).
>
> To be clear, I have no trouble getting my data. It's just, from a
> perspective of someone who handwritten his MySQL queries, CakePHP
> could be much more efficient with its database calls.
>
> At points I'm a bit torn between writing an app that prioritizes
> efficient database queries or Cake's logic. To illustrate:
>
> Option 1:
>
> $data = $this->Article->read();
>
> <queries made (aside from DESCRIBE): 1 + [num_comments]>
>
> Option 2:
>
> $this->Article->recursive = -1;
>
> $articleData = $this->Article->read();
>
> $postData = $this->Article->Comment->find('all', array('conditions' =>
> array('Comment.article_id' => $this->Article->id)));
>
> <queries made (aside from DESCRIBE): 2)>
>
> Option 1 is nice and clean, as you would expect from Cake, but it can
> potentially mean a lot of database quering. Option 2 on the other hand
> doesn't look as slick. It puts some logic in my controller I don't
> want there. The related data is split over 2 variables. But the number
> of queries is fixed.
>
> I'm just curious if this issue also bothers other developers and what
> direction do they choose.

I'd go with the latter - 2 explicit and simple queries (although I
think your 1 + number of comments is dependent on the version of cake
you're testing with - should be 2 queries anyway).
You could create a model method to encapsulate your two finds (and any
other logic therin). and even re arrange the resultant array data such
that it's the same as calling find with containable.

The Linkable (or my own OneQuery) behavior is worth using - although
in the use case you're presented it's not relevant.

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

Re: Vendors handling with js/css script packages without breaking their file structure

On Jul 30, 12:07 am, Miles J <mileswjohn...@gmail.com> wrote:
> You cant link to css/js in vendors. You have to place it in the
> webroot js/css folders.

based on what are you stating that?
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Efficient ways to retrieve data from models with high association depth

I've tried Containable but it doesn't help lower the number of queries
made. In fact in some circumstances Containable creates unnecessary
queries (https://trac.cakephp.org/ticket/5864).

To be clear, I have no trouble getting my data. It's just, from a
perspective of someone who handwritten his MySQL queries, CakePHP
could be much more efficient with its database calls.

At points I'm a bit torn between writing an app that prioritizes
efficient database queries or Cake's logic. To illustrate:

Option 1:

$data = $this->Article->read();

<queries made (aside from DESCRIBE): 1 + [num_comments]>


Option 2:

$this->Article->recursive = -1;

$articleData = $this->Article->read();

$postData = $this->Article->Comment->find('all', array('conditions' =>
array('Comment.article_id' => $this->Article->id)));

<queries made (aside from DESCRIBE): 2)>

Option 1 is nice and clean, as you would expect from Cake, but it can
potentially mean a lot of database quering. Option 2 on the other hand
doesn't look as slick. It puts some logic in my controller I don't
want there. The related data is split over 2 variables. But the number
of queries is fixed.

I'm just curious if this issue also bothers other developers and what
direction do they choose.

-Roel

On 30 jul, 19:14, JamesF <usaexportexpe...@gmail.com> wrote:
> have you tried using Containable behavior?
>
> On Jul 30, 12:16 pm, Roel <roel....@gmail.com> wrote:
>
>
>
> > Hi,
>
> > I'm using CakePHP for quite some time now and I really love it, but I
> > hadn't come around to make use of the complex association
> > possibilities for models. So I started to play around with them for a
> > personal project I just started. Although the advantages Cake offers
> > are numerous, I stumbled across an issue I'm not happy about. It's not
> > a bug but an effciency issue.
>
> > Let's say we have three models: Article, Comment, and User. The
> > relationships are as follows: Article hasMany Comment, Comment hasOne
> > User. Now when the data for Article is retrieved, a nice JOIN query is
> > used to fetch the Comment data together with the Article data, but a
> > seperate query is made for each User instead of using a nice JOIN
> > statement.
>
> > Now I know this is a known issue (https://trac.cakephp.org/ticket/
> > 2931) and I understand why the resolution is set to 'wont fix', but I
> > wondered how other people worked around this or maybe didn't even
> > bother. Truth is, in this specific case of my personal project it
> > doesn't even matter that much. It doesn't need to serve thousands
> > users. But it bothers me that Cake, which first enabled me to
> > elegantly develop applications fast, now kinda shows it's dirty side.
>
> > So what are your thoughts about retrieving data efficiently with Cake?
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Send Simple Mail With CakePHP !

That's about as easy as you're going to get. The Email Component is
pretty straightforward. If you're looking for a really easy way to
send simple emails, just use the PHP mail() function.

http://www.php.net/manual/en/function.mail.php

On Jul 30, 1:27 pm, Abraham Boray <abrahambo...@gmail.com> wrote:
> Well that doesn't help me out , i'm new in CakePHP .
> And I'd like to see a very very simple example to start with =)
>
> I searched the web ,but without getting the point "HOW TO SEND MAIL
> WITH CAKEPHP'
> Hope u undestand me guys
> Regards
> Abraham
>
> On Jul 30, 3:10 pm, brian <bally.z...@gmail.com> wrote:
>
>
>
> > Have a look at thishttp://bakery.cakephp.org/articles/view/brief-overview-of-the-new-ema...
>
> > On Thu, Jul 30, 2009 at 10:43 AM, Abraham Boray<abrahambo...@gmail.com> wrote:
>
> > > Hey Guys
>
> > > I have a Contact form Like this :
>
> > > <form action="comments/UserMailToME" method="post"
> > > name="ContactMeBoard" id="ContactMeBoard">         <label
> > > for="textfield">name</label>
> > >         <input type="text" name="textfield" id="textfield" />
> > >         <label for="textfield2">e-mail</label>
> > >         <input type="text" name="textfield2" id="textfield2" />
> > >         <label for="a_url">subject</label>
> > >         <input type="text" name="textfield3" id="textfield3" />
> > >         <label for="textarea">comment</label>
> > >         <textarea name="textarea" id="textarea"  rows="5"></textarea>
> > >         <label for="textarea">&nbsp;</label>
> > >         <input name="input2" type="submit" class="button"
> > > value="Send" />
> > >         <input name="input" type="reset" value="Reset"
> > > class="button" />
> > > </form>
>
> > > In which i have this text boxes::
> > > +Name +E-Mail +Subject +Content
>
> > > /
> > > *************************************************************************** ********/
> > > And I want the code 4 simple e-mail sending in My "UserMailToME"
> > > action .
>
> > > Regards
> > > Abraham
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Send Simple Mail With CakePHP !

Well that doesn't help me out , i'm new in CakePHP .
And I'd like to see a very very simple example to start with =)

I searched the web ,but without getting the point "HOW TO SEND MAIL
WITH CAKEPHP'
Hope u undestand me guys
Regards
Abraham

On Jul 30, 3:10 pm, brian <bally.z...@gmail.com> wrote:
> Have a look at thishttp://bakery.cakephp.org/articles/view/brief-overview-of-the-new-ema...http://www.google.com/search?&q=cakephp+email
>
> On Thu, Jul 30, 2009 at 10:43 AM, Abraham Boray<abrahambo...@gmail.com> wrote:
>
> > Hey Guys
>
> > I have a Contact form Like this :
>
> > <form action="comments/UserMailToME" method="post"
> > name="ContactMeBoard" id="ContactMeBoard">         <label
> > for="textfield">name</label>
> >         <input type="text" name="textfield" id="textfield" />
> >         <label for="textfield2">e-mail</label>
> >         <input type="text" name="textfield2" id="textfield2" />
> >         <label for="a_url">subject</label>
> >         <input type="text" name="textfield3" id="textfield3" />
> >         <label for="textarea">comment</label>
> >         <textarea name="textarea" id="textarea"  rows="5"></textarea>
> >         <label for="textarea">&nbsp;</label>
> >         <input name="input2" type="submit" class="button"
> > value="Send" />
> >         <input name="input" type="reset" value="Reset"
> > class="button" />
> > </form>
>
> > In which i have this text boxes::
> > +Name +E-Mail +Subject +Content
>
> > /
> > ***********************************************************************************/
> > And I want the code 4 simple e-mail sending in My "UserMailToME"
> > action .
>
> > Regards
> > Abraham
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

how to set "CHECKED" with form helper radio

If I use form helper to create radio button, how can I set "CHECKED"?

For example, if I do like this, where I can set "CHECKED" if I want
to?
$radio_btn = array("1"=>"Yes", "0"=>"No");
echo $form->radio("Test.test", $radio_btn );
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Free Cake Ebook : How to build your own blog from scratch

(source: Wikipedia)

not a source

On Jul 30, 4:43 am, leop <ponton....@gmail.com> wrote:
> > i dont think a lot of people are able to read that - or know the
> > language at all
> > i wonder... why not using ENGLISH in the first place?
>
> I can only assume you made this comment to raise some hackles. While
> we're at it why don't we just abolish German (I assume that's your
> first language)?
>
> Malay is the official language in Brunei, Malaysia, Singapore and is
> native to Malaysia, Indonesia, Thailand. There are also significant
> communities in Australia & Bahrain (source: Wikipedia).
>
> There are plenty of tutorials in English and tutorials in other
> languages are always welcome.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Plural Singular with software

foreach ($software as $sware) {}
would work as well as just
foreach ($software as $s) {}
etc
be creative :)

the scope of this var is so small that you should not bother too much
here


On 30 Jul., 17:34, Manolet Gmail <mano...@gmail.com> wrote:
> Hi, im building an application to collect pieces of software. the problem is
> that "software" dont have a plural form.
> i dont know what to do, i know i can create an inflector but... i dont know
> how to call the array for the foreachs, i mean
>
> foreach ($software(plural) as $software(singular)
>
> i know i can use whatever like $software_many but... im looking for the
> right way to do it..
>
> any ideas?
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Vendors handling with js/css script packages without breaking their file structure

use the .htaccess in your webroot to create the alias then

On Jul 30, 1:16 pm, Christian <christian.lusz...@gmail.com> wrote:
> yes, that Apache alias should work,
>
> but I wanted to modify in cakephp only. Maybe for the next project I
> can use this.
>
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Vendors handling with js/css script packages without breaking their file structure

yes, that Apache alias should work,

but I wanted to modify in cakephp only. Maybe for the next project I
can use this.

Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Efficient ways to retrieve data from models with high association depth

have you tried using Containable behavior?

On Jul 30, 12:16 pm, Roel <roel....@gmail.com> wrote:
> Hi,
>
> I'm using CakePHP for quite some time now and I really love it, but I
> hadn't come around to make use of the complex association
> possibilities for models. So I started to play around with them for a
> personal project I just started. Although the advantages Cake offers
> are numerous, I stumbled across an issue I'm not happy about. It's not
> a bug but an effciency issue.
>
> Let's say we have three models: Article, Comment, and User. The
> relationships are as follows: Article hasMany Comment, Comment hasOne
> User. Now when the data for Article is retrieved, a nice JOIN query is
> used to fetch the Comment data together with the Article data, but a
> seperate query is made for each User instead of using a nice JOIN
> statement.
>
> Now I know this is a known issue (https://trac.cakephp.org/ticket/
> 2931) and I understand why the resolution is set to 'wont fix', but I
> wondered how other people worked around this or maybe didn't even
> bother. Truth is, in this specific case of my personal project it
> doesn't even matter that much. It doesn't need to serve thousands
> users. But it bothers me that Cake, which first enabled me to
> elegantly develop applications fast, now kinda shows it's dirty side.
>
> So what are your thoughts about retrieving data efficiently with Cake?
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Building views for an extended HABTM

WooHoo!!!

After struggling with this for nearly 2 weeks I've managed to get it
working. Oh boy! The pain I've been through trying to sort this out;
but I'm so chuffed I got it sorted without anyone responding to the
(several) postings I've made on this topic. I'll try to put a blog
posting together on this for the benefit of anyone following.

On Jul 28, 4:52 pm, DavidH <DJHollingwo...@gmail.com> wrote:
> Hi
>
> I'm hoping someone will be able to put me out of my misery with thisHABTMproblem I have because it's doing my head in.
>
> I have an application to draw charts of key performance Indicators
> (KPIs). A chart can have many KPIs and a KPI can appear on many
> charts. So I have models:
>
> Chart
> Kpi
>
> and aHABTMrelationship between them using a join table called
> charts_kpis. This all worked like a dream. I had a form that allowed
> the user to specify their chart details (title, size etc) and select
> which KPIs to display on the chart using checkboxes to select the
> KPIs. It was cool!
>
> The I started to add some additional attributes. For example a KPI can
> be displayed in a different colour on each chart and the lines/bar can
> be a different width. So I added some attributes to my charts_kpis
> table which now has the structure:
>
> id - PK
> kpi_id - references kpis table
> chart_id - references charts table
> kpi_colour_id - references kpi_colours table. A model exists for this
> and defines a hasMany relationship with charts_kpis table
> width - width to display this KPI on this chart
>
> Here I started to run into problems. In the end I dissolved theHABTM
> relationship between charts and kpis and resorted to:
>
> Chart hasMany ChartsKpi
> ChartsKpi belongsTo Chart
> Kpi hasMany ChartsKpi
> ChartsKpi belongsTo Kpi
>
> and, of course
>
> KpiColour hasMany ChartsKpi
> ChartsKpi belongsTo KpiColour
>
> However the lengths I've had to go to to get the add/edit forms to
> work (well, the edit form still isn't working right) leads me to think
> that I've really gone about this the wrong way. What I want is a form
> that allows the user to add/edit the chart details (in the charts
> table) at the top and below this to select the KPIs that they want
> (using a checkbox) and select the colour and set the width for the
> KPIs they've selected. (This is very difficult to describe without a
> picture). There's many more attributes to follow once I have this
> 'simple' case working.
>
> Should I have been able to do this using the originalHABTM
> relationship?
>
> Thanks in advance
>
> David
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---