Re: View question

2007-08-09 Thread Geoff Ford

Suppress the error message generated by input() with

$form->input('Project.proj_start',
array('div'=>false,'id'=>'ProjectProjStart','label'=>false,'size'=>15,'type'=>'text',
'error' => false));

Then add the error after the image with $form-
>error("Project.proj_start");

Geoff
--
http://lemoncake.wordpress.com

On Aug 10, 1:01 pm, pbland <[EMAIL PROTECTED]> wrote:
> Is anyone displaying an image or some text after an input field in a
> view? And what happens if there's an error for this input field?


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



Re: Default Controller View

2007-08-09 Thread Geoff Ford

Conventionally no - index is the default action. Rename your default
actions to index.

Technically - you could fiddle with $this->params['action'] in
AppController::beforeFilter() but this is messy, and feels like a hack

Geoff
--
http://lemoncake.wordpress.com

On Aug 10, 1:30 pm, 1Marc <[EMAIL PROTECTED]> wrote:
> In the routes, can you setup a default action for your app?
>
> For example:
>
> /my-url-here ... runs the default controller view  (houses view being
> the default so it would act like ... houses/view/my-url-here)
>
> /properties/view/my-url-here ... would still run the properties
> controller view


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



Re: Default Controller Action

2007-08-09 Thread Geoff Ford

I tried...$Route->connect('/*', array('conroller' => 'homes', 'action'
=> 'display', 'view'));  But that doesn't work.

Is this a typo : sould be array('controller'

Geoff
--
http://lemoncake.wordpress.com

On Aug 10, 1:38 pm, 1Marc <[EMAIL PROTECTED]> wrote:
> Can you setup a default controller action in the routes?
>
> For instance...
> /my-url-here would by default go to homes/view/my-url-here.   It
> doesn't find an associated controller so it just defaults to the Homes
> Controller View.
>
> But if it finds a controller it does what is normal:
> /properties/view/my-url-here would still go to the properties view.
>
> I tried...$Route->connect('/*', array('conroller' => 'homes', 'action'
> => 'display', 'view'));  But that doesn't work.
>
> Can anyone help?


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



Re: CAKE_SESSION_STRING - what it's behavior?

2007-08-09 Thread Geoff Ford

It is a random string that should be (near enough to) unique for your
application.  It is used to salt hashes, seed rnd() and the like to
improve security.

Geoff
--
http://lemoncake.wordpress.com

On Aug 10, 2:39 pm, phpjoy <[EMAIL PROTECTED]> wrote:
> After messing around a bit with the Auth component, I got to
> "CAKE_SESSION_STRING" for security usages.
>
> I wonder which value it should hold.
> I just put in random chars? is it an md5 value? other type of hashed
> value? Should it have a number of chars?


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



Re: Multiple field values in select box?

2007-08-09 Thread Geoff Ford
function getListData($data){
   $data = $this->Model->query("SELECT Model1.field1 as `Model1`,`field1` ,
Model1.field2 as `Model1`,`field2` , Model2.field1 as `Model2`,`field1`
FROM `bars` as Model1, `barbars` as Model2, WHERE `Model2`.`barbar_id` =
`Model1`.`id`");
 }

   $listdata = array();
   foreach ($data as $item) {
   $listdata[$data['Model1']['field1'] = $data['Model1']['field1'] . '-'
. $data['Model2']['field1'];
   }

 return $listdata;
}

and later, in the 'add' function:

$this->set('listdata', $this->Model->getListData());

In the view:

echo $html->selectTag("Player/team", $teamsportlist);

Not tested but should work.

Geoff
--
http://lemoncake.wordpress.com

On 8/10/07, Beertigger <[EMAIL PROTECTED]> wrote:
>
>
> Still trying to concat data from two models into a select list in a
> third.
>
> Thanks for the help thus far, Geoff. Taking your advice, and some
> input from IRC, after much trying, I'm at:
>
> In controller:
>
>  function getListData($data){
> $data = $this->Model->query("SELECT CONCAT(bar, ' - ', barbar) AS
> foobar
> FROM `bars` , `barbars` WHERE `bar`.`barbar_id` = `barbar`.`id`");
> return $data;
>   }
>
> $listdata = array();
> foreach ($data as $item) {
> $listdata[$data]['Model']['foo'] = $data['Model2']['bar'] .
> '-' .
> $data['Model3']['barbar'];
> }
>
> and later, in the 'add' function:
>
> $this->set('listdata', $this->Model->getListData());
>
> In the view:
>
> echo $html->selectTag("Player/team", $teamsportlist, $selectedItems);
>
> None of this seems to be working, no matter how I jigger things about.
> Aargh!
>
> --Beertigger
>
>
>
> On Aug 8, 6:59 pm, "Geoff Ford" <[EMAIL PROTECTED]> wrote:
> > All the code I outlined would be in the controller.  You could put the
> loop
> > in the getListData() function in the model if you like to keep the
> > controller cleaner.  The controller would then just be
> > $this->set('listdata', $this->Model->getListData());
> >
> > Geoff
> >
> > On 8/9/07, Beertigger <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> > > Somehow, this seems on the right track, but I couldn't get things to
> > > work. Played around with a lot of different variations, but
> > > *something* is not quite kosher, yet.
> >
> > > Thanks much for the guidance thus far.
> >
> > > Should the entire
> >
> > > $data = $this->Model->getListData(); // a function in your model that
> > > does
> > > the custom query to pull the three fields you wnat to use
> > > $mylist = array();
> > > foreach ($data as $item){
> > >   $mylist[$data['Model']['field1]] = $data['Model']['field2] . '-' .
> > > $data['Model']['field3];
> >
> > > }
> >
> > > be in the Model?
> >
> > > And the this->set in the controller?
> >
> > > Sorry for my blatant stupidity. Wrapping what I know of php up with
> > > Cake is proving to be troublesome, at best. The masterbake script
> > > provides such a sweet basic framework that a bit of pain getting
> > > things 'just right' is worth it, but this one thing is really killing
> > > me... ; )
> >
> > > On Aug 8, 3:48 pm, "Geoff Ford" <[EMAIL PROTECTED]> wrote:
> > > > OK so use HtmlHelper::select() or selectTag() - I can't remember of
> the
> > > top
> > > > of my head which one it is.  My solutions is still the same - creat
> the
> > > > array that you want to display in the listbox manually.
> >
> > > > Again not sure of the exact array format but something like
> >
> > > > $data = $this->Model->getListData(); // a function in your model
> that
> > > does
> > > > the custom query to pull the three fields you wnat to use
> > > > $mylist = array();
> > > > foreach ($data as $item){
> > > >   $mylist[$data['Model']['field1]] = $data['Model']['field2] . '-' .
> > > > $data['Model']['field3];
> >
> > > > }
> >
> > > > $this->set("mylist", $mylist);
> >
> > > > Then in your view something like (again double check the format)
> >
> > > > $html->select("SelectName", $mylist, $selectedItems);
> >
> > > > I hope this helps :)
> >
> > > > Geoff
> >
> > --http://lemoncake.wordpress.com
>
>
> >
>


-- 
http://lemoncake.wordpress.com

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



Re: Auth1.2 component not showing methods.

2007-08-09 Thread Dr. Tarique Sani

On 8/10/07, phpjoy <[EMAIL PROTECTED]> wrote:
> $this->Auth->userModel = 'AdminUser';
> $this->Auth->loginAction='/' .CAKE_ADMIN .'/login/';


What is the value for $this->Auth->authorize

IOW - what are you using to authorize your actions?

Possible values are actions, model, controller


Tarique

-- 
=
Cheesecake-Photoblog: http://cheesecake-photoblog.org
PHP for E-Biz: http://sanisoft.com
=

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



Auth1.2 component not showing methods.

2007-08-09 Thread phpjoy

I setup the Auth component, and it's working great for the validation
stage.
If no session is found, it redirects to /admin/login/ just as it
should.

$this->Auth->userModel = 'AdminUser';
$this->Auth->loginAction='/' .CAKE_ADMIN .'/login/';

After I get validated (Goes to Users controller and Login method) ->
It redirects to the last page (as it should).

Then, after the beforeFilter it sends me BACK to the Auth component ->
Even though it is validated and there's a session!

Here's a part of my session [trimmed]:
array(4) {
  ["AdminUser"]=>
  array(2) {
["id"]=>
string(1) "1"
["username"]=>
string(5) "yossi"
  }
  ["Auth"]=>
  array(1) {
["redirect"]=>
string(13) "admin/images/"
  }
}


How come the controller keeps redirecting me to the Auth component? Am
I doing something wrong/missing something?
* Using lastest Cake 1.2 Release

thanks,
yossi


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



Default Controller View

2007-08-09 Thread 1Marc

In the routes, can you setup a default action for your app?

For example:

/my-url-here ... runs the default controller view  (houses view being
the default so it would act like ... houses/view/my-url-here)

/properties/view/my-url-here ... would still run the properties
controller view


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



Default Controller Action

2007-08-09 Thread 1Marc

Can you setup a default controller action in the routes?

For instance...
/my-url-here would by default go to homes/view/my-url-here.   It
doesn't find an associated controller so it just defaults to the Homes
Controller View.

But if it finds a controller it does what is normal:
/properties/view/my-url-here would still go to the properties view.

I tried...$Route->connect('/*', array('conroller' => 'homes', 'action'
=> 'display', 'view'));  But that doesn't work.

Can anyone help?


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



21 Things You Should Know About CakePHP

2007-08-09 Thread [EMAIL PROTECTED]

Hey,

I just joined the group so I thought I should share with you a blog
post that I found very helpful.

http://cake-php.blogspot.com/2006/09/21-things-you-must-know-about-cakephp.html

Hope you guys like it,
Matt


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



CAKE_SESSION_STRING - what it's behavior?

2007-08-09 Thread phpjoy

After messing around a bit with the Auth component, I got to
"CAKE_SESSION_STRING" for security usages.

I wonder which value it should hold.
I just put in random chars? is it an md5 value? other type of hashed
value? Should it have a number of chars?


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



Re: Multiple field values in select box?

2007-08-09 Thread Beertigger

Still trying to concat data from two models into a select list in a
third.

Thanks for the help thus far, Geoff. Taking your advice, and some
input from IRC, after much trying, I'm at:

In controller:

 function getListData($data){
$data = $this->Model->query("SELECT CONCAT(bar, ' - ', barbar) AS
foobar
FROM `bars` , `barbars` WHERE `bar`.`barbar_id` = `barbar`.`id`");
return $data;
  }

$listdata = array();
foreach ($data as $item) {
$listdata[$data]['Model']['foo'] = $data['Model2']['bar'] .
'-' .
$data['Model3']['barbar'];
}

and later, in the 'add' function:

$this->set('listdata', $this->Model->getListData());

In the view:

echo $html->selectTag("Player/team", $teamsportlist, $selectedItems);

None of this seems to be working, no matter how I jigger things about.
Aargh!

--Beertigger



On Aug 8, 6:59 pm, "Geoff Ford" <[EMAIL PROTECTED]> wrote:
> All the code I outlined would be in the controller.  You could put the loop
> in the getListData() function in the model if you like to keep the
> controller cleaner.  The controller would then just be
> $this->set('listdata', $this->Model->getListData());
>
> Geoff
>
> On 8/9/07, Beertigger <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Somehow, this seems on the right track, but I couldn't get things to
> > work. Played around with a lot of different variations, but
> > *something* is not quite kosher, yet.
>
> > Thanks much for the guidance thus far.
>
> > Should the entire
>
> > $data = $this->Model->getListData(); // a function in your model that
> > does
> > the custom query to pull the three fields you wnat to use
> > $mylist = array();
> > foreach ($data as $item){
> >   $mylist[$data['Model']['field1]] = $data['Model']['field2] . '-' .
> > $data['Model']['field3];
>
> > }
>
> > be in the Model?
>
> > And the this->set in the controller?
>
> > Sorry for my blatant stupidity. Wrapping what I know of php up with
> > Cake is proving to be troublesome, at best. The masterbake script
> > provides such a sweet basic framework that a bit of pain getting
> > things 'just right' is worth it, but this one thing is really killing
> > me... ; )
>
> > On Aug 8, 3:48 pm, "Geoff Ford" <[EMAIL PROTECTED]> wrote:
> > > OK so use HtmlHelper::select() or selectTag() - I can't remember of the
> > top
> > > of my head which one it is.  My solutions is still the same - creat the
> > > array that you want to display in the listbox manually.
>
> > > Again not sure of the exact array format but something like
>
> > > $data = $this->Model->getListData(); // a function in your model that
> > does
> > > the custom query to pull the three fields you wnat to use
> > > $mylist = array();
> > > foreach ($data as $item){
> > >   $mylist[$data['Model']['field1]] = $data['Model']['field2] . '-' .
> > > $data['Model']['field3];
>
> > > }
>
> > > $this->set("mylist", $mylist);
>
> > > Then in your view something like (again double check the format)
>
> > > $html->select("SelectName", $mylist, $selectedItems);
>
> > > I hope this helps :)
>
> > > Geoff
>
> --http://lemoncake.wordpress.com


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



Re: View question

2007-08-09 Thread pbland

Is anyone displaying an image or some text after an input field in a
view? And what happens if there's an error for this input field?


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



Filtering using manually entered values

2007-08-09 Thread mussond

I'd like to filter my view based on the input from the user.  The
thought is the user will enter a date range using input text boxes.
These values would be passed to the controller and an query($sql)
would return values I'll display in a table.

I can get the query and the table to work no problem but I can't find
a way to get the date values from the view to the controller and thus
be used in the query.

I've got two text inputs that contain the MIN and MAX date values from
the database.

start:

end:


Also the user will filter the query by selecting a user id from a
select box.  In my controller I set this value to the variable
$id_user, which is then used in the query():

$id_user = $this->data['ComUser']['id'];

$this->set('data', $this->DataPoint->query("SELECT w.com_user_id,
count(p.id) as c FROM data_points p join des_walks w WHERE
p.des_walk_id = w.id AND w.com_user_id = '$id_user' AND p.date >=
'2006-12-09' AND p.date <= '2006-12-10' GROUP BY w.com_user_id"));

So my question is how can I replace the '2006-12-09' and '2006-12-10'
with whatever is written in the text boxes?


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



Re: Synchronization?

2007-08-09 Thread Langdon Stevenson

Woops.  That should have been:

If you search the group for "getLastInsertId" you should find the 
details (expressed much better than I have here)

Regards,
Langdon

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



Re: Synchronization?

2007-08-09 Thread Langdon Stevenson

Hi Soulcatcher

This issue has been covered a number of times in this group, but can be 
hard to find.  Short answer is that it is quite safe.

Retrieving the last inserted ID is done in the context of your current 
MySQL connection.  So it doesn't matter if other people are saving at 
the same time.

My understanding is that this is handled by PHP and MySQL.

If you search the group for "getLastInsterId" you should find the 
details (expressed much better than I have here).

Regards,
Langdon


Soulcatcher wrote:
> Hi, i'm new to Cake and i have a question about synchro issue. When
> you have related tables (say table B has a foreign key pointing to
> table A) and you want to save 2 related tuples, it's written in Manual
> that you have to
> 
> 1) Save tuple in table A
> 2) Get last id from A
> 3) Save tuple in table B using that last id wich we got in step2 as a
> foreign key.
> 
> Now, my question is - what happens if in the time between i save tuple
> to A and get last id from A there were, like, 1000 new tuples inserted
> to A? For example, i save my furst tuple in A, it has id=1. Then i try
> to get this id from A, but by the time i execute this request, someone
> already inserted 2 tuples into A, so i get last id equal to 3, wich
> isnt what i want (i want id=1).
> 
> Is this a problem? Maybe you have some links describing this already,
> i couldnt find it.

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



Synchronization?

2007-08-09 Thread Soulcatcher

Hi, i'm new to Cake and i have a question about synchro issue. When
you have related tables (say table B has a foreign key pointing to
table A) and you want to save 2 related tuples, it's written in Manual
that you have to

1) Save tuple in table A
2) Get last id from A
3) Save tuple in table B using that last id wich we got in step2 as a
foreign key.

Now, my question is - what happens if in the time between i save tuple
to A and get last id from A there were, like, 1000 new tuples inserted
to A? For example, i save my furst tuple in A, it has id=1. Then i try
to get this id from A, but by the time i execute this request, someone
already inserted 2 tuples into A, so i get last id equal to 3, wich
isnt what i want (i want id=1).

Is this a problem? Maybe you have some links describing this already,
i couldnt find it.


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



Re: Session vars in the Model

2007-08-09 Thread Geoff Ford

Have you tried : $this->Category->find(array('Product.project_id'=>
$this->Session->read('project_id')));

Geoff
--
http://lemoncake.wordpress.com

On Aug 10, 8:48 am, sarimarton <[EMAIL PROTECTED]> wrote:
> But you do have association between projects and products. You have
> the proper associations.
> Your problem is that you need runtime conditions. I had the same
> problem, ie. needed a condition which
> is cannot be described with the association scheme.
>
> You can't put runtime calculations (in this case project id depends on
> a session value)
> in the model's description file. (models/product.php,
> $belongsTo=>Project=>conditions=>"Project.id = ?")
>
> You could put the condition in the binding in AppModel's beforeFind():
>
> function beforeFind(&$queryData) {
>   if ($this->name == 'Project') $queryData['conditions'][] =
> 'Project.id = '.Session::read('projectid');
>   return $queryData;
>
> }
>
> But it's also is not a favourable way of it, because with beforeFind()
> you can't controll non-primary queries.
> So you would have to prepare for all the related finds:
>   if ($this->name == 'Product') $queryData['conditions'][] =
> 'Product.project_id = '.Session::read('projectid');
>   ...
>
> This works, however you simply can't list every case because of
> recursion. So if you query Categories it will
> include all projects.
>
> My next try was that somehow I need to set the association array
> member of the Product CLASS (not an instantiated
> object with $this->Product...) in my AppController's beforeFilter().
> This would look like this:
>
> Product::belongsTo['Project']['conditions'] = 'Project.id =
> '.Session::etc;
>
> But unfortunately the association members of the models are declared
> as 'var', not as 'static public', so you can't overwrite them.
>
> But fortunately :), there is an absolutely DRY solution for reaching
> the class and its offals:
>
> $cr =& ClassRegistry::getInstance();
> $cr->__objects['product']->belongsTo['Project']['conditions'] =
> 'Project.id = etc.';
>
> This way, you can set every associations and its conditions and other
> data runtime, just
> like it would be in the model file. So you can query any model, even a
> distant binded one
> (eg. Category), you will get your runtime created condition in the
> related queries. You can
> check it with DEBUG level 3.
>
> Cheers,
> Marci
>
> On Jul 24, 9:02 am, lgarcia <[EMAIL PROTECTED]> wrote:
>
> > But if i have not any association between categories and projects, how
> > i'll achieve my goal?
>
> > On 24 jul, 00:43, Grant Cox <[EMAIL PROTECTED]> wrote:
>
> > > You should temporarily bind the association with the required
> > > project_id, in the controller action.  There are a large number of
> > > ways of binding an association - using the inbuilt bindModel and
> > > unbindModel, the "useModel" function available on the bakery, or
> > > Felix's Containable behaviour (I haven't used this yet, but it looks
> >
> the most advanced)http://www.thinkingphp.org/2007/06/14/containable-20-beta/


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



Re: Session vars in the Model

2007-08-09 Thread sarimarton

But you do have association between projects and products. You have
the proper associations.
Your problem is that you need runtime conditions. I had the same
problem, ie. needed a condition which
is cannot be described with the association scheme.

You can't put runtime calculations (in this case project id depends on
a session value)
in the model's description file. (models/product.php,
$belongsTo=>Project=>conditions=>"Project.id = ?")

You could put the condition in the binding in AppModel's beforeFind():

function beforeFind(&$queryData) {
  if ($this->name == 'Project') $queryData['conditions'][] =
'Project.id = '.Session::read('projectid');
  return $queryData;
}

But it's also is not a favourable way of it, because with beforeFind()
you can't controll non-primary queries.
So you would have to prepare for all the related finds:
  if ($this->name == 'Product') $queryData['conditions'][] =
'Product.project_id = '.Session::read('projectid');
  ...

This works, however you simply can't list every case because of
recursion. So if you query Categories it will
include all projects.

My next try was that somehow I need to set the association array
member of the Product CLASS (not an instantiated
object with $this->Product...) in my AppController's beforeFilter().
This would look like this:

Product::belongsTo['Project']['conditions'] = 'Project.id =
'.Session::etc;

But unfortunately the association members of the models are declared
as 'var', not as 'static public', so you can't overwrite them.

But fortunately :), there is an absolutely DRY solution for reaching
the class and its offals:

$cr =& ClassRegistry::getInstance();
$cr->__objects['product']->belongsTo['Project']['conditions'] =
'Project.id = etc.';


This way, you can set every associations and its conditions and other
data runtime, just
like it would be in the model file. So you can query any model, even a
distant binded one
(eg. Category), you will get your runtime created condition in the
related queries. You can
check it with DEBUG level 3.

Cheers,
Marci


On Jul 24, 9:02 am, lgarcia <[EMAIL PROTECTED]> wrote:
> But if i have not any association between categories and projects, how
> i'll achieve my goal?
>
> On 24 jul, 00:43, Grant Cox <[EMAIL PROTECTED]> wrote:
>
> > You should temporarily bind the association with the required
> > project_id, in the controller action.  There are a large number of
> > ways of binding an association - using the inbuilt bindModel and
> > unbindModel, the "useModel" function available on the bakery, or
> > Felix's Containable behaviour (I haven't used this yet, but it looks
> > the most advanced)http://www.thinkingphp.org/2007/06/14/containable-20-beta/


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



Re: Session vars in the Model

2007-08-09 Thread sarimarton

But you do have association between projects and products. You have
the proper associations.
Your problem is that you need runtime conditions. I had the same
problem, ie. needed a condition which
is cannot be described with the association scheme.

You can't put runtime calculations (in this case project id depends on
a session value)
in the model's description file. (models/product.php,
$belongsTo=>Project=>conditions=>"Project.id = ?")

You could put the condition in the binding in AppModel's beforeFind():

function beforeFind(&$queryData) {
  if ($this->name == 'Project') $queryData['conditions'][] =
'Project.id = '.Session::read('projectid');
  return $queryData;
}

But it's also is not a favourable way of it, because with beforeFind()
you can't controll non-primary queries.
So you would have to prepare for all the related finds:
  if ($this->name == 'Product') $queryData['conditions'][] =
'Product.project_id = '.Session::read('projectid');
  ...

This works, however you simply can't list every case because of
recursion. So if you query Categories it will
include all projects.

My next try was that somehow I need to set the association array
member of the Product CLASS (not an instantiated
object with $this->Product...) in my AppController's beforeFilter().
This would look like this:

Product::belongsTo['Project']['conditions'] = 'Project.id =
'.Session::etc;

But unfortunately the association members of the models are declared
as 'var', not as 'static public', so you can't overwrite them.

But fortunately :), there is an absolutely DRY solution for reaching
the class and its offals:

$cr =& ClassRegistry::getInstance();
$cr->__objects['product']->belongsTo['Project']['conditions'] =
'Project.id = etc.';


This way, you can set every associations and its conditions and other
data runtime, just
like it would be in the model file. So you can query any model, even a
distant binded one
(eg. Category), you will get your runtime created condition in the
related queries. You can
check it with DEBUG level 3.

Cheers,
Marci


On Jul 24, 9:02 am, lgarcia <[EMAIL PROTECTED]> wrote:
> But if i have not any association between categories and projects, how
> i'll achieve my goal?
>
> On 24 jul, 00:43, Grant Cox <[EMAIL PROTECTED]> wrote:
>
> > You should temporarily bind the association with the required
> > project_id, in the controller action.  There are a large number of
> > ways of binding an association - using the inbuilt bindModel and
> > unbindModel, the "useModel" function available on the bakery, or
> > Felix's Containable behaviour (I haven't used this yet, but it looks
> > the most advanced)http://www.thinkingphp.org/2007/06/14/containable-20-beta/


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



Re: Loop with select and insert not working as expected

2007-08-09 Thread Pablo Viojo

Read:


http://api.cakephp.org/1.2/class_model.html#029fcc94396edba60df5648e7086e01d

Or:

http://api.cakephp.org/class_model.html#029fcc94396edba60df5648e7086e01d

(Don't know which version are you using)

Regards,

Pablo

On 8/9/07, kionae <[EMAIL PROTECTED]> wrote:
>
> Have you tried $household_id = $this->Household->field("id",
> array('id' => $match_userid)); instead?  That seems to work for me...
>
>
>
> On Aug 9, 1:34 pm, phalvrson <[EMAIL PROTECTED]> wrote:
> > True - I changed to use the buit-in functions - ie save()  but I still
> > have the same problem.  The problem is that the line "$household_id =
> > $this->Household->field("id", $match_userid);" doesn't always issue
> > it's underlying SQL SELECT `Household`.`id` FROM `households` AS
> > `Household` WHERE `Household`.`userid` = '115603'  statement - it
> > seems to assume that id is already set correctly or something  Can
> > you please explain this behavior?  I've tried inserting a 
> > "$this->Household->create()"  prior to that statement to re-initialize
> >
> > things, but that seems to have no effect on this behavior
> >
> > Latest controller code:
> >
> > function process_csv_file()
> > {
> > $this->pageTitle = 'Process CSV File';
> > $checkFileFields = Array ( "id", "Item", "Qty", 
> > "Household", "HHID",
> > "FirstName", "LastName", "UserID", "Processed", "SchoolLocation",
> > "HouseholdEmail", "Address1", "Address2", "City", "State", "Zip",
> > "REFERENCE#2" );
> > if (!empty($this->params['form'])) {
> > $file_handle = fopen($this->params['form']['File']
> > ['tmp_name'],"r");
> > $label_fields = fgetcsv ($file_handle);
> > $last_household_id = null;
> > if ($checkFileFields == $label_fields) {
> > $last_processed_student = null;
> > $current_order_id = null;
> > while (!feof($file_handle)) {
> > $csv_fields = fgetcsv 
> > ($file_handle);
> > /* Remember who we are processing - 
> > one order per student */
> > $first_name = $csv_fields[5];
> > $last_name = $csv_fields[6];
> > $check_name = $first_name . ' ' . 
> > $last_name;
> > /* Process the households db part. 
> > */
> > $this_userid = $csv_fields[7];
> > $match_userid = "Household.userid = 
> > '" . $this_userid . "'";
> > $household_id = 
> > $this->Household->field("id", $match_userid);
> > if (($household_id) || 
> > ($this->Household->exists())) {
> > /* Nothing to do - already 
> > have household id */
> > } else {
> > 
> > $this->data['Household']['last_name'] = $last_name;
> > 
> > $this->data['Household']['HHID'] = $csv_fields[4];
> > 
> > $this->data['Household']['userid'] = $this_userid;
> > 
> > $this->data['Household']['email'] = $csv_fields[10];
> > 
> > $this->data['Household']['address_1'] = $csv_fields[11];
> > 
> > $this->data['Household']['address_2'] = $csv_fields[12];
> > 
> > $this->data['Household']['city'] = $csv_fields[13];
> > 
> > $this->data['Household']['state'] = $csv_fields[14];
> > 
> > $this->data['Household']['zipcode'] = $csv_fields[15];
> > $this->Household->save( 
> > $this->data);
> > $household_id = 
> > $this->Household->getLastInsertID();
> > }
> > print_r($household_id);
> > print_r($this->Household->id);
> > /* Process the students db part. */
> > $match_student_name = 
> > "Student.first_name = '$first_name' AND
> > Student.last_name = '$last_name' ";
> > $student_id = 
> > $this->Student->field("id", $match_student_name);
> > if (($student_id) || 
> > ($this->Student->exists())) {
> >   

Re: 2 DATES issues

2007-08-09 Thread Pablo Viojo

Try running the generated query (and post it here) and see if it
return any results. I tried it and it works for me

Regards,
Pablo

On 8/9/07, CakeMan <[EMAIL PROTECTED]> wrote:
>
> Thanks Pablo,
>
> Your first one has worked. However second one didn't work.
>
> for second one ( for extarcting current week's event DAY WISE) i am
> using $this->event->findall as the date field is in the event table.
>
> I have tried to put 2nd condition in as
>
> $conditions="Event.eventday>=now() AND
> Event.eventday $this->Event->findAll($conditions);
>
> It is returning an empty Array.
>
> Please help.
>
> Thanks again
>
>
> On Aug 10, 12:39 am, "Pablo Viojo" <[EMAIL PROTECTED]> wrote:
> > Try
> >
> > 1 - 'Event.datefield>=now()'
> >
> > 2 - 'Event.datefield>=now() AND Event.datefield > INTERVAL 1 WEEK)'
> >
> > --
> > Pablo Viojo
> > [EMAIL PROTECTED]://pviojo.net
> >
> > On 8/9/07, CakeMan <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> > > Hello friends,
> >
> > > I am having 2 dates issue while working in cakephp. I have two tables
> > > events_categories and events.
> >
> > > IN one part
> >
> > > I want to show the events according to the event_categories so i have
> > > put this code in event_category model
> >
> > > var $hasMany = array('Event' =>
> > > array('className'=> 'Event',
> > >   'conditions'   => '',
> > >   'order'=> '',
> > >   'dependent'=>  true,
> > >   'foreignKey'   => 'event_category_id'
> > > )
> > >   );
> >
> > > This is working fine. Now what i want is to show only those events
> > > that are in the future i.e. on & after the current date. For that i
> > > using this
> >
> > > var $hasMany = array('Event' =>
> > > array('className'=> 'Event',
> > >   'conditions'   =>
> > > 'Event.datefield>=date("Y-m-d")',
> > >   'order'=> '',
> > >   'dependent'=>  true,
> > >   'foreignKey'   => 'event_category_id'
> > > )
> > >   );
> >
> > > But it is not working .pls see the difference of conditions element of
> > > hasmany.
> >
> > > Pls let me how can i show the events  category wise and only those
> > > events whose yet to come.
> >
> > > My second question is :-
> >
> > > I want to show the events for the current week day wise.
> >
> > > How can solve my above 2 queries.
> >
> > > Pls let me know.
> >
> > > Thanks- Hide quoted text -
> >
> > - Show quoted text -
>
>
> >
>


-- 
Pablo Viojo
[EMAIL PROTECTED]
http://pviojo.net

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



Re: Where's bake2.php?

2007-08-09 Thread Chris Hartjes

On 8/9/07, chewie124 <[EMAIL PROTECTED]> wrote:
>
> I was just looking at Felix's Command line article (http://
> www.thinkingphp.org/2006/10/16/command-line-fun-in-cakephp-12/), where
> bake2.php was mentioned.  I'm working with 1.2.0.5427.  I couldn't
> find bake2.php in there.  I checked the subversion tree, and didn't
> find it there either.  Can anybody clue me in as to what happened to
> it?
>

I'm guessing that it won't be happening as a LOT of work has gone into
bake since Felix posted that article.  bake2.php probably is no longer
needed.

-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

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

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



Where's bake2.php?

2007-08-09 Thread chewie124

I was just looking at Felix's Command line article (http://
www.thinkingphp.org/2006/10/16/command-line-fun-in-cakephp-12/), where
bake2.php was mentioned.  I'm working with 1.2.0.5427.  I couldn't
find bake2.php in there.  I checked the subversion tree, and didn't
find it there either.  Can anybody clue me in as to what happened to
it?

Thanks,
Rich


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



Re: Loop with select and insert not working as expected

2007-08-09 Thread kionae

Have you tried $household_id = $this->Household->field("id",
array('id' => $match_userid)); instead?  That seems to work for me...



On Aug 9, 1:34 pm, phalvrson <[EMAIL PROTECTED]> wrote:
> True - I changed to use the buit-in functions - ie save()  but I still
> have the same problem.  The problem is that the line "$household_id =
> $this->Household->field("id", $match_userid);" doesn't always issue
> it's underlying SQL SELECT `Household`.`id` FROM `households` AS
> `Household` WHERE `Household`.`userid` = '115603'  statement - it
> seems to assume that id is already set correctly or something  Can
> you please explain this behavior?  I've tried inserting a 
> "$this->Household->create()"  prior to that statement to re-initialize
>
> things, but that seems to have no effect on this behavior
>
> Latest controller code:
>
> function process_csv_file()
> {
> $this->pageTitle = 'Process CSV File';
> $checkFileFields = Array ( "id", "Item", "Qty", "Household", 
> "HHID",
> "FirstName", "LastName", "UserID", "Processed", "SchoolLocation",
> "HouseholdEmail", "Address1", "Address2", "City", "State", "Zip",
> "REFERENCE#2" );
> if (!empty($this->params['form'])) {
> $file_handle = fopen($this->params['form']['File']
> ['tmp_name'],"r");
> $label_fields = fgetcsv ($file_handle);
> $last_household_id = null;
> if ($checkFileFields == $label_fields) {
> $last_processed_student = null;
> $current_order_id = null;
> while (!feof($file_handle)) {
> $csv_fields = fgetcsv ($file_handle);
> /* Remember who we are processing - 
> one order per student */
> $first_name = $csv_fields[5];
> $last_name = $csv_fields[6];
> $check_name = $first_name . ' ' . 
> $last_name;
> /* Process the households db part. */
> $this_userid = $csv_fields[7];
> $match_userid = "Household.userid = 
> '" . $this_userid . "'";
> $household_id = 
> $this->Household->field("id", $match_userid);
> if (($household_id) || 
> ($this->Household->exists())) {
> /* Nothing to do - already 
> have household id */
> } else {
> 
> $this->data['Household']['last_name'] = $last_name;
> 
> $this->data['Household']['HHID'] = $csv_fields[4];
> 
> $this->data['Household']['userid'] = $this_userid;
> 
> $this->data['Household']['email'] = $csv_fields[10];
> 
> $this->data['Household']['address_1'] = $csv_fields[11];
> 
> $this->data['Household']['address_2'] = $csv_fields[12];
> 
> $this->data['Household']['city'] = $csv_fields[13];
> 
> $this->data['Household']['state'] = $csv_fields[14];
> 
> $this->data['Household']['zipcode'] = $csv_fields[15];
> $this->Household->save( 
> $this->data);
> $household_id = 
> $this->Household->getLastInsertID();
> }
> print_r($household_id);
> print_r($this->Household->id);
> /* Process the students db part. */
> $match_student_name = 
> "Student.first_name = '$first_name' AND
> Student.last_name = '$last_name' ";
> $student_id = 
> $this->Student->field("id", $match_student_name);
> if (($student_id) || 
> ($this->Student->exists())) {
> /* Nothing to do - already 
> have student id */
> } else {
> 
> $this->data['Student']['first_name'] = $first_name;
> 
> $this->data['Student']['last_name'] = $last_name;
> 
> $this->data['Student']['household_id'] = $household_id;
>  

Re: View caching, nocache tags?

2007-08-09 Thread [EMAIL PROTECTED]

Version 1.1.10.3825 if that helps. The other issue which is
potentially related is expiration. I've set it to "+60 seconds" but
the cached view never seems to expire.

On Aug 9, 2:45 pm, "Christian Primozich" <[EMAIL PROTECTED]> wrote:
> Caching has me a bit perplexed. I haven't dug into the cake caching source
> and I'm hoping to avoid that. I have a simple page set up as a test with a
> couple variables - one cached and the other wrapped in nocache tags. The
> view gets written to the cache directory and the variable wrapped in the
> nocache tags is output as is (i.e. ). However, the cached
> page has no reference to the variable and returns a sensible "undefined
> variable" message. Am I missing something? Should the variable have been
> stuffed into the cached page's data property and referenced from there or
> something? I'll start digging through the source but from the manual, it
> doesn't seem like using the cache is complicated and it's been around since
> an early version so I presume it works as advertised.
>
> Thanks,
> cp


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



Re: Images for my models

2007-08-09 Thread kionae

I would create an Image model, and associate it with a Project (i.e. a
Project hasMany Images, an Image belongsTo a Project, relating the two
based on project id).



On Aug 9, 12:51 pm, murtada <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am not sure how to best go about doing this. I have a model called
> "Project", each of which will have a set of images or pictures
> associated with them.
>
> How would I create the admin side for project? I would have to upload
> multiple images, then store them somewhere, etc.
>
> A brief step-by-step direction would be greatly appreciated.
>
> Murtada


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



What's the view cache story in cake 1.2?

2007-08-09 Thread Kimble

I can't get view caching to work with CakePHP v1.2.0.5427alpha.

DEBUG = 0 and
CHECK_CACHE = true

The cache helper is added to the helpers array.

Has Cake ditched view caching?


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



Using shared ssl with cake

2007-08-09 Thread [EMAIL PROTECTED]

I am trying to use a shared certificate with a cake application.
However, when I point to the directory it cannot be found.  This is
the first time I've tried hooking it up to a cake application and I
would appreciate any help.


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



Cake 1.2 and Cake 1.1 sharing models view and controllers

2007-08-09 Thread admin_AT_loveyourdress.com

If i am using Cake 1.2 in one application (call it App1.2) and Cake
1.1 in another application (App1.1). Can i use bootstrap.php in the
config folder of App1.2 to read models, view and controllers from
App1.1?


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



View caching, nocache tags?

2007-08-09 Thread Christian Primozich
Caching has me a bit perplexed. I haven't dug into the cake caching source
and I'm hoping to avoid that. I have a simple page set up as a test with a
couple variables - one cached and the other wrapped in nocache tags. The
view gets written to the cache directory and the variable wrapped in the
nocache tags is output as is (i.e. ). However, the cached
page has no reference to the variable and returns a sensible "undefined
variable" message. Am I missing something? Should the variable have been
stuffed into the cached page's data property and referenced from there or
something? I'll start digging through the source but from the manual, it
doesn't seem like using the cache is complicated and it's been around since
an early version so I presume it works as advertised.

Thanks,
cp

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



Re: Access Model from Component

2007-08-09 Thread starkey

I thought behaviors were Cake 1.2?  I'm using Cake 1.1.

Thanks for your response,
Shawn

On Aug 9, 3:52 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On 8/9/07, starkey <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello!  I'm using Cake 1.1 and I'm trying to create a component that
> > accesses the database.
>
> Components talk to *controllers*, behaviors talk to *models*.  So, you
> need to create a behavior, not a component.
>
> This link might help point you in the right direction:
>
> http://groups.google.com/group/cake-php/web/frequent-discussions
>
> --
> Chris Hartjes
> Senior Developer
> Cake Development Corporation
>
> My motto for 2007:  "Just build it, damnit!"
>
> @TheBallpark -http://www.littlehart.net/attheballpark
> @TheKeyboard -http://www.littlehart.net/atthekeyboard


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



Re: 2 DATES issues

2007-08-09 Thread CakeMan

Thanks Pablo,

Your first one has worked. However second one didn't work.

for second one ( for extarcting current week's event DAY WISE) i am
using $this->event->findall as the date field is in the event table.

I have tried to put 2nd condition in as

$conditions="Event.eventday>=now() AND
Event.eventdayEvent->findAll($conditions);

It is returning an empty Array.

Please help.

Thanks again


On Aug 10, 12:39 am, "Pablo Viojo" <[EMAIL PROTECTED]> wrote:
> Try
>
> 1 - 'Event.datefield>=now()'
>
> 2 - 'Event.datefield>=now() AND Event.datefield INTERVAL 1 WEEK)'
>
> --
> Pablo Viojo
> [EMAIL PROTECTED]://pviojo.net
>
> On 8/9/07, CakeMan <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Hello friends,
>
> > I am having 2 dates issue while working in cakephp. I have two tables
> > events_categories and events.
>
> > IN one part
>
> > I want to show the events according to the event_categories so i have
> > put this code in event_category model
>
> > var $hasMany = array('Event' =>
> > array('className'=> 'Event',
> >   'conditions'   => '',
> >   'order'=> '',
> >   'dependent'=>  true,
> >   'foreignKey'   => 'event_category_id'
> > )
> >   );
>
> > This is working fine. Now what i want is to show only those events
> > that are in the future i.e. on & after the current date. For that i
> > using this
>
> > var $hasMany = array('Event' =>
> > array('className'=> 'Event',
> >   'conditions'   =>
> > 'Event.datefield>=date("Y-m-d")',
> >   'order'=> '',
> >   'dependent'=>  true,
> >   'foreignKey'   => 'event_category_id'
> > )
> >   );
>
> > But it is not working .pls see the difference of conditions element of
> > hasmany.
>
> > Pls let me how can i show the events  category wise and only those
> > events whose yet to come.
>
> > My second question is :-
>
> > I want to show the events for the current week day wise.
>
> > How can solve my above 2 queries.
>
> > Pls let me know.
>
> > Thanks- Hide quoted text -
>
> - Show quoted text -


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



Re: Access Model from Component

2007-08-09 Thread Chris Hartjes

On 8/9/07, starkey <[EMAIL PROTECTED]> wrote:
>
> Hello!  I'm using Cake 1.1 and I'm trying to create a component that
> accesses the database.

Components talk to *controllers*, behaviors talk to *models*.  So, you
need to create a behavior, not a component.

This link might help point you in the right direction:

http://groups.google.com/group/cake-php/web/frequent-discussions

-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

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

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



Re: Access Model from Component

2007-08-09 Thread starkey

I created my own loadModel method as part of my controller using the
path
$path = APP . 'controllers' . DS . 'components' .DS . 'models' . DS;

So, now the models are found but I get these errors
Warning: overload() was unable to locate class 'model1' :
Fatal error: Cannot instantiate non-existent class: model1

Is this just not a Cake way of doing things (Components with Models)?
I checked out ACL (which I'm now kind of using as a guide) because it
is a component with models but I'm still getting "Cannot instantiate
non-existent class: model1" errors.

Any guidance sure would be appreciated.

Thanks,
Shawn

On Aug 9, 11:58 am, starkey <[EMAIL PROTECTED]> wrote:
> I changed the name to TesterComponent and still no good.
>
> Thanks!
>
> On Aug 9, 11:56 am, starkey <[EMAIL PROTECTED]> wrote:
>
> > Hello!  I'm using Cake 1.1 and I'm trying to create a component that
> > accesses the database.
>
> > Here is what I have:
> > /cake
> >   /app
> >/controllers
> >  /components
> >   tester.php
> >   /models
> >model1.php
> >model2.php
>
> > class Tester extends Object {
> >var $controller = true;
> >var $Model1;
> >var $Model2;
>
> >function startup(&$controller)
> >{
> >   loadModel('Model1');
> >   $this->Model1 = & new Model1();
> >   loadModel('Model2');
> >   $this->Model2 = & new Model2();
> >   }
>
> >   function getModel1Rows()
> >   {
> > return $this->Model1->findAll();
> >   }
>
> > }
>
> > However, I keep getting this error:
> > Cannot instantiate non-existent class: model1
>
> > Thanks for any help!
> > Shawn


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



Re: 2 DATES issues

2007-08-09 Thread Pablo Viojo

Try

1 - 'Event.datefield>=now()'

2 - 'Event.datefield>=now() AND Event.datefieldhttp://pviojo.net



On 8/9/07, CakeMan <[EMAIL PROTECTED]> wrote:
>
> Hello friends,
>
> I am having 2 dates issue while working in cakephp. I have two tables
> events_categories and events.
>
> IN one part
>
> I want to show the events according to the event_categories so i have
> put this code in event_category model
>
> var $hasMany = array('Event' =>
> array('className'=> 'Event',
>   'conditions'   => '',
>   'order'=> '',
>   'dependent'=>  true,
>   'foreignKey'   => 'event_category_id'
> )
>   );
>
> This is working fine. Now what i want is to show only those events
> that are in the future i.e. on & after the current date. For that i
> using this
>
> var $hasMany = array('Event' =>
> array('className'=> 'Event',
>   'conditions'   =>
> 'Event.datefield>=date("Y-m-d")',
>   'order'=> '',
>   'dependent'=>  true,
>   'foreignKey'   => 'event_category_id'
> )
>   );
>
> But it is not working .pls see the difference of conditions element of
> hasmany.
>
> Pls let me how can i show the events  category wise and only those
> events whose yet to come.
>
>
> My second question is :-
>
> I want to show the events for the current week day wise.
>
> How can solve my above 2 queries.
>
> Pls let me know.
>
> Thanks
>
>
> >
>

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



Re: Comparing Dates

2007-08-09 Thread francky06l

I guess using strtotime will make it. If ever you use the $from-
>input  for the date, do not forget to call the cleanupFields before
the save, this will ensure your date is concatenated in your date
field.

On Aug 9, 6:11 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> still learning about cake... but surely converting the dates into a
> timestamp and doing the comparison is the best way?


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



Re: Building Facebook app on CakePHP

2007-08-09 Thread Sav

Here is an initial start of a Facebook component in CakePHP...
http://savarino.net/facebook-cakephp

Please let me know if there are ways to improve this.

On Aug 4, 8:17 am, thequietlab <[EMAIL PROTECTED]> wrote:
> Hi,
>
> yes, the article gave me a good point to start but I would like to
> hear if any of you has some stories to tell about building in cakephp
> forfacebook.. any pitfalls, things to avoid, good practices ?
>
> For now I have a working beta of my app and I'm just wondering how
> should I sneak there withfacebookstuff.. I think the clean way would
> be to have totally separate app with it's own models, controllers and
> views.. maybe somehow just sharing models with the main app ?
>
> Mandy, do you have a separate app forfacebookor you just mix in 
> thefacebookpart inside your existing controllers/views etc ?
>
> Thanks,
> Andrzej
>
> On Aug 4, 10:48 am, "Mandy Singh" <[EMAIL PROTECTED]> wrote:
>
> > This is built using cakePHP. Thats the relevance of posting the URL here.
>
> > And so iswww.votigo.comwhichis already showcased here.
>
> > And this is thefacebookapp part of that site.
>
> > Any other questions? :)
>
> > Thanks,
> > Mandy.
>
> > p.s. No the source code is not available since its specific to an
> > organization, but if you require help from me that is surely available.
>
> > On 8/4/07, Dr. Tarique Sani <[EMAIL PROTECTED]> wrote:
>
> > > On 8/4/07, Mandy <[EMAIL PROTECTED]> wrote:
>
> > > >http://apps.facebook.com/votigofbapp
>
> > > Is this built in cake? Is the source code available?
>
> > > What is the relevance of posting this URL here
>
> > > T
>
> > > --
> > > =
> > > Cheesecake-Photoblog:http://cheesecake-photoblog.org
> > > PHP for E-Biz:http://sanisoft.com
> > > =


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



Images for my models

2007-08-09 Thread murtada

Hi,

I am not sure how to best go about doing this. I have a model called
"Project", each of which will have a set of images or pictures
associated with them.

How would I create the admin side for project? I would have to upload
multiple images, then store them somewhere, etc.

A brief step-by-step direction would be greatly appreciated.

Murtada


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



2 DATES issues

2007-08-09 Thread CakeMan

Hello friends,

I am having 2 dates issue while working in cakephp. I have two tables
events_categories and events.

IN one part

I want to show the events according to the event_categories so i have
put this code in event_category model

var $hasMany = array('Event' =>
array('className'=> 'Event',
  'conditions'   => '',
  'order'=> '',
  'dependent'=>  true,
  'foreignKey'   => 'event_category_id'
)
  );

This is working fine. Now what i want is to show only those events
that are in the future i.e. on & after the current date. For that i
using this

var $hasMany = array('Event' =>
array('className'=> 'Event',
  'conditions'   =>
'Event.datefield>=date("Y-m-d")',
  'order'=> '',
  'dependent'=>  true,
  'foreignKey'   => 'event_category_id'
)
  );

But it is not working .pls see the difference of conditions element of
hasmany.

Pls let me how can i show the events  category wise and only those
events whose yet to come.


My second question is :-

I want to show the events for the current week day wise.

How can solve my above 2 queries.

Pls let me know.

Thanks


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



Re: Loop with select and insert not working as expected

2007-08-09 Thread phalvrson

True - I changed to use the buit-in functions - ie save()  but I still
have the same problem.  The problem is that the line "$household_id =
$this->Household->field("id", $match_userid);" doesn't always issue
it's underlying SQL SELECT `Household`.`id` FROM `households` AS
`Household` WHERE `Household`.`userid` = '115603'  statement - it
seems to assume that id is already set correctly or something  Can
you please explain this behavior?  I've tried inserting a "$this-
>Household->create()"  prior to that statement to re-initialize
things, but that seems to have no effect on this behavior

Latest controller code:

function process_csv_file()
{
$this->pageTitle = 'Process CSV File';
$checkFileFields = Array ( "id", "Item", "Qty", "Household", 
"HHID",
"FirstName", "LastName", "UserID", "Processed", "SchoolLocation",
"HouseholdEmail", "Address1", "Address2", "City", "State", "Zip",
"REFERENCE#2" );
if (!empty($this->params['form'])) {
$file_handle = fopen($this->params['form']['File']
['tmp_name'],"r");
$label_fields = fgetcsv ($file_handle);
$last_household_id = null;
if ($checkFileFields == $label_fields) {
$last_processed_student = null;
$current_order_id = null;
while (!feof($file_handle)) {
$csv_fields = fgetcsv ($file_handle);
/* Remember who we are processing - one 
order per student */
$first_name = $csv_fields[5];
$last_name = $csv_fields[6];
$check_name = $first_name . ' ' . 
$last_name;
/* Process the households db part. */
$this_userid = $csv_fields[7];
$match_userid = "Household.userid = '" 
. $this_userid . "'";
$household_id = 
$this->Household->field("id", $match_userid);
if (($household_id) || 
($this->Household->exists())) {
/* Nothing to do - already have 
household id */
} else {

$this->data['Household']['last_name'] = $last_name;

$this->data['Household']['HHID'] = $csv_fields[4];

$this->data['Household']['userid'] = $this_userid;

$this->data['Household']['email'] = $csv_fields[10];

$this->data['Household']['address_1'] = $csv_fields[11];

$this->data['Household']['address_2'] = $csv_fields[12];

$this->data['Household']['city'] = $csv_fields[13];

$this->data['Household']['state'] = $csv_fields[14];

$this->data['Household']['zipcode'] = $csv_fields[15];
$this->Household->save( 
$this->data);
$household_id = 
$this->Household->getLastInsertID();
}
print_r($household_id);
print_r($this->Household->id);
/* Process the students db part. */
$match_student_name = 
"Student.first_name = '$first_name' AND
Student.last_name = '$last_name' ";
$student_id = 
$this->Student->field("id", $match_student_name);
if (($student_id) || 
($this->Student->exists())) {
/* Nothing to do - already have 
student id */
} else {

$this->data['Student']['first_name'] = $first_name;

$this->data['Student']['last_name'] = $last_name;

$this->data['Student']['household_id'] = $household_id;

$this->data['Student']['school_location'] = $csv_fields[9];
$this->Student->save( 
$this->data);
$student_id = 
$this->Student->getLastInsertID();
}
print

Re: generatelist and Formhelper::Select

2007-08-09 Thread libfree

Will do, thanks!!


On Aug 9, 11:16 am, rtconner <[EMAIL PROTECTED]> wrote:
> Yes you can do it with generateList. Just use the conditions array
> wisely. Depending on the database setup you are using you can include
> the keyword distinct in your conditions. I forget the details. You'll
> have to do a search.
>
> On Aug 8, 2:27 pm, libfree <[EMAIL PROTECTED]> wrote:
>
> > Hi all, I'm new to cake but have been playing with php for a while. I
> > am using Ajax to create a set of select boxes that will create a
> > simple search.  When you select the value in one it will decrease the
> > number of options to select from in the following boxes until it
> > finally displays the narrow list.  I am wondering if there is a way
> > for me to use Generatelist to return only unique values.  I have a
> > table of available items and when I populate the Brand I don't want to
> > have duplicates.  Do I need to do this manually with a custom query?


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



Re: Undefined variable: trying to access variable inside controller

2007-08-09 Thread francky06l

The problem is :

  $this->set('incentive', $this->Incentive->read(null,
$id));

you set the $incentive to your view, but not in this controller ..

  $incentive = $this->Incentive->read(null, $id);
  $this->set('incentive', $incentive);



On Aug 9, 6:25 pm, gentleJuggernaut <[EMAIL PROTECTED]> wrote:
> I have a function that sets a variable for a view and then it needs to
> use a value returned to set another variable in the view.  I am
> getting an Undefined Variable error when I try to call the first
> variable.
>
> /**/
>
> function view($id = null) {
>
> if(!$id) {
> $this->Session->setFlash('Invalid Incentive.');
> $this->redirect(array('action'=>'index'), null, true);
> }
> $this->set('incentive', $this->Incentive->read(null, $id));
> $this->set('similar', $this->Incentive->findAll("type_id = " .
> $incentive['Type']['id']));
> }
>
> /**/
>
> The error that I get is:
>
> Notice (8): Undefined variable:  incentive [CORE/app/controllers/
> incentives_controller.php, line 21]
>
> Is there a different way that I am supposed to use to access data
> inside the controller?
>
> NSM


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



Re: conditional caching

2007-08-09 Thread donuts

This is in cakephp 1.1.16 BTW


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



conditional caching

2007-08-09 Thread donuts

Hello All,

I have come across an issue with view caching and I was wondering if
any had a similar experience. When a view is cached my function for
registering views in the database no longer works. See here.

I have a function in my MediaController

function view($id = null) {
$this->cacheAction = "1 hour";

if(!$id) {
$this->Session->setFlash('Invalid id for Media File.');
$this->redirect('/media/index');
}
$this->Media->view($id);  // Register the click
$this->set('media', $this->Media->read(null, $id));
}

This is a basic view function with caching and a My own function
called  'view' in the model.. The view function simply increments a
field in the db called Views.

In the Media Model

function view($id){
$this->query("UPDATE media_files set views = views + 1 where id 
=".
$id);
return true;
}


Has anyone come across this problem. It is not important that the
rendered view display the actual number of views, but that the
controller actually registers the click. The view can be updated when
the cache clears.

My guess is that I can use some sort of  conditional to render the
cache after the Model->view(), but I am not quite sure how to go about
it.

Cheers.


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



Undefined variable: trying to access variable inside controller

2007-08-09 Thread gentleJuggernaut

I have a function that sets a variable for a view and then it needs to
use a value returned to set another variable in the view.  I am
getting an Undefined Variable error when I try to call the first
variable.

/**/

function view($id = null) {

if(!$id) {
$this->Session->setFlash('Invalid Incentive.');
$this->redirect(array('action'=>'index'), null, true);
}
$this->set('incentive', $this->Incentive->read(null, $id));
$this->set('similar', $this->Incentive->findAll("type_id = " .
$incentive['Type']['id']));
}

/**/


The error that I get is:

Notice (8): Undefined variable:  incentive [CORE/app/controllers/
incentives_controller.php, line 21]

Is there a different way that I am supposed to use to access data
inside the controller?

NSM


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



Re: Comparing Dates

2007-08-09 Thread [EMAIL PROTECTED]

still learning about cake... but surely converting the dates into a
timestamp and doing the comparison is the best way?


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



Re: Docs

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


On Aug 9, 2007, at 10:39 AM, John David Anderson (_psychic_) wrote:

>
> Bakers,
>
> Just another invitation to any and all who want to make documentation
> about CakePHP better. The 1.2 manual (in the works) is 120 pages
> strong, but I'm still looking for folks ready to work on any of the
> following:
>
> 1. Making research notes on new 1.2 features
> 2. Creating examples
> 3. Contributing sections of content
> 4. New ideas
> 5. Converting sections of the old manual to 1.2
>
> Join us in our Google group[1] for docs-specific discussion, and in
> IRC (#cakephp or #cakephp-docs). Please also feel free to contact me
> directly with suggestions, contributions, insults, or childhood
> memories.
>
> Regards,
>
> John David Anderson
> CakePHP Docs

[1] http://groups.google.com/group/cakephp-docs

(oops)

-- John



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



Docs

2007-08-09 Thread _psychic_

Bakers,

Just another invitation to any and all who want to make documentation  
about CakePHP better. The 1.2 manual (in the works) is 120 pages  
strong, but I'm still looking for folks ready to work on any of the  
following:

1. Making research notes on new 1.2 features
2. Creating examples
3. Contributing sections of content
4. New ideas
5. Converting sections of the old manual to 1.2

Join us in our Google group[1] for docs-specific discussion, and in  
IRC (#cakephp or #cakephp-docs). Please also feel free to contact me  
directly with suggestions, contributions, insults, or childhood  
memories.

Regards,

John David Anderson
CakePHP Docs

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



Re: problem with menu.

2007-08-09 Thread Mech7

Thanks that was the problem.. i had only put in adminmenu in the $uses
var :)

On Aug 9, 6:13 pm, "Pablo Viojo" <[EMAIL PROTECTED]> wrote:
> I think the problem is that you have something like this in your controllers
>
> var $uses=array('Menu','AdminMenu',);
>
> But when you try to load an undefined action the models used are not
> instantiated? (Maybe...I'm not sure)
>
> --
> Pablo Viojo
> [EMAIL PROTECTED]://pviojo.net
>
> On 8/9/07, Mech7 <[EMAIL PROTECTED]> wrote:
>
>
>
> > in my app_controller,php i set my menu like this:
>
> > function beforeFilter ()
> > {
> > // Make admin menu available and use admin layout
> > if (isset($this->params['admin'])) {
> > // Set menu
> > $this->set 
> > ('admin_menu',$this->AdminMenu->findAllThreaded(null,
> > null, 'sort_id'));
> > // Use admin layout
> > $this->layout = 'admin_layout';
> > } else {
> > // Set menu
> > $this->set 
> > ('main_menu',$this->Menu->findAllThreaded(null, null,
> > 'sort_id'));
> > // Use admin layout
> > $this->layout = 'default';
> > }
>
> > }
>
> > Only when i go to an action which does no exists yet i get this
> > error :
> > Notice (8): Undefined property:  AppController::$Menu [CORE\app
> > \app_controller.php, line 20]
>
> > $this->layout = 'admin_layout';
>
> > } else {
>
> > // Set menu
>
> > $this->set ('main_menu',$this->Menu->findAllThreaded(null,
> > null, 'sort_id'));
>
> > // Use admin layout
>
> > AppController::beforeFilter() - CORE\app\app_controller.php, line 20
> > Dispatcher::start() - CORE\cake\dispatcher.php, line 380
> > ErrorHandler::__construct() - CORE\cake\libs\error.php, line 81
> > Object::cakeError() - CORE\cake\libs\object.php, line 176
> > Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 307
> > [main] - CORE\app\webroot\index.php, line 83
>
> > Fatal error: Call to a member function findAllThreaded() on a non-
> > object in C:\wamp\www\mech7\app\app_controller.php on line 20
>
> > Does anybody know gow to solve this ?


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



Re: Japanese rendering bug between euc-jp and utf-8 linux

2007-08-09 Thread Jerome Eteve

Actually I found a way to solve that problem:

 In the  wrote:
> Hi all,
>  we are currently translating our website in japanese. Our system and
> our website is full utf-8 .
>
> Here is a problem we have:
>
>  Under linux/firefox 2.0 , the rendering is different if a webpage is
> encoded in euc-jp or in utf-8.
>
> I did some tests with yahoo.jp home page:
>
> - Have a look at yahoo.jp in firefox . All the characters are nicely
> displayed and antialiased.
>  This page is encoded as euc-jp
>
> - Save the yahoo.jp home page html .
> - Change the encoding from euc-jp to utf-8:
>   iconv -f euc-jp -t utf-8 yahoohome.html > yahoohome_utf8.html
>
> - Now open yahoohome_utf8.html in firefox, set the view -> character
> encoding to utf8 (it's still stated in the file that it's a euc-jp
> page).
>
> If you compare the two versions,
>  - the one with euc-jp encoded character is perfect.
>  - the one with utf-8 encoded characters have got the same characters
> everywhere but about half of them is display very roughly, without any
> antialising.
>
> As far as I understand how character encoding works, the encoding of
> the page should not influence the picked code point of the displayed
> character, but here apparently it's the case.
> The encoding seems to have an effect on which character is picked from
> the character set.
>
> This problem doesn't appear in ie for linux ( 
> fromhttp://www.tatanka.com.br/ies4linux/page/Main_Page) nor in ie or
> firefox for windows
>
> I'm a bit confused.
>
> Thanks for any help !
>
> Jerome


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



Re: problem with menu.

2007-08-09 Thread Pablo Viojo

I think the problem is that you have something like this in your controllers

var $uses=array('Menu','AdminMenu',);

But when you try to load an undefined action the models used are not
instantiated? (Maybe...I'm not sure)


-- 
Pablo Viojo
[EMAIL PROTECTED]
http://pviojo.net





On 8/9/07, Mech7 <[EMAIL PROTECTED]> wrote:
>
> in my app_controller,php i set my menu like this:
>
> function beforeFilter ()
> {
> // Make admin menu available and use admin layout
> if (isset($this->params['admin'])) {
> // Set menu
> $this->set 
> ('admin_menu',$this->AdminMenu->findAllThreaded(null,
> null, 'sort_id'));
> // Use admin layout
> $this->layout = 'admin_layout';
> } else {
> // Set menu
> $this->set 
> ('main_menu',$this->Menu->findAllThreaded(null, null,
> 'sort_id'));
> // Use admin layout
> $this->layout = 'default';
> }
>
> }
>
>
> Only when i go to an action which does no exists yet i get this
> error :
> Notice (8): Undefined property:  AppController::$Menu [CORE\app
> \app_controller.php, line 20]
>
>
> $this->layout = 'admin_layout';
>
>
>
> } else {
>
>
>
> // Set menu
>
>
>
> $this->set ('main_menu',$this->Menu->findAllThreaded(null,
> null, 'sort_id'));
>
>
>
> // Use admin layout
>
> AppController::beforeFilter() - CORE\app\app_controller.php, line 20
> Dispatcher::start() - CORE\cake\dispatcher.php, line 380
> ErrorHandler::__construct() - CORE\cake\libs\error.php, line 81
> Object::cakeError() - CORE\cake\libs\object.php, line 176
> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 307
> [main] - CORE\app\webroot\index.php, line 83
>
>
> Fatal error: Call to a member function findAllThreaded() on a non-
> object in C:\wamp\www\mech7\app\app_controller.php on line 20
>
> Does anybody know gow to solve this ?
>
>
> >
>

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



Aliasing a model name in a HABTM association

2007-08-09 Thread David

Hi guys,

Yep, another HABTM question I'm afraid... but I haven't been able to
find the answer to this one on the group, so maybe it hasn't been
brought up yet :)

My app contains a model merchants, each of which hasAndBelongsToMany
related merchants. No problem, I just use this code in the merchant
model:

var $hasAndBelongsToMany =
array('Merchant'=>array('classname'=>'Merchant',
'joinTable'=>'related_merchants', 'foreignKey'=>'merchant1_id',
'associationForeignKey'=>'merchant2_id'));

The problem comes when the data is retrieved from the DB. Imagine
'merchants' had a conventional HABTM relationship with 'customers'. we
would have:

$data['Merchant'] (containing the data about the merchant)
$data['Customer'] (containing an array of the associated customers)

However, with the related merchants their information is put inside
the $data['Merchant'] array! So we have

$data['Merchant']['id'] (id of the merchant)
$data['Merchant']['name'] (name of the merchant)
$data['Merchant'][0] (array containing the info for the first related
merchant)
$data['Merchant'][1] (array containing the info for the second related
merchant)
etc.

I think this is messy and would prefer to have something like:

$data['Merchant'] (containing the data about the merchant)
$data['RelatedMerchant'] (containing an array of the related
merchants)

Does anyone know how to do this?

Thanks!

David


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



Re: Access Model from Component

2007-08-09 Thread starkey

I changed the name to TesterComponent and still no good.

Thanks!


On Aug 9, 11:56 am, starkey <[EMAIL PROTECTED]> wrote:
> Hello!  I'm using Cake 1.1 and I'm trying to create a component that
> accesses the database.
>
> Here is what I have:
> /cake
>   /app
>/controllers
>  /components
>   tester.php
>   /models
>model1.php
>model2.php
>
> class Tester extends Object {
>var $controller = true;
>var $Model1;
>var $Model2;
>
>function startup(&$controller)
>{
>   loadModel('Model1');
>   $this->Model1 = & new Model1();
>   loadModel('Model2');
>   $this->Model2 = & new Model2();
>   }
>
>   function getModel1Rows()
>   {
> return $this->Model1->findAll();
>   }
>
> }
>
> However, I keep getting this error:
> Cannot instantiate non-existent class: model1
>
> Thanks for any help!
> Shawn


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



Access Model from Component

2007-08-09 Thread starkey

Hello!  I'm using Cake 1.1 and I'm trying to create a component that
accesses the database.

Here is what I have:
/cake
  /app
   /controllers
 /components
  tester.php
  /models
   model1.php
   model2.php

class Tester extends Object {
   var $controller = true;
   var $Model1;
   var $Model2;

   function startup(&$controller)
   {
  loadModel('Model1');
  $this->Model1 = & new Model1();
  loadModel('Model2');
  $this->Model2 = & new Model2();
  }

  function getModel1Rows()
  {
return $this->Model1->findAll();
  }

}

However, I keep getting this error:
Cannot instantiate non-existent class: model1

Thanks for any help!
Shawn


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



HABTM Conditions?

2007-08-09 Thread Mech7

I am trying to select articles based on which menu item they are
attached.. but it wont work does anybody know how i can select the
fields from the other table ?

My model is like this :

var $hasAndBelongsToMany = array(
'Tag' =>
array('className'=> 'Tag',
'joinTable'=> 'articles_tags',
'foreignKey'   => 'article_id',
'associationForeignKey'=> 'tag_id',
'conditions'   => '',
'order'=> '',
'limit'=> '',
'unique'   => true,
'finderQuery'  => '',
'deleteQuery'  => '',
),
'Menu' =>
array('className'=> 'Menu',
'joinTable'=> 'articles_menu',
'foreignKey'   => 'article_id',
'associationForeignKey'=> 'menu_id',
'conditions'   => '',
'order'=> '',
'limit'=> '',
'unique'   => true,
'finderQuery'  => '',
'deleteQuery'  => '',
),
);

And i am trying to select them like this:

function category($category_name)
{
$this->set('articles',  $this->paginate('Article', 
array('Menu.name'
=> $category_name)));
}

But i get an error that the field does not exists Menu.name :(

Also it does not seem to make a joing but 2 select statements ?

6   SELECT `Menu`.`id`, `Menu`.`sort_id`, `Menu`.`name`, `Menu`.`type`,
`Menu`.`url`, `Menu`.`published`, `Menu`.`parent_id` FROM `cms_menu`
AS `Menu` WHERE 1 = 1 ORDER BY `sort_id` ASC16  16  1
7   SELECT COUNT(*) AS count FROM `cms_articles` AS `Article` WHERE
`Menu`.`name` = 'news'  1054: Unknown column 'Menu.name' in 'where
clause' 3
8   SELECT `Article`.`id`, `Article`.`title`, `Article`.`published`,
`Article`.`frontpage`, `Article`.`created`, `Article`.`modified`,
`Article`.`slug` FROM `cms_articles` AS `Article` WHERE `Menu`.`name`
= 'news' ORDER BY `id` desc LIMIT 151054: Unknown column 'Menu.name'
in 'where clause'


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



Re: generatelist and Formhelper::Select

2007-08-09 Thread rtconner

Yes you can do it with generateList. Just use the conditions array
wisely. Depending on the database setup you are using you can include
the keyword distinct in your conditions. I forget the details. You'll
have to do a search.

On Aug 8, 2:27 pm, libfree <[EMAIL PROTECTED]> wrote:
> Hi all, I'm new to cake but have been playing with php for a while. I
> am using Ajax to create a set of select boxes that will create a
> simple search.  When you select the value in one it will decrease the
> number of options to select from in the following boxes until it
> finally displays the narrow list.  I am wondering if there is a way
> for me to use Generatelist to return only unique values.  I have a
> table of available items and when I populate the Brand I don't want to
> have duplicates.  Do I need to do this manually with a custom query?


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



Re: ACL Implementation Discussion

2007-08-09 Thread Jon Bennett

> I have an implementation like this...
>
> ACOs
> Admin
> Clients
> + Company::1
> + + Company::1.login
> + + Company::1.users
> + + Company::1.transactions
> + + (... one for each controller)
> + Company::2
> + + (...)
> + (...)
> Users
> + User::1
> + User::2
> + (...)
>
> AROs
> Admin
> + User::1
> Users
> + User::2
> + User::3
> + (...)
>
> Each User::n aro has access to User::n aco.
> The ARO admin group has access to ACOs Admin, Clients, Users...
> And, each Company::n ACO can be accessed by selected users...
> If an user has access to the Company::n matrix, he access everything
> below it...
> If an user has write access to Company::n.users, he can manipulate
> wich registered users can access what and he can register users.
> (Users cannot self-registrate).
>
> Just my 2 cents for your references... =)

this sounds really useful, thanks!

I have a question though, how do you keep track of who created what?
Do you still have a Model.user_id to pull in the associated data?

cheers,

jon


-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

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



Comparing Dates

2007-08-09 Thread pbland

I want to compare 2 dates to make sure 1 date is older than the other.
I believe I need to write my own comparison, but want to make sure
there's nothing in Cake that already does this. I know date formats
can be checked and I've seen a post saying the 'comparison' check is
regex-based, which wouldn't help. Are my assumptions correct?

Thanks,
Paul


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



Re: ACL Implementation Discussion

2007-08-09 Thread LS

I have an implementation like this...

ACOs
Admin
Clients
+ Company::1
+ + Company::1.login
+ + Company::1.users
+ + Company::1.transactions
+ + (... one for each controller)
+ Company::2
+ + (...)
+ (...)
Users
+ User::1
+ User::2
+ (...)

AROs
Admin
+ User::1
Users
+ User::2
+ User::3
+ (...)

Each User::n aro has access to User::n aco.
The ARO admin group has access to ACOs Admin, Clients, Users...
And, each Company::n ACO can be accessed by selected users...
If an user has access to the Company::n matrix, he access everything
below it...
If an user has write access to Company::n.users, he can manipulate
wich registered users can access what and he can register users.
(Users cannot self-registrate).

Just my 2 cents for your references... =)

Regards

On Aug 7, 9:43 pm, Langdon Stevenson <[EMAIL PROTECTED]> wrote:
> Hi Alteczec
>
> I have a similar issue with a manufacturing process management
> application.  My solution was to create generic "data" ACOs for various
> groups.  Like this:
>
> - Company A
> -- admin data
> -- manufacturing data
> - Company B
> -- admin data
> -- manufacturing data
>
> etc
>
> When a user is registered, they are given permissions on their companies
> ACOs
>
> When a record is saved a reference to the ACO group that the data
> belongs to is saved in one field.  Now I can tell which ACO a record
> belongs to
>
> When a user logs in I get (using the ACL system) a list of ACOs that the
> user has access to and store it in their session.
>
> When querying data from the database I limit the data set with a "WHERE
> [field.name] IN ([list, of, ACOs])" clause.  This means that each user
> can only retrieve the data that they have permission to see.  It won't
> matter how they hack the URL, or form values, the application will just
> filter out what they don't have access to.
>
> I think that this is a reasonably flexible solution that results in the
> smallest number of ACOs for data, the best performance at the user end
> and the smallest possible system load.
>
> Regards,
> Langdon
>
> 
>
> > But this brings up a few questions:
>
> > A)  Do I create a parent ARO (group) to hold all of the admins and
> > editors of a store?
> > B)  Do I create a parent ACO (group) to hold all of the products and
> > categories?
> > -  Doing A and B would allow me to say group A ARO's can access group
> > A ACO's -
> > Is this the best way to implement the authorization component of the
> > application?  Would it be better to ignore the grouping of ARO's and
> > ACO's?
>
> > I'm concerned about the scalability of implementing this.  If I have
> > 1000 products and 100 categories that would be 1100 ACO's for one
> > store.  Not to mention that if I had 3 editors for that store I would
> > have 3 x 1100 AroAco's?  This is where I was hoping the grouping of
> > ACO's under a parent would come in.You could just grant editor A
> > access to group A ACO's - right?  If you have 300 stores this quickly
> > grows...


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



Re: Custom Ajax Autocomplete in 1.0

2007-08-09 Thread LS

Nice! I'll give it a try!
Thanks

On Aug 9, 11:21 am, Mech7 <[EMAIL PROTECTED]> wrote:
> I could not get all of the features to work also..  so i just wrote it
> in html:
>
> 
> new 
> Ajax.Autocompleter('TagTag',
> 'TagTag_autoComplete',
> ' $this->webroot;?>/articles/autocompleteTags',
> {afterUpdateElement:addExistingTags, 
> indicator:'spinner'});
> 
> 
>  alt="Working..." />
> 
>
> Guess you can do the same for customized :)
>
> On Aug 9, 4:07 pm, LS <[EMAIL PROTECTED]> wrote:
>
> > Sorry... It was supposed to be Cake 1.2...


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



Re: Custom Ajax Autocomplete in 1.0

2007-08-09 Thread Mech7

I could not get all of the features to work also..  so i just wrote it
in html:


new 
Ajax.Autocompleter('TagTag',
'TagTag_autoComplete',
'webroot;?>/articles/autocompleteTags',
{afterUpdateElement:addExistingTags, 
indicator:'spinner'});





Guess you can do the same for customized :)

On Aug 9, 4:07 pm, LS <[EMAIL PROTECTED]> wrote:
> Sorry... It was supposed to be Cake 1.2...


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



Re: ACL Implementation Discussion

2007-08-09 Thread Alteczen

Langdon,

I'm not sure I completely understand...

"When a record is saved a reference to the ACO group that the data
belongs to is saved in one field.  Now I can tell which ACO a record
belongs to


When a user logs in I get (using the ACL system) a list of ACOs that
the
user has access to and store it in their session.


When querying data from the database I limit the data set with a
"WHERE
[field.name] IN ([list, of, ACOs])" clause.  This means that each
user
can only retrieve the data that they have permission to see.
"

This sounds like exactly what I'm trying to do... could you
elaborate?  Thanks a ton for the insight!


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



problem with menu.

2007-08-09 Thread Mech7

in my app_controller,php i set my menu like this:

function beforeFilter ()
{
// Make admin menu available and use admin layout
if (isset($this->params['admin'])) {
// Set menu
$this->set 
('admin_menu',$this->AdminMenu->findAllThreaded(null,
null, 'sort_id'));
// Use admin layout
$this->layout = 'admin_layout';
} else {
// Set menu
$this->set 
('main_menu',$this->Menu->findAllThreaded(null, null,
'sort_id'));
// Use admin layout
$this->layout = 'default';
}

}


Only when i go to an action which does no exists yet i get this
error :
Notice (8): Undefined property:  AppController::$Menu [CORE\app
\app_controller.php, line 20]


$this->layout = 'admin_layout';



} else {



// Set menu



$this->set ('main_menu',$this->Menu->findAllThreaded(null,
null, 'sort_id'));



// Use admin layout

AppController::beforeFilter() - CORE\app\app_controller.php, line 20
Dispatcher::start() - CORE\cake\dispatcher.php, line 380
ErrorHandler::__construct() - CORE\cake\libs\error.php, line 81
Object::cakeError() - CORE\cake\libs\object.php, line 176
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 307
[main] - CORE\app\webroot\index.php, line 83


Fatal error: Call to a member function findAllThreaded() on a non-
object in C:\wamp\www\mech7\app\app_controller.php on line 20

Does anybody know gow to solve this ?


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



Re: Custom Ajax Autocomplete in 1.0

2007-08-09 Thread LS

Sorry... It was supposed to be Cake 1.2...


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



Custom Ajax Autocomplete in 1.0

2007-08-09 Thread LS

Hello, everyone.
Does anyone has an idea on how to implement the custom autocomplete
like the demo on scriptaculous (http://demo.script.aculo.us/ajax/
autocompleter_customized)?

I have tried a little... I made this in my view:


Conta Contabil
autoComplete('Account.name','/accounts/
autocomplete', array('id' => 'AccountName', 'indicator' =>
'spinner'))); ?>
image('spinner.gif', array('class' => 'spinner'))); ?>


And this in my controller:

function autocomplete() {
$this->layout = 'ajax';
$filter = null;
if (isset($this->data) && !empty($this->data)) {
$filter = 'Account.name LIKE "%' . 
$this->data['Account']['name'] .
'%" OR Account.code LIKE "%' . $this->data['Account']['name'] . '%"';
}
$this->set('data',$this->User->findAll($filter));
}

But ajax doesnt seem to be retrieving it from the autocomplete
function, because I have the following in the debug:

SELECT `Account`.`id`, `Account`.`created`, `Account`.`modified`,
`Account`.`company_id`, `Account`.`code`, `Account`.`name` FROM
`accounts` AS `Account` WHERE `Account`.`name` LIKE '%a%'

There is nowhere a reference to 'OR Account.code...' stuff in my
view...
What am I missing?

Thanks!


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



Florida Cake developers?

2007-08-09 Thread Brian Breslin

Hi everyone,
I'm kind of new here (been reading, not contributing for a few weeks),
and was wondering if there were any cake developers in Florida on this
list? Ideally south florida.
I've got a couple projects I'm planning in cake, and am looking for
individuals or teams.
If you can point me to anyone, or are yourself one, let me know.

thanks,
Brian

-- 
Brian Breslin - CEO - infiniMedia, inc.
http://infinimedia.com
1.305.728.4641

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



Re: constants issue

2007-08-09 Thread francky06l

You can use FULL_BASE_URL.'/'.APP.'/'.$this->name;   in controller
that should make it .. I use often  FULL_BASE_URL..$html-
>url('Controller') in view ...
Actually do you want to extract this from some variable, or set it ?

On Aug 9, 9:18 am, CakeMan <[EMAIL PROTECTED]> wrote:
> Thanks francky for your reply,
>
> I want to extract it from the controller and wants to use in the View.
> or directly from the view.
>
> On Aug 9, 11:17 am, francky06l <[EMAIL PROTECTED]> wrote:
>
> > You want to extract this from where, I mean, in a controller ?
> > beforeFilter ?
>
> > On Aug 9, 7:50 am, CakeMan <[EMAIL PROTECTED]> wrote:
>
> > > Hello Friends,
>
> > > do anyone has list of Contants in Cakephp. i have seen in the manul
> > > but they will not do me good in my task.
>
> > > What i need is :-
>
> > > Suppose we have a URL such 
> > > ashttp://mysite.com/insidecake/events/view/28/12/2016
>
> > > i want to extract URL upto "http://mysite.com/insidecake/events"; how
> > > can i achieve this.
>
> > > I have used "FULL_BASE_URL" but i have got only "http://mysite.com";
> > > other constants are not working such as $this->webroot, WWW_ROOT  etc.
>
> > > Pls help.
>
> > > Thanks- Hide quoted text -
>
> > - Show quoted text -


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



Re: Form elements don't update

2007-08-09 Thread noWookies

Ok,

it was really stupid, sorry for wasting space !

I was learning how to use cake using the IBM tutorial and it uses the
depreciated inputTag.

Changed it to just "input" and now it's all good...

this took me at least 4 hours to figure out.

On Aug 9, 10:09 pm, noWookies <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I am sure there is a very simple solution to this, but it surely
> doesn't come "rapid" to me.
>
> I have a simple form which let's the user edit some simple data.
>
> This is the part of the view I am having a problem with:
>
> 
> inputTag('User/email', array('value' =>
> $profile['User']['email'])) ?>
>
> the first line echos the email as expected. The inputField in the
> second line however, stays empty and I can't figure out why?
>
> This is the corresponding part in my controller:
> $this->set('profile', $profile);
>
> from the dump:
> [profile] => Array
> (
> [Profile] => Array
> (
> [...]
> )
>
> [User] => Array
> (
> [...]
> [email] => [EMAIL PROTECTED]
> )
>
> I must be missing something obvious here ? If anyone could throw a
> rock at me which wakes me up, that'd be greatly appreciated ;)
>
> thanks !


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



Re: RequestHandler not found?

2007-08-09 Thread libfree


That's the worst part about it.  The file is present at cake/libs/
controller/component/request_handler.php .  I have tried copying it to
app/controller/components as well.  I downloaded the framework again
this morning and replaced the cake folder.  I am still getting the
same errors.


On Aug 9, 2:43 am, metasan <[EMAIL PROTECTED]> wrote:
> Hi,
>
> The problem seems to be with your framework installation.
> You can check if the file is still present at "cake/libs/controller/
> components/request_handler.php.
> In the worst case you will have to update the framework.
>
> Let me know the issue.
>
> metasan.http://www.pieg.nethttp://www.piegteam.com





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



Form elements don't update

2007-08-09 Thread noWookies

Hi all,

I am sure there is a very simple solution to this, but it surely
doesn't come "rapid" to me.

I have a simple form which let's the user edit some simple data.

This is the part of the view I am having a problem with:


inputTag('User/email', array('value' =>
$profile['User']['email'])) ?>

the first line echos the email as expected. The inputField in the
second line however, stays empty and I can't figure out why?

This is the corresponding part in my controller:
$this->set('profile', $profile);

from the dump:
[profile] => Array
(
[Profile] => Array
(
[...]
)

[User] => Array
(
[...]
[email] => [EMAIL PROTECTED]
)


I must be missing something obvious here ? If anyone could throw a
rock at me which wakes me up, that'd be greatly appreciated ;)

thanks !


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



Re: Loop with select and insert not working as expected

2007-08-09 Thread Chris Hartjes

On 8/8/07, phalvrson <[EMAIL PROTECTED]> wrote:
> The Household Model:
>
> class Household extends AppModel
> {
> var $name = 'Household';
> /* Creates new record in households and returns it's ID */
> function createRecord ($last_name, $HHID, $userid, $email,
> $address_1, $address_2, $city, $state, $zipcode)
> {
> $execString = "INSERT households SET ";
> $execString .= " last_name = '" . $last_name . "',";
> $execString .= " HHID = '" . $HHID . "',";
> $execString .= " userid = '" . $userid . "',";
> $execString .= " email = '" . $email . "',";
> $execString .= " address_1 = '" . $address_1 . "',";
> $execString .= " address_2 = '" . $address_2 . "',";
> $execString .= " city = '" . $city . "',";
> $execString .= " state = '" . $state . "',";
> $execString .= " zipcode = '" . $zipcode . "'";
> $this->execute($execString);
> return;
> }
> }
>

Why aren't you using the built-in Model functions?  For what you are
doing there is no need for custom SQL queries.

-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

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

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



View this page "Cake Apps/Sites In The Wild"

2007-08-09 Thread [EMAIL PROTECTED]

Added The Pepin Press web shop and online presence ( http://pepinpress.com
) for a Dutch design books publisher.

Click on http://groups.google.com/group/cake-php/web/cake-apps-sites-in-the-wild
- or copy & paste it into your browser's address bar if that doesn't
work.


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



Re: Session empty in Ajax call

2007-08-09 Thread simon

The workaround I've found for this goes:

Make the Flash uploader post to /attachments/upload/(session id)

Then in attachments controller, recreate the session:

function upload($sessionId)
{
  session_destroy();
  session_id($sessionId);
  session_start();
  ...

I then have to manually do any authentication checks and such.
Seems to work alright though.


On Aug 9, 10:51 am, simon <[EMAIL PROTECTED]> wrote:
> You're absolutely right - I'm getting two different session IDs. And
> security is set to medium...
>
> Is there anything I can do about this? If I send the correct session
> ID as a GET variable, is there any way that the right session can be
> recovered or found?
>
> S
>
> On Aug 8, 6:28 pm, "John David Anderson (_psychic_)"
>
> <[EMAIL PROTECTED]> wrote:
> > On Aug 8, 2007, at 11:25 AM, John David Anderson (_psychic_) wrote:
>
> > > On Aug 8, 2007, at 11:19 AM, simon wrote:
>
> > >> Not sure... where is the session id located?
>
> > > In your cookies - you can also get it by calling session_id().
>
> > I should mention that if CAKE_SECURITY is set to 'high' the ID will
> > always change between requests. Set it to 'medium' while you're
> > working on this issue. If the ID changes when you're on 'medium' its
> > because the session got nuked somehow.
>
> > -- John


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



Re: Can you use helpers in controllers?

2007-08-09 Thread Mike Green

I've discovered that you can do it, and it works exactly as I wanted.

loadHelper("Html");
$this->html=& new HtmlHelper();


I can then use $this->html->link (or any other html helper function in
my controller as I wish.

Thanks to dhofstet and nukem932 on irc for the help. My app now quite
happily works as i want it to from both standard and jake requests.

Mike


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



Re: Session empty in Ajax call

2007-08-09 Thread simon

You're absolutely right - I'm getting two different session IDs. And
security is set to medium...

Is there anything I can do about this? If I send the correct session
ID as a GET variable, is there any way that the right session can be
recovered or found?

S

On Aug 8, 6:28 pm, "John David Anderson (_psychic_)"
<[EMAIL PROTECTED]> wrote:
> On Aug 8, 2007, at 11:25 AM, John David Anderson (_psychic_) wrote:
>
>
>
> > On Aug 8, 2007, at 11:19 AM, simon wrote:
>
> >> Not sure... where is the session id located?
>
> > In your cookies - you can also get it by calling session_id().
>
> I should mention that if CAKE_SECURITY is set to 'high' the ID will
> always change between requests. Set it to 'medium' while you're
> working on this issue. If the ID changes when you're on 'medium' its
> because the session got nuked somehow.
>
> -- John


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



Re: Can you use helpers in controllers?

2007-08-09 Thread djiize

I don't know if you can access helpers from controller, but I know you
shouldn't do it!

Helpers are for views, components are for controllers (and behaviors
for models)

A component + helper combo is possible, maybe your solution.

On 9 août, 11:00, Mike Green <[EMAIL PROTECTED]> wrote:
> Dear all
>
> I've come across a small problem.
>
> In my app, I'm trying to totally seperate all of the calculations and
> views into the controllers and .ctp files, which seem to be fine.
>
> However, when I am populating my table array, ready for the view, I
> want to use the cake html helper class, and it seems that I can only
> call this from the .ctp file with $html->link() function. Is there any
> way at all to be able to use this helper in the controller as then I
> can populate the links array before the view even sees it.
>
> then the view can literally just call
>
> echo $html->tableCells($mylinks);
>
> Are there any workaround? Somebody on irc suggested using
> HtmlHelper::link() but that didn't work.
>
> Open to ideas here. Please don't tell me that my view will have to
> traverse an array and populate stuff. Oh and I dont really want to
> hard code it from the controller either as at some point joomla (jake)
> will need to hook into it at some point.
>
> Thanks in advance
>
> MIke


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



Re: constants issue

2007-08-09 Thread CakeMan

Thanks francky for your reply,

I want to extract it from the controller and wants to use in the View.
or directly from the view.

On Aug 9, 11:17 am, francky06l <[EMAIL PROTECTED]> wrote:
> You want to extract this from where, I mean, in a controller ?
> beforeFilter ?
>
> On Aug 9, 7:50 am, CakeMan <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello Friends,
>
> > do anyone has list of Contants in Cakephp. i have seen in the manul
> > but they will not do me good in my task.
>
> > What i need is :-
>
> > Suppose we have a URL such 
> > ashttp://mysite.com/insidecake/events/view/28/12/2016
>
> > i want to extract URL upto "http://mysite.com/insidecake/events"; how
> > can i achieve this.
>
> > I have used "FULL_BASE_URL" but i have got only "http://mysite.com";
> > other constants are not working such as $this->webroot, WWW_ROOT  etc.
>
> > Pls help.
>
> > Thanks- Hide quoted text -
>
> - Show quoted text -


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



Can you use helpers in controllers?

2007-08-09 Thread Mike Green

Dear all

I've come across a small problem.

In my app, I'm trying to totally seperate all of the calculations and
views into the controllers and .ctp files, which seem to be fine.

However, when I am populating my table array, ready for the view, I
want to use the cake html helper class, and it seems that I can only
call this from the .ctp file with $html->link() function. Is there any
way at all to be able to use this helper in the controller as then I
can populate the links array before the view even sees it.

then the view can literally just call

echo $html->tableCells($mylinks);

Are there any workaround? Somebody on irc suggested using
HtmlHelper::link() but that didn't work.

Open to ideas here. Please don't tell me that my view will have to
traverse an array and populate stuff. Oh and I dont really want to
hard code it from the controller either as at some point joomla (jake)
will need to hook into it at some point.

Thanks in advance

MIke


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



Re: constants issue

2007-08-09 Thread djiize

you have access from almost everywhere to:
$this->name // controller name (events)
$this->action // action name (view)

and several constants are in /cake/basics.php

On 9 août, 08:17, francky06l <[EMAIL PROTECTED]> wrote:
> You want to extract this from where, I mean, in a controller ?
> beforeFilter ?
>
> On Aug 9, 7:50 am, CakeMan <[EMAIL PROTECTED]> wrote:
>
> > Hello Friends,
>
> > do anyone has list of Contants in Cakephp. i have seen in the manul
> > but they will not do me good in my task.
>
> > What i need is :-
>
> > Suppose we have a URL such 
> > ashttp://mysite.com/insidecake/events/view/28/12/2016
>
> > i want to extract URL upto "http://mysite.com/insidecake/events"; how
> > can i achieve this.
>
> > I have used "FULL_BASE_URL" but i have got only "http://mysite.com";
> > other constants are not working such as $this->webroot, WWW_ROOT  etc.
>
> > Pls help.
>
> > Thanks


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



Re: RequestHandler not found?

2007-08-09 Thread metasan

Hi,

The problem seems to be with your framework installation.
You can check if the file is still present at "cake/libs/controller/
components/request_handler.php.
In the worst case you will have to update the framework.


Let me know the issue.

metasan.
http://www.pieg.net
http://www.piegteam.com


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



Re: So many queries for a belongsTo association...

2007-08-09 Thread R. Rajesh Jeba Anbiah

On Jul 30, 3:44 pm, Saymons <[EMAIL PROTECTED]> wrote:
> I found someone who has quite the same problem 
> :http://groups.google.com/group/cake-php/browse_thread/thread/b97c38e4...https://trac.cakephp.org/ticket/2448
>
> But in my case, there are not join at all, that makes me unhappy
> because it could be faster, and I could sort all my stuff
  
Please check:
1. http://groups.google.com/group/cake-php/web/frequent-discussions
2. http://groups.google.com/group/cake-php/msg/c10840be78a34df0

--
  
Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/


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