Re: How to pass a variable from a view to the associated controller?

2010-04-09 Thread sebb86
Ok. I made it working.

[controller code]
function view($temp, $value)
{
$this->set('persons', $this->paginate('Person', array('Person.'.
$temp => $value)));
}
[/code]

[view code for one table cell (in this example the table cell for
column "forename")]

link($row['Person']['forename'],
array('controller' => 'persons', 'action' => 'view', $temp, $value)); ?
>
[/code]

It there a better / nicer way to do this?
Thanks :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: best way to cascade against a HABTM relationship?

2010-04-09 Thread John Andersen
I would go away from the HABTM usage and just implement the foreign
key for each parent table in the child table.
You will maybe use a little more space, but you will avoid the
overhead of querying the HABTM table in every query. Also you will be
able to implement cascade delete on the relationships when the parent
is deleted.
Enjoy,
   John


On Apr 9, 6:35 pm, Joshua Taylor  wrote:
> John,
>
> This is not quite accurate.
>
> Contact A would never be associated with more than 1 parent entity.  I
> know that sounds strange, since it is a HABTM relationship.. but what
> I've set up here is a situation where 1 contact table and 1 credential
> table can serve 4 parent entities.  This way I have 2 tables instead
> of 8.
>
> The situation I am trying to create is similar to what you describe.
> If someone deletes a service, the associated records from the
> contacts_services, contacts, credentials_services and credentials
> tables should also be deleted.
>
> I know there are multiple ways to go about that.. I'm just wondering
> what the best way is.
>
> Thanks!
>
> On Apr 8, 1:23 pm, John Andersen  wrote:
>
> > Hmm, I will try to understand what you want to happen using this
> > little example:
>
> > Service A is related HABTM to Contact A
> > Service A is related HABTM to Credential B
> > Service B is related HABTM to Contact A
> > Service B is related HABTM to Credential A
>
> > Let's say that Service A is deleted - do you want automatically also
> > to delete Contact A and Credential B?
>
> > Is the above example something which can happen in your system?
>
> > Enjoy,
> >    John
>
> > On Apr 8, 1:16 am, Joshua Taylor  wrote:> I have a 
> > system with the following logical setup:
>
> > > Machine, Service, Client and Project HABTM Contact and Credential
>
> > > Contact and Credential HABTM Machine, Service, Client and Project
>
> > > It is set up this way so that I can have one table for Contact and
> > > Credential.  This may not be the best way to approach the situation
> > > (I'm no DB guru), so I'm open to suggestions, but I still need to have
> > > a solution for the database schema that I've already set up.
>
> > > So, here's my dilemma (example):
>
> > > If a Service is deleted, I need to delete its associated Contact and
> > > Credential records.
>
> > > Since HABTM relationships don't have a dependency property, how do I
> > > accomplish this (in a non-convoluted way)?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: Fixture not using Model useTable

2010-04-09 Thread Josh
I just solved it after a miserable 3 hours of trouble-shooting.

SimpleTest seems to have a flaw. It has two different methods for
determining the test_suite table name. During table creation and
insertion of fixture records, it uses the test model name property.
During subsequent interaction with the test suite table, it properly
respects the useTable specification in the real model.

It took a lot of fiddling to determine that. And, due to the
pluralizations you just mentioned, I had to change the test model name
to Dat. I may add a custom inflection tomorrow but I had trouble
getting simpleTest to recognize custom inflections earlier.

I'm glad that is all over with.

Thanks for your help.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Migration to 1.3 from 1.2

2010-04-09 Thread Dave
Just starting out here and first error in my adventure is 
 
Warning (2)  : require_once(cake/libs/flay.php)
[function.require-once  ]: failed to
open stream: No such file or directory [CORE/cake/basics.php, line 89]
Code   | Context  
$args = func_get_args();
foreach ($args as $file) {
require_once(LIBS . strtolower($file) . '.php');
$args   =   array(
"Flay"
)
$file   =   "Flay"
uses - CORE/cake/basics.php, line 89
uses - CORE/cake/basics.php, line 89
include - APP/views/elements/jobs/featured_jobs.ctp, line 1
View::_render() - CORE/cake/libs/view/view.php, line 723
View::element() - CORE/cake/libs/view/view.php, line 385
SidebarHelper::getSidebar() - APP/views/helpers/sidebar.php, line 199
include - APP/views/layouts/default_left.ctp, line 25
View::_render() - CORE/cake/libs/view/view.php, line 723
View::renderLayout() - CORE/cake/libs/view/view.php, line 482
View::render() - CORE/cake/libs/view/view.php, line 428
Controller::render() - CORE/cake/libs/controller/controller.php, line 909
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 207
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
[main] - APP/webroot/index.php, line 83

Fatal error: require_once() [function.require
 ]: Failed opening required
'cake/libs/flay.php'
(include_path='/home4/widepixe/public_html/dev/app/vendors/htmlpurifier/libr
ary:/home4/widepixe/public_html/dev:/home4/widepixe/public_html/dev/app/:.:/
usr/lib/php:/usr/local/lib/php') in
/home4/widepixe/public_html/dev/cake/basics.php on line 89

Any ideas?

Thanks
 
 
Dave

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: Fixture not using Model useTable

2010-04-09 Thread Jeremy Burns
Wild straw grabbing - is it to do with the pluralisation of the table name? 
data/datum/datums?

Jeremy Burns
jeremybu...@me.com


On 10 Apr 2010, at 07:12, Josh wrote:

> Thanks for your response. I have been clearing cache periodically and
> my debug is set to 2. I believe that when running simpleTest, cake
> flashes the cache automatically at debug = 2 but I have been clearing
> it myself just to be sure.
> 
> No luck still.
> 
> Any other ideas?
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en
> 
> To unsubscribe, reply using "remove me" as the subject.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Fixture not using Model useTable

2010-04-09 Thread Josh
Thanks for your response. I have been clearing cache periodically and
my debug is set to 2. I believe that when running simpleTest, cake
flashes the cache automatically at debug = 2 but I have been clearing
it myself just to be sure.

No luck still.

Any other ideas?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


How to pass a variable from a view to the associated controller?

2010-04-09 Thread sebb86
Hello,
how can i pass a variable from a view to the associated controller? I
need this because i want to reload the view with other values for
paginate.
I'd like to do this inside "html->link". The two variables are named
"value" and "temp".
"temp" should contain the database field in the suitable form, that i
can insert it correct. "value" cotains the value for paginate.

[some controller code]
$this->paginate('Person', array('Person."$temp"' => $value))
[/code]

[view code]
link($row['Person']['forename'],
array('controller' => 'persons', 'action' => 'view', "forename" =>
$temp, $row['Person']['forename'] => $value)); ?>
[/code]

I don't get it working. :(
Thanks if someone can help!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: Fixture not using Model useTable

2010-04-09 Thread Jeremy Burns
Have you cleared your cache? Clear the contents of all folders under 
/app/tmp/cache. Then run your app with debug set to 2 at least once (this 
refills the cache). If you are using  var $persistModel = true;  
in your app_controller, disable that first then re-enable.

Jeremy Burns
jeremybu...@me.com

On 10 Apr 2010, at 06:46, Josh wrote:

> Hello (help!!!),
> 
> I had to rename a table in my database. I was able to specify the
> useTable in my model so there was no significant knock-on from this
> change.
> 
> But, my unit tests won't recognize the new table name during table
> creation. I can see in the SQL dump that the old table has been
> created (per Inflector:pluralize), and from the error...
> 
> "Database table test_suite_datums for model Datum was not found."
> 
> ... I can see that simpleTest knows what the table name should be
> (datums is the new useTable... replacing the default data--which
> conflicts with Cake). I have tried emptying cache, writing a custom
> inflection, and I have tried putting in undocumented members--ie
> useTable--in the fixture. But, I can't seem to solve this problem, and
> now none of my tests can run since this fixture is instantiated for
> all test cases.
> 
> Any suggestions? I have seen similar problems to this which were never
> solved:
> 
> http://groups.google.com/group/cake-php/browse_thread/thread/fedca8aff44d9a4f/9040989b8f883180?lnk=gst&q=fixture+usetable#9040989b8f883180
> 
> I am pulling my hair out. I'd prefer not rename the model entirely.
> There must be a clean way to make the fixture recognize the Model
> useTable.
> 
> Thanks
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en
> 
> To unsubscribe, reply using "remove me" as the subject.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Fixture not using Model useTable

2010-04-09 Thread Josh
Hello (help!!!),

I had to rename a table in my database. I was able to specify the
useTable in my model so there was no significant knock-on from this
change.

But, my unit tests won't recognize the new table name during table
creation. I can see in the SQL dump that the old table has been
created (per Inflector:pluralize), and from the error...

"Database table test_suite_datums for model Datum was not found."

... I can see that simpleTest knows what the table name should be
(datums is the new useTable... replacing the default data--which
conflicts with Cake). I have tried emptying cache, writing a custom
inflection, and I have tried putting in undocumented members--ie
useTable--in the fixture. But, I can't seem to solve this problem, and
now none of my tests can run since this fixture is instantiated for
all test cases.

Any suggestions? I have seen similar problems to this which were never
solved:

http://groups.google.com/group/cake-php/browse_thread/thread/fedca8aff44d9a4f/9040989b8f883180?lnk=gst&q=fixture+usetable#9040989b8f883180

I am pulling my hair out. I'd prefer not rename the model entirely.
There must be a clean way to make the fixture recognize the Model
useTable.

Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: My App is Getting too Slow

2010-04-09 Thread Christian Leskowsky
Have you profiled the request yet? (Suggested above.) Look into xdebug -
specifically http://xdebug.org/docs/profiler.

btw. Are you absolutely sure it's server time you're waiting on? Yslow or
Pagespeed will tell you that. Hmm... 79 queries is absolutely nuts too. I've
heard it said - can't remember where - that anything over about 7ish per
request is asking for trouble. (General rule of thumb.)

On Thu, Apr 8, 2010 at 12:39 PM, Ayman Bedair  wrote:

> That is what i get from the debug timer:
>
> http://www.eg-host.net/887.jpg
>
> I still have no clue what takes most of the time and what is the
> normal time of doing the core processing :S
>
>
> ANY HELP?!
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>
> To unsubscribe, reply using "remove me" as the subject.
>



-- 
-

"You can't reason people out of a position they didn't use reason to get
into."

Christian Leskowsky

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Manipulating Data Based on Non Related Model Data

2010-04-09 Thread Jeremy Burns
This could well start a storm of "you're not quite right" replies - but I think 
the spirit of this answer is about right.

In MVC:
Models do all the data humping and nothing else. Models can have behaviours 
(such as the tree behaviour).
Controllers control how the application flows. Controllers can have components 
that perform specific functions shared by many/all controllers. Controllers 
talk to models to retrieve/save data, and then send it to views.
Views do all the presentation and user interaction. Views shouldn't really 
contain too much logic - but they can have helpers that handle recurring 
specific display tasks (such as your time slot issue).

So by the presentation layers, I mean the view part.

Jeremy Burns
jeremybu...@me.com


On 10 Apr 2010, at 05:33, paws_galuten wrote:

> Ah, a helper... ok. I'll research that. Where do helpers fit into the
> MVC pattern?
> What do you mean by "presentation layer?"
> 
> 
> On Apr 9, 8:17 pm, Jeremy Burns  wrote:
>> Is this for the presentation layer? If so, the controller can call the raw 
>> data from the model and then the display logic probably belongs in a helper?
>> 
>> Jeremy Burns
>> jeremybu...@me.com
>> 
>> On 10 Apr 2010, at 02:00, paws_galuten wrote:
>> 
>> 
>> 
>>> I am learning that data manipulation needs to be done in the model.
>>> Fat Model, thin controller. Ok, so I'm trying to wrap my mind around
>>> something. Here's my example:
>> 
>>> Let's assume these tables:
>> 
>>> people (id, name)
>>> events (id, name, day, time)
>>> events_people (event_id, person_id)
>> 
>>> So, people HABTM events. totally cool so far.
>> 
>>> Now, let's say that when viewing a person I want to see all of the
>>> events organized into time slots based on another table in the
>>> database:
>> 
>>> times (id, day, start, end)
>> 
>>> There's no relationship between events and times. It's just that I
>>> want the event that happens on Friday at 2pm to be displayed in the
>>> time slot that is Friday 1pm - 4pm, for example.
>> 
>>> The point is, somewhere I have to cycle through the times and then
>>> cycle through the events and see if the time of the event is between
>>> "start" and "end" so I know if it should be displayed there. I guess I
>>> need to do data logic like that in the model, but which model? Should
>>> I have a method in the person model in which I also grab the data from
>>> the time model and then return an array with all of the display data
>>> neatly packaged for the view?
>> 
>>> Maybe this is a confusing question. I think I'm just still trying to
>>> understand the cakePHP conventions.
>> 
>>> Any ideas would be greatly appreciated.
>>> Thanks,
>>> Jason
>> 
>>> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
>>> with their CakePHP related questions.
>> 
>>> You received this message because you are subscribed to the Google Groups 
>>> "CakePHP" group.
>>> To post to this group, send email to cake-php@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
>>> athttp://groups.google.com/group/cake-php?hl=en
>> 
>>> To unsubscribe, reply using "remove me" as the subject.
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Manipulating Data Based on Non Related Model Data

2010-04-09 Thread paws_galuten
Ah, a helper... ok. I'll research that. Where do helpers fit into the
MVC pattern?
What do you mean by "presentation layer?"


On Apr 9, 8:17 pm, Jeremy Burns  wrote:
> Is this for the presentation layer? If so, the controller can call the raw 
> data from the model and then the display logic probably belongs in a helper?
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 10 Apr 2010, at 02:00, paws_galuten wrote:
>
>
>
> > I am learning that data manipulation needs to be done in the model.
> > Fat Model, thin controller. Ok, so I'm trying to wrap my mind around
> > something. Here's my example:
>
> > Let's assume these tables:
>
> > people (id, name)
> > events (id, name, day, time)
> > events_people (event_id, person_id)
>
> > So, people HABTM events. totally cool so far.
>
> > Now, let's say that when viewing a person I want to see all of the
> > events organized into time slots based on another table in the
> > database:
>
> > times (id, day, start, end)
>
> > There's no relationship between events and times. It's just that I
> > want the event that happens on Friday at 2pm to be displayed in the
> > time slot that is Friday 1pm - 4pm, for example.
>
> > The point is, somewhere I have to cycle through the times and then
> > cycle through the events and see if the time of the event is between
> > "start" and "end" so I know if it should be displayed there. I guess I
> > need to do data logic like that in the model, but which model? Should
> > I have a method in the person model in which I also grab the data from
> > the time model and then return an array with all of the display data
> > neatly packaged for the view?
>
> > Maybe this is a confusing question. I think I'm just still trying to
> > understand the cakePHP conventions.
>
> > Any ideas would be greatly appreciated.
> > Thanks,
> > Jason
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> > To unsubscribe, reply using "remove me" as the subject.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Js helper issue

2010-04-09 Thread LordZardeck
I have that correct. I also have it in a file called app_helper.php
and the helper class states:

class AppHelper extends Helper {

Do I have the AppHelper class wrong? If not,could it be the naming of
the Engine itself? Here's what I have:

class DojoEngineHelper extends JsBaseEngineHelper {

in a file called dojo_engine.php. Do you have any other ideas of what
could cause this?

On Apr 9, 10:11 pm, mark_story  wrote:
> Not loading the helper correctly can do that.
>
> $helpers = array('Js' => array('Dojo')); should do it.
>
> -Mark
>
> On Apr 9, 5:40 pm, LordZardeck  wrote:
>
>
>
> > For some reason, to use my js engine, i have to access it like so:
>
> > $js->DojoEngine->get("#clickme")->event($funtion, "click");
>
> > instead of just $js->get() like the docs say. What could cause this?- Hide 
> > quoted text -
>
> - Show quoted text -

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: Manipulating Data Based on Non Related Model Data

2010-04-09 Thread Jeremy Burns
Is this for the presentation layer? If so, the controller can call the raw data 
from the model and then the display logic probably belongs in a helper?

Jeremy Burns
jeremybu...@me.com

On 10 Apr 2010, at 02:00, paws_galuten wrote:

> I am learning that data manipulation needs to be done in the model.
> Fat Model, thin controller. Ok, so I'm trying to wrap my mind around
> something. Here's my example:
> 
> Let's assume these tables:
> 
> people (id, name)
> events (id, name, day, time)
> events_people (event_id, person_id)
> 
> So, people HABTM events. totally cool so far.
> 
> Now, let's say that when viewing a person I want to see all of the
> events organized into time slots based on another table in the
> database:
> 
> times (id, day, start, end)
> 
> There's no relationship between events and times. It's just that I
> want the event that happens on Friday at 2pm to be displayed in the
> time slot that is Friday 1pm - 4pm, for example.
> 
> The point is, somewhere I have to cycle through the times and then
> cycle through the events and see if the time of the event is between
> "start" and "end" so I know if it should be displayed there. I guess I
> need to do data logic like that in the model, but which model? Should
> I have a method in the person model in which I also grab the data from
> the time model and then return an array with all of the display data
> neatly packaged for the view?
> 
> Maybe this is a confusing question. I think I'm just still trying to
> understand the cakePHP conventions.
> 
> Any ideas would be greatly appreciated.
> Thanks,
> Jason
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en
> 
> To unsubscribe, reply using "remove me" as the subject.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: odd form field behavior when implementing auth

2010-04-09 Thread Jeremy Burns
Try:

echo $this->Form->input('employee_id', array('type' => 'text'));

I think the reason it is hiding it is because Cake usually hides id fields on 
add/edit views - probably does the same for a login form too? But I'm guessing 
a bit.

Jeremy Burns
jeremybu...@me.com
On 9 Apr 2010, at 18:39, Ben W. wrote:

> hello -
> 
> I am trying to figure out why a form page for login refuses to display
> a field with the name employee_id.
> 
> code is as follows:
> 
> model:
> class User extends AppModel {
>var $useTable = 'employees';
>var $primaryKey = 'employee_id';
> }
> 
> controller:
> class UsersController extends AppController {
> 
>   var $name = 'Users';
>   var $helpers = array('Html', 'Form');
>   var $components = array('Auth');
> 
>function beforeFilter() {
>Security::setHash("md5");
>$this->Auth->fields = array('password' =>
> 'employee_password','username' => 'employee_id');
>$this->Auth->loginAction = array('controller' => 'users',
> 'action' => 'login');
>$this->Auth->loginRedirect = array('controller' =>
> 'dashboard', 'action' => 'index');
>$this->Auth->loginError = 'No username and password was
> found with that combination.';
>$this->Auth->logoutRedirect = '/';
> 
>}
> 
>function login() {
> 
>}
> 
>function logout() {
>$this->redirect($this->Auth->logout());
>}
> }
> 
> view:
>$session->flash('auth');
>echo $form->create('User', array('action' => 'login'));
>echo $form->input('employee_id');
>echo $form->input('employee_password');
>echo $form->end('Login');
> 
> 
> Yet the result is http://dl.dropbox.com/u/178319/cake-arg.jpeg
> 
> Any ideas why it refuses to show the input form field employee_id ?
> 
> Thanks
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en
> 
> To unsubscribe, reply using "remove me" as the subject.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Js helper issue

2010-04-09 Thread mark_story
Not loading the helper correctly can do that.

$helpers = array('Js' => array('Dojo')); should do it.

-Mark

On Apr 9, 5:40 pm, LordZardeck  wrote:
> For some reason, to use my js engine, i have to access it like so:
>
> $js->DojoEngine->get("#clickme")->event($funtion, "click");
>
> instead of just $js->get() like the docs say. What could cause this?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: Let's get rid of The Bakery

2010-04-09 Thread mark_story
Just thought I would chime in on this one.  The spam issue, has
definitely become a problem and is certainly something that needs to
be fixed.  There are also a number of other issues with the bakery as
others have noted in this thread.

Some background on how things got to where they were is order I
think.  About 9 months, ago a group of people started some work on the
bakery.  Over time interest and time dwindled and the work started was
never really completed.  Personally, between work, cakephp, debug kit,
the api, and the rest of my life, I simply don't have the time to
spend on fixing what needs to be done on the bakery.  What the bakery
really needs right now is a few people who can make the time to fix up
the existing issues, and have some ideas on how to make the bakery an
even more useful source of information.  The source code for the
bakery is freely available on github. http://github.com/cakephp/bakery
.  There is also a ticket tracker setup on lighthouse.  All it needs
is some time and love, and some people willing to help rehabilitate
it :).

Currently moderation for the bakery is done manually by a small group
of people, however with limited hands and time its very challenging to
get everything done that needs to be done.  If people are interested
in moderating the bakery, I'm sure something can be arranged.

-Mark


On Apr 8, 5:37 pm, jacmoe  wrote:
> It would be nice to get some feedback from someone *in* the CakePHP
> team.
>
> I am not interested in letting it die, but it cannot continue the way
> it does now.
> If you need any help - which I bet you do - just say the word.
>
> Moderation and code review of the Bakery itself - there's some strange
> glitches and bugs in the software.
>
> Help us to help you make it better. :)
>
> On Apr 6, 11:50 am, WebbedIT  wrote:
>
> > +1 for MilesJ's commentia plugin, it's not akismet by any stretch, but
> > it certainly works for me.
>
> >http://www.milesj.me/resources/script/commentia-behavior
>
> > Blank emails using Thunderbird for me too, CTRL + U let's me see the
> > HTML source and copy paste the link to the correct article, but it is
> > very embarrassing.
>
> > Paul
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: Let's get rid of The Bakery

2010-04-09 Thread Predominant
Reference #1 from previous post: cakephp.lighthouseapp.com/projects/
42648-cakephp-1x


On Apr 10, 1:03 pm, Predominant  wrote:
> Hey all,
>
> Rest assured, we're discussing this problem within the development
> team to ensure the action we do take is the best for the long term.
> We apologise for the spammy comments that exist while we decide on and
> implement a solution.
> This should be resolved very soon.
>
> That aside, the bakery and cookbook are open projects.
> While the core team continues to work on the hundreds of tickets[1]
> that exist for the core including enhancements and defects, we do have
> trouble finding time to continually develop the associated projects
> such as the bakery.
> In the past we have welcomed "development team" members that worked
> exclusively on these side projects, and we'd be interested in hearing
> from anyone that would like to contribute to help keep the bakery up
> to date and functional.
>
> If you're not comfortable with developing, we're in need of bakery
> moderators to read through, suggest changes, and accept submissions
> for articles on the bakery.
> Again, if you are interested, please feel free to contact one of the
> core team (eg: markstory, myself, PhpNut, jose_zap or ADmad).
> You can do that here on the group, or in IRC, twitter to @cakephp too.
>
> In the mean time, we're fixing this spam problem as best we can!
>
> Cheers,
>
> Graham Weldon (aka. Predominant)
> e. gra...@grahamweldon.com
> p. +61 407 017 293
> w.http://grahamweldon.com
>
> On Apr 9, 7:37 am, jacmoe  wrote:
>
>
>
> > It would be nice to get some feedback from someone *in* the CakePHP
> > team.
>
> > I am not interested in letting it die, but it cannot continue the way
> > it does now.
> > If you need any help - which I bet you do - just say the word.
>
> > Moderation and code review of the Bakery itself - there's some strange
> > glitches and bugs in the software.
>
> > Help us to help you make it better. :)
>
> > On Apr 6, 11:50 am, WebbedIT  wrote:
>
> > > +1 for MilesJ's commentia plugin, it's not akismet by any stretch, but
> > > it certainly works for me.
>
> > >http://www.milesj.me/resources/script/commentia-behavior
>
> > > Blank emails using Thunderbird for me too, CTRL + U let's me see the
> > > HTML source and copy paste the link to the correct article, but it is
> > > very embarrassing.
>
> > > Paul
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: Let's get rid of The Bakery

2010-04-09 Thread Predominant
Hey all,

Rest assured, we're discussing this problem within the development
team to ensure the action we do take is the best for the long term.
We apologise for the spammy comments that exist while we decide on and
implement a solution.
This should be resolved very soon.

That aside, the bakery and cookbook are open projects.
While the core team continues to work on the hundreds of tickets[1]
that exist for the core including enhancements and defects, we do have
trouble finding time to continually develop the associated projects
such as the bakery.
In the past we have welcomed "development team" members that worked
exclusively on these side projects, and we'd be interested in hearing
from anyone that would like to contribute to help keep the bakery up
to date and functional.

If you're not comfortable with developing, we're in need of bakery
moderators to read through, suggest changes, and accept submissions
for articles on the bakery.
Again, if you are interested, please feel free to contact one of the
core team (eg: markstory, myself, PhpNut, jose_zap or ADmad).
You can do that here on the group, or in IRC, twitter to @cakephp too.

In the mean time, we're fixing this spam problem as best we can!

Cheers,

Graham Weldon (aka. Predominant)
e. gra...@grahamweldon.com
p. +61 407 017 293
w. http://grahamweldon.com


On Apr 9, 7:37 am, jacmoe  wrote:
> It would be nice to get some feedback from someone *in* the CakePHP
> team.
>
> I am not interested in letting it die, but it cannot continue the way
> it does now.
> If you need any help - which I bet you do - just say the word.
>
> Moderation and code review of the Bakery itself - there's some strange
> glitches and bugs in the software.
>
> Help us to help you make it better. :)
>
> On Apr 6, 11:50 am, WebbedIT  wrote:
>
> > +1 for MilesJ's commentia plugin, it's not akismet by any stretch, but
> > it certainly works for me.
>
> >http://www.milesj.me/resources/script/commentia-behavior
>
> > Blank emails using Thunderbird for me too, CTRL + U let's me see the
> > HTML source and copy paste the link to the correct article, but it is
> > very embarrassing.
>
> > Paul
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Manipulating Data Based on Non Related Model Data

2010-04-09 Thread paws_galuten
I am learning that data manipulation needs to be done in the model.
Fat Model, thin controller. Ok, so I'm trying to wrap my mind around
something. Here's my example:

Let's assume these tables:

people (id, name)
events (id, name, day, time)
events_people (event_id, person_id)

So, people HABTM events. totally cool so far.

Now, let's say that when viewing a person I want to see all of the
events organized into time slots based on another table in the
database:

times (id, day, start, end)

There's no relationship between events and times. It's just that I
want the event that happens on Friday at 2pm to be displayed in the
time slot that is Friday 1pm - 4pm, for example.

The point is, somewhere I have to cycle through the times and then
cycle through the events and see if the time of the event is between
"start" and "end" so I know if it should be displayed there. I guess I
need to do data logic like that in the model, but which model? Should
I have a method in the person model in which I also grab the data from
the time model and then return an array with all of the display data
neatly packaged for the view?

Maybe this is a confusing question. I think I'm just still trying to
understand the cakePHP conventions.

Any ideas would be greatly appreciated.
Thanks,
Jason

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: Allowing access to plugin pages

2010-04-09 Thread Andy Dirnberger
Try $this->Auth->allow('*'). I think the addition of array() is what's
tripping you up.

On Apr 9, 4:48 pm, TobyG  wrote:
> Hi there,
>
> Just wondering how to grant access to a plugin page using Auth.
>
> Have tried using...
>
> $this->Auth->allow(array('*'));
>
> in the before filter for the controller app, which is being called,
> but it doesn't seem to make a difference.
>
> Any ideas?
>
> T

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


wildcard prefix routing

2010-04-09 Thread sax
I'm having some errors when following the exact example from the
CakePHP cookbook on Route Configuration. 
http://book.cakephp.org/view/544/Prefix-Routing

I am trying to replicate the example and have routing connect a prefix
and action name to a matched method in my controller. So, a prefix of
user and an action of create would match up to a method of
user_create.

This is the exact example from the doc yet errors with a missing
method for the action. The error is correct in the sense that I do not
have a method with the exact name of the action, but thats the point,
I have methods that are a blend of the prefix and action. Any help
would be appreciated. Assume that I have the same router connect code
as the example below. I'm using cake 1.2.6

The documentation goes as follows.

Wildcard prefix routing is available using the named element :prefix
similar to :controller and :action. You can map the url /api/user/
create to your user_create action of api controller using the
following route

Code View
Router::connect('/api/:prefix/:action', array('controller' => 'api'));

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Js helper issue

2010-04-09 Thread LordZardeck
For some reason, to use my js engine, i have to access it like so:

$js->DojoEngine->get("#clickme")->event($funtion, "click");

instead of just $js->get() like the docs say. What could cause this?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


odd form field behavior when implementing auth

2010-04-09 Thread Ben W.
hello -

I am trying to figure out why a form page for login refuses to display
a field with the name employee_id.

code is as follows:

model:
class User extends AppModel {
var $useTable = 'employees';
var $primaryKey = 'employee_id';
}

controller:
class UsersController extends AppController {

var $name = 'Users';
var $helpers = array('Html', 'Form');
var $components = array('Auth');

function beforeFilter() {
Security::setHash("md5");
$this->Auth->fields = array('password' =>
'employee_password','username' => 'employee_id');
$this->Auth->loginAction = array('controller' => 'users',
'action' => 'login');
$this->Auth->loginRedirect = array('controller' =>
'dashboard', 'action' => 'index');
$this->Auth->loginError = 'No username and password was
found with that combination.';
$this->Auth->logoutRedirect = '/';

}

function login() {

}

function logout() {
$this->redirect($this->Auth->logout());
}
}

view:
$session->flash('auth');
echo $form->create('User', array('action' => 'login'));
echo $form->input('employee_id');
echo $form->input('employee_password');
echo $form->end('Login');


Yet the result is http://dl.dropbox.com/u/178319/cake-arg.jpeg

Any ideas why it refuses to show the input form field employee_id ?

Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Allowing access to plugin pages

2010-04-09 Thread TobyG
Hi there,

Just wondering how to grant access to a plugin page using Auth.

Have tried using...

$this->Auth->allow(array('*'));

in the before filter for the controller app, which is being called,
but it doesn't seem to make a difference.

Any ideas?

T

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: Sessions folder is getting huge

2010-04-09 Thread euromark
do you use the php one? or the cake tmp/ one?
because the first is usually garbige collected automatically, the cake
session folder is not, though!


On 9 Apr., 19:11, Miles J  wrote:
> Maybe you have a lot of sessions?
>
> Try switching it to using a database.
>
> On Apr 9, 5:20 am, DeepJaguar  wrote:
>
> > Hi all,
>
> > I have a problem with the tmp/sessions folder. For one of my sites the
> > folder is 25GB already! What can be the problem?
>
> > Best Regards,
> > Jeffrey

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


need help saving cross reference table

2010-04-09 Thread mdb
Hi All,

I have view.ctp where i'm displaying list of Events
Each event will have a Register link which should insert (eventid and
session user id ) to EventRegistrations table.


I'm new php, so please help me with some sample code...


Thanks In Advance

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: using Cake data in external script

2010-04-09 Thread Paolo
I would like to extract data from cake, i.e. use myModel->find('all').

On Apr 9, 7:10 pm, Miles J  wrote:
> What exactly are you trying to use?
>
> Cakes system is so tightly coupled with it self, that its going to be
> near impossible to use certain parts of it externally.
>
> On Apr 9, 9:18 am, Paolo  wrote:
>
> > Hi all, I'm trying to use Cakephp data in an external script, I used
> > to do something like this in 1.1:
>
> > require 'app/webroot/index.php';
>
> > But it does not seem to work in 1.2, it complains about AppController
> > missing. Is there something I need to change to make it work?
>
> > Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: HtmlHelper and Routes

2010-04-09 Thread Miles J
@Cricket - Thats how its done in 1.3.

@Signified - Everything you said is correct and should happen, I use
it all the time. Im actually quite lost as why thats not working, it
looks correct. Try this:

Router::connect('/login/*', array('controller' => 'users', 'action' =>
'login'));

On Apr 9, 4:23 am, cricket  wrote:
> On Apr 8, 8:39 pm, Signified  wrote:
>
>
>
> > If I create this route:
>
> > Router::connect('/login', array('controller' => 'users', 'action' =>
> > 'login'));
>
> > Then I use the HtmlHelper to create a hyperlink in a view like this:
>
> > echo $this->Html->link('Login', array('controller' => 'users',
> > 'action' => 'login'));
>
> > I would expect to get this:
>
> > Login
>
> > But instead, I get this:
>
> > Login
>
> > Shouldn't the HtmlHelper honour routes?
>
> > If it did, I could change the route to be this (for whatever reason):
>
> > Router::connect('/sign-in', array('controller' => 'users', 'action' =>
> > 'login'));
>
> > And all my links would update automagically.
>
> > Any thoughts???
>
> That's correct. The only thing I see that's different from how I do it
> is that I use $html->link(...). I just tried it with $this->Html-
>
> >link(...) and got a fatal error. Where do you have this code?
>
> What version are you using?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: Sessions folder is getting huge

2010-04-09 Thread Miles J
Maybe you have a lot of sessions?

Try switching it to using a database.

On Apr 9, 5:20 am, DeepJaguar  wrote:
> Hi all,
>
> I have a problem with the tmp/sessions folder. For one of my sites the
> folder is 25GB already! What can be the problem?
>
> Best Regards,
> Jeffrey

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: using Cake data in external script

2010-04-09 Thread Miles J
What exactly are you trying to use?

Cakes system is so tightly coupled with it self, that its going to be
near impossible to use certain parts of it externally.

On Apr 9, 9:18 am, Paolo  wrote:
> Hi all, I'm trying to use Cakephp data in an external script, I used
> to do something like this in 1.1:
>
> require 'app/webroot/index.php';
>
> But it does not seem to work in 1.2, it complains about AppController
> missing. Is there something I need to change to make it work?
>
> Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


using Cake data in external script

2010-04-09 Thread Paolo
Hi all, I'm trying to use Cakephp data in an external script, I used
to do something like this in 1.1:

require 'app/webroot/index.php';

But it does not seem to work in 1.2, it complains about AppController
missing. Is there something I need to change to make it work?

Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Sessions folder is getting huge

2010-04-09 Thread DeepJaguar
Hi all,

I have a problem with the tmp/sessions folder. For one of my sites the
folder is 25GB already! What can be the problem?

Best Regards,
Jeffrey

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Fitting my application architecture into Cake

2010-04-09 Thread Osman Ullah
Hi all,

I am a pretty novice programmer when it comes to PHP and I am just
learning to use Cake. My expertise is in "stateful" environment
(desktop clients, flash clients, etc). I have some questions about the
best way to do what I need and I was hoping someone here might up to
giving me some advice.

Anyway, I am trying to use Cake to provide the MVC architecture for a
web app I am building. We already have REST APIs available to access
the data so I want to use those.

I am getting stuck on (a) how to handle authentication and (b) how to
get the data.

The way that authentication works in our system is:

1) Make request to login service at fixed url
2) The response will contain a session ID (I will call this mySession)
and new URL for all future requests
3) Make all future requests at new URL, and include session id.

So the problem I am having is how to properly model this?

So far I have come up with creating an "auth component" which works
similar to the CakePHP auth component. It checks for a valid mySession
ID and if it is there, it allows the application to continue,
otherwise it redirects to the login page. When the user logs in, this
component will store the mySession ID as well as the apiUrl in the
Session.

The 2nd problem is how to access data...I thought the best way would
be to add a http service to the models which would make the request
for data and then override the find function to leverage this.
However, now the problem is I can't access the session from the Model
to get the keys I need so maybe that isn't the right way?

I looked into using a custom datasource but the examples have been
very thin and not very helpful, and I still run into the problem how
to pass my session and api values.

Thanks for any help you can provide!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: best way to cascade against a HABTM relationship?

2010-04-09 Thread Joshua Taylor
John,

This is not quite accurate.

Contact A would never be associated with more than 1 parent entity.  I
know that sounds strange, since it is a HABTM relationship.. but what
I've set up here is a situation where 1 contact table and 1 credential
table can serve 4 parent entities.  This way I have 2 tables instead
of 8.

The situation I am trying to create is similar to what you describe.
If someone deletes a service, the associated records from the
contacts_services, contacts, credentials_services and credentials
tables should also be deleted.

I know there are multiple ways to go about that.. I'm just wondering
what the best way is.

Thanks!

On Apr 8, 1:23 pm, John Andersen  wrote:
> Hmm, I will try to understand what you want to happen using this
> little example:
>
> Service A is related HABTM to Contact A
> Service A is related HABTM to Credential B
> Service B is related HABTM to Contact A
> Service B is related HABTM to Credential A
>
> Let's say that Service A is deleted - do you want automatically also
> to delete Contact A and Credential B?
>
> Is the above example something which can happen in your system?
>
> Enjoy,
>    John
>
> On Apr 8, 1:16 am, Joshua Taylor  wrote:> I have a 
> system with the following logical setup:
>
> > Machine, Service, Client and Project HABTM Contact and Credential
>
> > Contact and Credential HABTM Machine, Service, Client and Project
>
> > It is set up this way so that I can have one table for Contact and
> > Credential.  This may not be the best way to approach the situation
> > (I'm no DB guru), so I'm open to suggestions, but I still need to have
> > a solution for the database schema that I've already set up.
>
> > So, here's my dilemma (example):
>
> > If a Service is deleted, I need to delete its associated Contact and
> > Credential records.
>
> > Since HABTM relationships don't have a dependency property, how do I
> > accomplish this (in a non-convoluted way)?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: HtmlHelper and Routes

2010-04-09 Thread cricket
On Apr 8, 8:39 pm, Signified  wrote:
> If I create this route:
>
> Router::connect('/login', array('controller' => 'users', 'action' =>
> 'login'));
>
> Then I use the HtmlHelper to create a hyperlink in a view like this:
>
> echo $this->Html->link('Login', array('controller' => 'users',
> 'action' => 'login'));
>
> I would expect to get this:
>
> Login
>
> But instead, I get this:
>
> Login
>
> Shouldn't the HtmlHelper honour routes?
>
> If it did, I could change the route to be this (for whatever reason):
>
> Router::connect('/sign-in', array('controller' => 'users', 'action' =>
> 'login'));
>
> And all my links would update automagically.
>
> Any thoughts???

That's correct. The only thing I see that's different from how I do it
is that I use $html->link(...). I just tried it with $this->Html-
>link(...) and got a fatal error. Where do you have this code?

What version are you using?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: After validation data is getting cleared

2010-04-09 Thread Hani Sana
In view :states
add.ctp


create('State');?>


input('abbr');
echo $form->input('name');
?>

end('Submit');?>


In Controller :

class StatesController extends AppController {

var $name = 'States';
var $helpers = array('Html', 'Form');

function add() {
if (!empty($this->data)) {
$this->State->create();
if ($this->State->save($this->data)) {
$this->Session->setFlash(__('The State has been 
saved', true));
$this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash(__('The State could 
not be saved. Please,
try again.', true));
}
}
}
}

In Model :
class State extends AppModel {

var $name = 'State';
var $validate = array(
'abbr' => array('notempty'),
'name' => array('notempty')
);

}


Use this code as Above just copy paste it , and follow as it , its may
solved ur pm..I hope .
By.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: After validation data is getting cleared

2010-04-09 Thread Ambika Kulkarni
Hi Jeremy,

I did the corrections for minlength and I put data);?> code both in controller and view.
When i submit the form with some empty fields, then error msg is
displaying and in the controller i am getting the data but not in the
view file.

Ambika

On Apr 9, 10:51 am, Jeremy Burns  wrote:
> A few quick observations...
>
> Your 'minLenght' validation rules are spelt incorrectly. Should be 
> 'minLength'.
>
> Try using  echo $this->Form->input('Model.fieldName', array('class' => 
> 'fullwidth')); . Notice I use the model name as well.
>
> This ought to make your $form-error statements redundant too.
>
> Next step is to:  debug($this->data);  ...in both your 
> controller function and your view - see what's in there. If you are still 
> having problems, post the contents of the data array back here.
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 9 Apr 2010, at 06:42, Ambika Kulkarni wrote:
>
> > Hi John,
>
> > In the model(user.php) I am doing the validation
> >  > class User extends AppModel {
> >   var $name = 'User';
> >   var $validate = array(
> >   'name' => array(
> >      'rule' => array('minLenght', 1),
> >      'required' => true,
> >      'allowEmpty' => false,
> >      'message' => 'Please enter a value for the Name field'
> >   ),
> >    'telephone' => array(
> >      'rule' => array('minLenght', 1),
> >      'required' => true,
> >      'allowEmpty' => false,
> >      'message' => 'Please enter a value for the Telephone field'
> >   ),
> >    'email' => array(
> >      'rule' => 'email',
> >      'required' => true,
> >      'allowEmpty' => false,
> >      'message' => 'Please enter a value for the Email field'
> >   ),
> >   'username' => array(
> >      'rule' => array('minLenght', 1),
> >      'required' => true,
> >      'allowEmpty' => false,
> >      'message' => 'Please enter a user name'
> >   ),
> >   'password' => array(
> >      'rule' => array('minLenght', 1),
> >      'required' => true,
> >      'allowEmpty' => false,
> >      'message' => 'Please enter a password'
> >   ),
>
> > );
> > }
> > ?>
> > In the users_controller.php
> >  > class UsersController extends AppController {
> >   var $name = 'Users';
> >   var $components = array('Auth');
> >   function register(){
> >   if (!empty($this->data)) {
> >      if(isset($this->data['User']['password2']))
> >         $this->data['User']['password2hashed'] = $this->
> >             Auth->password($this->data['User']['password2']);
> >      $this->User->create();
> >      if ($this->User->save($this->data)) {
> >         $this->Session->setFlash('Congratulations! You have signed
> > up!');
> >       } else {
> >         $this->Session->setFlash('There was an error signing up.
> > Please, try again.');
> >         $this->data = null;
> >      }
> >   }
> > }
> >   function login() {}
> >   function logout() {
> >      $this->Session->setFlash('Logout');
> >      $this->redirect($this->Auth->logout());
> >   }
> > }
> > ?>
> > And in the register.ctp file
> > for error message display
> >  >   // validation error display
> >   if($form->isFieldError('User.name')) e($form->error
> >         ('User.name', null, array('class' => 'failure')));
> >   else if($form->isFieldError('User.telephone')) e($form->error
> >         ('User.telephone', null, array('class' => 'failure')));
> >   else if($form->isFieldError('User.email')) e($form->error
> >         ('User.email', null, array('class' => 'failure')));
> >   else if($form->isFieldError('User.username')) e($form->error
> >         ('User.username', null, array('class' => 'failure')));
> > ?>
>
> > n this is my form
> > create('User', array('action' => 'register')));?>
> >  > class="form_text">
>
> >    
>
> >    
>
> >            Firstname 
> >            text('name', array('class'=>
> > 'fullwidth'))); ?>
> >    
> >    
> >            Lastname 
> >             text('surname', array('class' =>
> > 'fullwidth'))); ?>
> >    
> >    
> >            Contact Number 
> >             text('telephone', array('class' 
> > =>
> > 'fullwidth'))); ?>
> >    
> >    
> >            Fax 
> >             text('fax', array('class' =>
> > 'fullwidth'))); ?>
> >    
> >    
> >            Email 
> >             text('email', array('class' =>
> > 'fullwidth'))); ?>
> >    
> >    
> >            Postal Address 
> >             text('address1', array('class' =>
> > 'fullwidth'))); ?>
> >    
> >    
> >            
> >             text('address2', array('class' 
> > =>
> > 'fullwidth'))); ?>
> >    
> >    
> >            
> >             text('address3', array('class' =>
> > 'fullwidth'))); ?>
> >    
> >    
> >            
> >             text('postal_code', array('class' =>
> > 'fullwidth'))); ?>
> >    
> >    
> >            Username 
> >             text('username', array('class' 
> > =>
> > 'fullwidth'))); ?>
> >    
> >    
> >            Password 
> >             password('password', 
> > array('class'
> > => 'fullwidth'))); ?>
> >    
> >    
> >            Confirm Password 
> >             pa

Re: Implementing uploadify - File upload issue - param definitions issue

2010-04-09 Thread Sam Sherlock
I saw Fonzie was making progress with uploadify (having a discussion with
himself on this list as I recall - but productive 1)

he documented his progress on uploadify forum - I also tried his findings to
partially good results - better than swfupload anyway

here is the link
http://www.uploadify.com/forum/viewtopic.php?f=7&t=5017&p=9334&hilit=cakephp#p9334


I managed to get files uploading (multiple files) but not able to
insert/update to db - and it logged me out after too

I was using cake 1.3 & latest uploadify too


- S



On 9 April 2010 08:47, luke BAKING barker  wrote:

> any luck with this? I would like to try uploadify but it seems there
> are only broken reports with cake in the google group? Anybody used it
> successfully out there?
>
> regards
>
> Luke
>
> On Mar 21, 10:41 pm, abocanegra  wrote:
> > Correction - However, problems still not fixed
> >
> >  upload function had a typo, fixed it but still not
> > uploading file
> > function upload()
> > {
> >  if (isset($this->params['form']['Filedata']))
> > {
> > //Derived from theuploadify.php file - does not work
> > $tempFile = $this->params['form']['Filedata']['name'];
> > $targetPath = 'http://www.whatartist.com/uploads/temp';
> > $targetFile =  str_replace('//','/',$targetPath) .
> $this->params['form']['Filedata']['name'];
> >
> > move_uploaded_file($tempFile,$targetFile);
> >
> > $image_path = $this->params['form']['Filedata']['name'];
> >
> > if(isset($image_path))
> > {
> >
> $this->Photo->saveField('image',$image_path);
> > //Put success message and
> redirect here
> > }else{
> > //Put error message here
> > }
> > }
> > }
> >
> > Also, I beleive the multiple posting - beyond 2 entries - was a
> > session issue. I deleted all sessions in the phptmpdir and it fixed
> > that issue.
> > I still cannot upload the file though.
> >
> > On Mar 20, 9:40 pm, abocanegra  wrote:
> >
> >
> >
> > > Alright, ahead of time thanks for any help on this. I have been
> > > researching for far longer than I care to admit. I am attempting to
> > > getuploadify2.1 to work with cakePHP 1.3. I have read up a great
> > > deal on other formats as well, such as swfupload.
> >
> > > Controller name = photos_controller.php
> > >   relevant functions = upload & addmult
> > > Model Name = photo.php
> > > views= addmult.ctp (upload.ctp is just the function being called from
> > > addmult)
> >
> > > Sucesses - I have been able to get the browse and upload working (on
> > > the surface). It appears to handle a multi-upload, or at least goes
> > > through the paces. Also I am able to trigger the upload function from
> > > the controller and add either the name using $this->params['form']
> > > ['Filedata']['name'].
> >
> > > Problems -
> > >  I cannot get the file uploaded to my uploads/temp directory (it is
> > > 777 and works well with my single image upload script). I have tried
> > > every variation including absolute paths to get to it
> > > .
> > > There does not seem to be any error messages, I have tried adding a
> > > few from the various forums, none have done anything.
> >
> > > When I trigger the multiple uploads it goes through the paces, but
> > > only adds one entry into the database.
> > > Also It appears the database tends to only accept 2 entries, though I
> > > haven't thoroughly tested that problem.
> >
> > > Goal -
> > > I am hoping to implement this function so that I can utilize it with
> > > image.php which i have altered to create the files in the manner I
> > > need. To do this I will need to be able to send the file to image.php
> > > for scale changes, multifolder organization and name changes. After
> > > which it will redirect to a page to add the additional info (title,
> > > client, etc) needed.
> >
> > > Any advice on any of the issues would be appreciated.
> >
> > > Code Snippets:
> >
> > > Controller:
> > > #
> > > class PhotosController extends AppController {
> >
> > > var $name = 'Photos';
> > > var $components = array("Image");
> > > var $helpers = array('Html', 'Javascript', 'Form');
> >
> > > function beforeFilter() {
> > > if ($this->action == 'upload') {
> > > $this->Session->id($this->params['pass'][0]);
> > > $this->Session->start();
> > > }
> > > parent::beforeFilter();
> > > }
> >
> > > function upload()
> > > {
> > >  if (isset($this->params['form']['Filedata']))
> > > {
> > > //Derived from theuploadify.php file - does not work
> > > //$tempFile = $this->params['form']

Re: Implementing uploadify - File upload issue - param definitions issue

2010-04-09 Thread luke BAKING barker
any luck with this? I would like to try uploadify but it seems there
are only broken reports with cake in the google group? Anybody used it
successfully out there?

regards

Luke

On Mar 21, 10:41 pm, abocanegra  wrote:
> Correction - However, problems still not fixed
>
>  upload function had a typo, fixed it but still not
> uploading file
>         function upload()
>         {
>          if (isset($this->params['form']['Filedata']))
>                 {
>         //Derived from theuploadify.php file - does not work
>         $tempFile = $this->params['form']['Filedata']['name'];
>                 $targetPath = 'http://www.whatartist.com/uploads/temp';
>                 $targetFile =  str_replace('//','/',$targetPath) . 
> $this->params['form']['Filedata']['name'];
>
>                 move_uploaded_file($tempFile,$targetFile);
>
>                 $image_path = $this->params['form']['Filedata']['name'];
>
>                                 if(isset($image_path))
>                                 {
>                                         
> $this->Photo->saveField('image',$image_path);
>                                         //Put success message and redirect 
> here
>                                 }else{
>                                         //Put error message here
>                                 }
>                 }
>         }
>
> Also, I beleive the multiple posting - beyond 2 entries - was a
> session issue. I deleted all sessions in the phptmpdir and it fixed
> that issue.
> I still cannot upload the file though.
>
> On Mar 20, 9:40 pm, abocanegra  wrote:
>
>
>
> > Alright, ahead of time thanks for any help on this. I have been
> > researching for far longer than I care to admit. I am attempting to
> > getuploadify2.1 to work with cakePHP 1.3. I have read up a great
> > deal on other formats as well, such as swfupload.
>
> > Controller name = photos_controller.php
> >           relevant functions = upload & addmult
> > Model Name = photo.php
> > views= addmult.ctp (upload.ctp is just the function being called from
> > addmult)
>
> > Sucesses - I have been able to get the browse and upload working (on
> > the surface). It appears to handle a multi-upload, or at least goes
> > through the paces. Also I am able to trigger the upload function from
> > the controller and add either the name using $this->params['form']
> > ['Filedata']['name'].
>
> > Problems -
> >  I cannot get the file uploaded to my uploads/temp directory (it is
> > 777 and works well with my single image upload script). I have tried
> > every variation including absolute paths to get to it
> > .
> > There does not seem to be any error messages, I have tried adding a
> > few from the various forums, none have done anything.
>
> > When I trigger the multiple uploads it goes through the paces, but
> > only adds one entry into the database.
> > Also It appears the database tends to only accept 2 entries, though I
> > haven't thoroughly tested that problem.
>
> > Goal -
> > I am hoping to implement this function so that I can utilize it with
> > image.php which i have altered to create the files in the manner I
> > need. To do this I will need to be able to send the file to image.php
> > for scale changes, multifolder organization and name changes. After
> > which it will redirect to a page to add the additional info (title,
> > client, etc) needed.
>
> > Any advice on any of the issues would be appreciated.
>
> > Code Snippets:
>
> > Controller:
> > #
> > class PhotosController extends AppController {
>
> >         var $name = 'Photos';
> >         var $components = array("Image");
> >         var $helpers = array('Html', 'Javascript', 'Form');
>
> >         function beforeFilter() {
> >         if ($this->action == 'upload') {
> >             $this->Session->id($this->params['pass'][0]);
> >             $this->Session->start();
> >         }
> >         parent::beforeFilter();
> >     }
>
> >         function upload()
> >         {
> >          if (isset($this->params['form']['Filedata']))
> >                 {
> >         //Derived from theuploadify.php file - does not work
> >         //$tempFile = $this->params['form']['Filedata']['tmp_name'];
> >         //      $targetPath = 'http://www.whatartist.coms/uploads/temp';
> >         //      $targetFile =  str_replace('//','/',$targetPath) . 
> > $this->params['form']['Filedata']['name'];
>
> >                 //move_uploaded_file($tempFile,$targetFile);
>
> >                 $image_path = $this->params['form']['Filedata']['name'];
>
> >                                 if(isset($image_path))
> >                                 {
> >                                         
> > $this->Photo->saveField('image',$image_path);
> >                                         //Put success message and redirect 
> > here
> >                                 }else{
> >                                         //Put error message