Re: app attempting to insert records rather than update

2009-06-19 Thread Jon Chin

Thanks for the tip.  Sadly, I'm still having problems with it.  When I 
add ?=$form-input('id');? to the view, all it does is generate input 
type=hidden name=data[Application][id] value= id=ApplicationId 
/ which doesn't change anything in my controller when I print the 
contents of $this-data.  I also tried making the field called 
application_id in the form, but it didn't have an effect either.

It's really stumping me.  Any idea what's going on?  Since my primary 
key on Merit is application_id, should Cake already know that if I'm 
trying to set $this-Merit-id?

Jon Chin




rich...@home wrote:
 Forget about storing the id in a session and just include the field in
 the form. Cake will automatically hide it from the user.

 On Jun 18, 8:55 am, Jon Chin j...@boogly.net wrote:
   
 I'm building a scholarship application using Cake.  I have an
 Application model and a Merit model and I'm using a wizard component I
 picked up from the Bakery.  The Application model has a hasOne
 relationship to Merit.  I want my users to be able to come back to edit
 the stuff they've already saved to the merits table.  My app works fine
 the first time a user goes through the process.  The problem I'm having
 is that when they want to edit the data (btw, it loads the data from the
 db fine), it attempts to insert a new record rather than update the
 current.  Here's my relevant code:

 In the controller:
 $this-Merit-id = $this-Session-read('application_id');//I've done a
 pr($this-Merit-id); and it is has the right application id
 if($this-Merit-save($this-data)) {return true;}

 In the model:
 var $name = 'Merit';
 var $belongsTo = array('Application' = array(
 'className'= 'Application',
 'foreignKey'= 'application_id'
 ));

 Any advice would be greatly appreciated.  I've been banging my head on
 the wall over this.

 Thanks,

 --
 Jon Chin
 
 
   

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



Re: Flash site With Cake Php

2009-06-19 Thread Adam Royle

Put this in app/views/users/xml/index.ctp

?php
echo 'users';
echo $xml-serialize($users, array('format' = 'tags'));
echo '/users';
?

and put this in app/views/layouts/xml/default.ctp

?php
echo $xml-header();
echo $content_for_layout;
?

XML it doesn't show as XML in your browser if debug is set to 2,
because RequestHandler won't output the necessary headers. If that's
the case, add this in your AppController's beforeFilter() to override
this behaviour:

if (!empty($this-params['url']['ext'])  $this-params['url']['ext']
== 'xml'  Configure::read('debug')  0) {
Configure::write('debug', 1);
}

And then it should all work!

Cheers,
Adam

On Jun 19, 4:43 am, taufiq ridha taufiq.ri...@gmail.com wrote:
 Hello, nice to meet u all!!
 sorry for this stupid question, but i'm really new on this framework.
 i was try to search for this subject, but not find yet, so i decided
 to ask for all guru's here :)

 i want to build flash site, which cake php will provide xml for my
 flash,

 here's what i was done to get xml :

 Routes by adding :
 Router::parseExtensions();

 on the controller :

 ?php
 class UsersController extends AppController {

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

         function index() {
                 $this-User-recursive = 0;
                 $this-set('users', $this-paginate());
         }}

 ?

 finnaly here's code for my views on views/users/xml/index.ctp

 ?php
 echo $xml-serialize($users);
 ?

 Now, when i pointing tohttp://localhost/example/users/index.xmli got
 very messy xml

 ?xml version=1.0 encoding=UTF-8 ?user id=1
 username=taufiqridha password=taufiq123
 email=taufiq.ri...@gmail.com name=Taufiq Ridha birth=2009-06-17
 sex=1 city=Jakarta phone=2147483647 avatar_face_id=1
 avatar_hair_id=1 avatar_top_id=1 avatar_bottom_id=1
 avatar_shoe_id=1 avatar_acc1_id=1 avatar_acc2_id=1 shout=ini
 shout out 2 point=0 created=2009-06-17 01:05:50
 modified=2009-06-17 01:32:07avatar_face id=1 name=Gondrong
 sex=1 path_image=http://taufiq-ridha.co.cc; created=2009-06-14
 20:14:27 modified=2009-06-14 20:14:27 /avatar_hair id=1
 name=Belah Tengah sex=1 path_image=http://taufiq-ridha.co.cc;
 created=2009-06-14 20:15:31 modified=2009-06-14 20:15:31 /avatar_top 
 id=1 name=Atasan Kurus sex=1 path_image=http://

 taufiq-ridha.co.cc created=2009-06-14 20:16:09 modified=2009-06-14
 20:16:09 /avatar_bottom id=1 name=Changcutters Style sex=1
 path_image=http://taufiq-ridha.co.cc; created=2009-06-14 20:16:35
 modified=2009-06-14 20:16:35 /avatar_shoe id=1 name=Sepatu
 Jungle sex=1 path_image=http://taufiq-ridha.co.cc;
 created=2009-06-14 20:17:38 modified=2009-06-14 20:17:38 /avatar_acc1 
 id=1 name=Gelang Punk sex=1 path_image=http://

 taufiq-ridha.co.cc created=2009-06-14 20:16:59 modified=2009-06-14
 20:16:59 /avatar_acc2 id=1 name=Topi Koboi sex=1
 path_image=http://taufiq-ridha.co.cc; created=2009-06-14 20:17:16
 modified=2009-06-14 20:17:16 /point id= user_point= user_id=
 created= modified= /shout id=4 content=dimana yah shout 5
 user_id=1 created=2009-06-14 23:51:53 modified=2009-06-18
 14:00:35 //user

 did anyone know how to make this xml more friendly(costum) also with
 list view, just like :

 ?xml version=1.0 encoding=UTF-8 ?
    users
        usernametaufiq ridha/username
       avatar_face1/avatar_face
       avatar_hair2/avatar_hair
       /* and so on */
    /users
 /xml

 thanks for advice guys, and sorry for this basic questions

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



Re: Router Connect

2009-06-19 Thread Adam Royle

Look into admin routing in the cakephp cookbook.

Cheers,
Adam

On Jun 19, 12:44 pm, thatsgreat2345 thatsgreat2...@gmail.com wrote:
 I'm a little confused by routes at the moment. Currently I have an
 admin structure where each function such as
 function users($load = null, $id = null) {
     $this-viewPath = 'admins/users';
                 switch ($load) {
                         Case 'add':

                         $this-render('add');
                         break;

 Changing the viewpath each time, and adding in the render is annoying.
 I'm curious if there is any way to fix this with routes, as the url
 would look like /admins/users/add/ but after searching can't seem to
 see how to do this.

 I was thinking that maybe I could create some sort of beforeFilter and
 have it do it then except I think routers would be a better fit.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic use of MySQL views

2009-06-19 Thread Adam Royle

Does this work?

$this-Item-setSource($locationId.'_items');

Cheers,
Adam

On Jun 19, 12:43 pm, VisionIzoizo mauro.tr...@googlemail.com wrote:
 Hi, I have one big table named 'items'. It's split into many views,
 according to a custom defined criteria (location). I want to access
 these views dynamically, I tried the 'useTable' property, but it
 doesn't work at all. This is my controller action:

         function listLocation($locationId)
         {
                 $this-Item-useTable = $locationId.'_items';
                 $this-Item-recursive = 0;
                 $this-set('items', $this-paginate());
         }

 My views are named according to the location Id, i.e. 1_items,
 2_items, ...

 Is there any way to make this work?

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



Re: Flash site With Cake Php

2009-06-19 Thread taufiq ridha

Hi guys thanks for all the answer, and that's worked :D

my next questions, how i can get this xml with output costum, let's
say i dont wanna fetch all the variable, like i just wanna fetch user
with some attribute not all,
because for now, it still fetch all data and all relations with user
table, see :

/* i just wanna fetch username and email*/
user
 usernametaufiqridha/username
 emailtau...@gmail.com/email
/user

anyway paulos, where i can put this code :D, remembering i'm very new
on this, can u give me more details :D

thanks for all guys, it's very helped me out

cheers

On Jun 19, 1:16 pm, Adam Royle a...@sleekgeek.com.au wrote:
 Put this in app/views/users/xml/index.ctp

 ?php
 echo 'users';
 echo $xml-serialize($users, array('format' = 'tags'));
 echo '/users';
 ?

 and put this in app/views/layouts/xml/default.ctp

 ?php
 echo $xml-header();
 echo $content_for_layout;
 ?

 XML it doesn't show as XML in your browser if debug is set to 2,
 because RequestHandler won't output the necessary headers. If that's
 the case, add this in your AppController's beforeFilter() to override
 this behaviour:

 if (!empty($this-params['url']['ext'])  $this-params['url']['ext']
 == 'xml'  Configure::read('debug')  0) {
     Configure::write('debug', 1);

 }

 And then it should all work!

 Cheers,
 Adam

 On Jun 19, 4:43 am, taufiq ridha taufiq.ri...@gmail.com wrote:



  Hello, nice to meet u all!!
  sorry for this stupid question, but i'm really new on this framework.
  i was try to search for this subject, but not find yet, so i decided
  to ask for all guru's here :)

  i want to build flash site, which cake php will provide xml for my
  flash,

  here's what i was done to get xml :

  Routes by adding :
  Router::parseExtensions();

  on the controller :

  ?php
  class UsersController extends AppController {

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

          function index() {
                  $this-User-recursive = 0;
                  $this-set('users', $this-paginate());
          }}

  ?

  finnaly here's code for my views on views/users/xml/index.ctp

  ?php
  echo $xml-serialize($users);
  ?

  Now, when i pointing tohttp://localhost/example/users/index.xmligot
  very messy xml

  ?xml version=1.0 encoding=UTF-8 ?user id=1
  username=taufiqridha password=taufiq123
  email=taufiq.ri...@gmail.com name=Taufiq Ridha birth=2009-06-17
  sex=1 city=Jakarta phone=2147483647 avatar_face_id=1
  avatar_hair_id=1 avatar_top_id=1 avatar_bottom_id=1
  avatar_shoe_id=1 avatar_acc1_id=1 avatar_acc2_id=1 shout=ini
  shout out 2 point=0 created=2009-06-17 01:05:50
  modified=2009-06-17 01:32:07avatar_face id=1 name=Gondrong
  sex=1 path_image=http://taufiq-ridha.co.cc; created=2009-06-14
  20:14:27 modified=2009-06-14 20:14:27 /avatar_hair id=1
  name=Belah Tengah sex=1 path_image=http://taufiq-ridha.co.cc;
  created=2009-06-14 20:15:31 modified=2009-06-14 20:15:31 /avatar_top 
  id=1 name=Atasan Kurus sex=1 path_image=http://

  taufiq-ridha.co.cc created=2009-06-14 20:16:09 modified=2009-06-14
  20:16:09 /avatar_bottom id=1 name=Changcutters Style sex=1
  path_image=http://taufiq-ridha.co.cc; created=2009-06-14 20:16:35
  modified=2009-06-14 20:16:35 /avatar_shoe id=1 name=Sepatu
  Jungle sex=1 path_image=http://taufiq-ridha.co.cc;
  created=2009-06-14 20:17:38 modified=2009-06-14 20:17:38 /avatar_acc1 
  id=1 name=Gelang Punk sex=1 path_image=http://

  taufiq-ridha.co.cc created=2009-06-14 20:16:59 modified=2009-06-14
  20:16:59 /avatar_acc2 id=1 name=Topi Koboi sex=1
  path_image=http://taufiq-ridha.co.cc; created=2009-06-14 20:17:16
  modified=2009-06-14 20:17:16 /point id= user_point= user_id=
  created= modified= /shout id=4 content=dimana yah shout 5
  user_id=1 created=2009-06-14 23:51:53 modified=2009-06-18
  14:00:35 //user

  did anyone know how to make this xml more friendly(costum) also with
  list view, just like :

  ?xml version=1.0 encoding=UTF-8 ?
     users
         usernametaufiq ridha/username
        avatar_face1/avatar_face
        avatar_hair2/avatar_hair
        /* and so on */
     /users
  /xml

  thanks for advice guys, and sorry for this basic questions

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



Re: Router Connect

2009-06-19 Thread Braindead

This is the link to the corresponding chapter in the cookbook Adam
mentions:
http://book.cakephp.org/view/544/Prefix-Routing

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



Re: Date based on user's country

2009-06-19 Thread RJ

will try dat way..

Thanks for ur replies

On Jun 18, 7:24 pm, Brendon Kozlowski (Realm)
brendon...@hotmail.com wrote:
 That would depend on how you stored your users' country info.  There
 are plenty of sites out there that give data on which timezone a
 country is in, there may even be some APIs.  Using that data, you can
 compare the users' country info to determine the proper datetime of
 the user, and then either use strtotime() alongside date(), or even
 mktime() alongside date().

 There are quite a few ways (depending on the data you have, and the
 data you'll use) on how to do this.  As long as it works, I don't
 think there's technically any right way to do it, other than
 following the MVC standards as best as possible.

 On Jun 18, 2:22 am, RJ johnren...@gmail.com wrote:

  I have a site that relays mails everyday to all the users based on the
  activities in their network.
  Mails are relayed at 22:30(US time)...so any user from asian countries
  will recieve at 8:30...

  The problem i am facing is with date, when the mails are relayed, i
  put date as the subject line and hence for asian countries the date
  appears improper

  What i have is the country info of user, so based on that can i get
  the local datetime

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



Re: Flash site With Cake Php

2009-06-19 Thread paulos nikolo
I am using this block of code as i use httpSocket to get some data in xml
from a site.The $results variable contains my returned data in Xml and with
the code i gave you i cant make them appear in a simple way to check if my
request is working.

2009/6/19 taufiq ridha taufiq.ri...@gmail.com


 Hi guys thanks for all the answer, and that's worked :D

 my next questions, how i can get this xml with output costum, let's
 say i dont wanna fetch all the variable, like i just wanna fetch user
 with some attribute not all,
 because for now, it still fetch all data and all relations with user
 table, see :

 /* i just wanna fetch username and email*/
 user
  usernametaufiqridha/username
  emailtau...@gmail.com/email
 /user

 anyway paulos, where i can put this code :D, remembering i'm very new
 on this, can u give me more details :D

 thanks for all guys, it's very helped me out

 cheers

 On Jun 19, 1:16 pm, Adam Royle a...@sleekgeek.com.au wrote:
  Put this in app/views/users/xml/index.ctp
 
  ?php
  echo 'users';
  echo $xml-serialize($users, array('format' = 'tags'));
  echo '/users';
  ?
 
  and put this in app/views/layouts/xml/default.ctp
 
  ?php
  echo $xml-header();
  echo $content_for_layout;
  ?
 
  XML it doesn't show as XML in your browser if debug is set to 2,
  because RequestHandler won't output the necessary headers. If that's
  the case, add this in your AppController's beforeFilter() to override
  this behaviour:
 
  if (!empty($this-params['url']['ext'])  $this-params['url']['ext']
  == 'xml'  Configure::read('debug')  0) {
  Configure::write('debug', 1);
 
  }
 
  And then it should all work!
 
  Cheers,
  Adam
 
  On Jun 19, 4:43 am, taufiq ridha taufiq.ri...@gmail.com wrote:
 
 
 
   Hello, nice to meet u all!!
   sorry for this stupid question, but i'm really new on this framework.
   i was try to search for this subject, but not find yet, so i decided
   to ask for all guru's here :)
 
   i want to build flash site, which cake php will provide xml for my
   flash,
 
   here's what i was done to get xml :
 
   Routes by adding :
   Router::parseExtensions();
 
   on the controller :
 
   ?php
   class UsersController extends AppController {
 
   var $name = 'Users';
   var $helpers = array('Html', 'Form');
   var $components = array('RequestHandler');
 
   function index() {
   $this-User-recursive = 0;
   $this-set('users', $this-paginate());
   }}
 
   ?
 
   finnaly here's code for my views on views/users/xml/index.ctp
 
   ?php
   echo $xml-serialize($users);
   ?
 
   Now, when i pointing tohttp://localhost/example/users/index.xmligot
   very messy xml
 
   ?xml version=1.0 encoding=UTF-8 ?user id=1
   username=taufiqridha password=taufiq123
   email=taufiq.ri...@gmail.com name=Taufiq Ridha birth=2009-06-17
   sex=1 city=Jakarta phone=2147483647 avatar_face_id=1
   avatar_hair_id=1 avatar_top_id=1 avatar_bottom_id=1
   avatar_shoe_id=1 avatar_acc1_id=1 avatar_acc2_id=1 shout=ini
   shout out 2 point=0 created=2009-06-17 01:05:50
   modified=2009-06-17 01:32:07avatar_face id=1 name=Gondrong
   sex=1 path_image=http://taufiq-ridha.co.cc; created=2009-06-14
   20:14:27 modified=2009-06-14 20:14:27 /avatar_hair id=1
   name=Belah Tengah sex=1 path_image=http://taufiq-ridha.co.cc;
   created=2009-06-14 20:15:31 modified=2009-06-14 20:15:31
 /avatar_top id=1 name=Atasan Kurus sex=1 path_image=http://
 
   taufiq-ridha.co.cc created=2009-06-14 20:16:09 modified=2009-06-14
   20:16:09 /avatar_bottom id=1 name=Changcutters Style sex=1
   path_image=http://taufiq-ridha.co.cc; created=2009-06-14 20:16:35
   modified=2009-06-14 20:16:35 /avatar_shoe id=1 name=Sepatu
   Jungle sex=1 path_image=http://taufiq-ridha.co.cc;
   created=2009-06-14 20:17:38 modified=2009-06-14 20:17:38
 /avatar_acc1 id=1 name=Gelang Punk sex=1 path_image=http://
 
   taufiq-ridha.co.cc created=2009-06-14 20:16:59 modified=2009-06-14
   20:16:59 /avatar_acc2 id=1 name=Topi Koboi sex=1
   path_image=http://taufiq-ridha.co.cc; created=2009-06-14 20:17:16
   modified=2009-06-14 20:17:16 /point id= user_point= user_id=
   created= modified= /shout id=4 content=dimana yah shout 5
   user_id=1 created=2009-06-14 23:51:53 modified=2009-06-18
   14:00:35 //user
 
   did anyone know how to make this xml more friendly(costum) also with
   list view, just like :
 
   ?xml version=1.0 encoding=UTF-8 ?
  users
  usernametaufiq ridha/username
 avatar_face1/avatar_face
 avatar_hair2/avatar_hair
 /* and so on */
  /users
   /xml
 
   thanks for advice guys, and sorry for this basic questions
 
   regards
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this 

Re: The sort function can not work if I enable element cache

2009-06-19 Thread Jon Bennett

Hi Joshua,

 Thanks your reply!  Is that means if we want to use the sort or paginate
 function , we shouldn't use the view cache feature in our application? I
 want to know what you will do if you want to improve your application
 performance? Is there any friends who use the view cache feature in your
 application ?

You can still use caching, but not on the view, although you could
create an element for each alternative sort, eg:

/elements/tables/data_name_asc
/elements/tables/data_name_desc
/elements/tables/data_created_desc

I'd have thought that was pretty inefficient though, and certainly
doesn't scale well! I would cache the data returned by paginate.
You'll need to cache each dataset, eg, for every change of sort and
direction, but the element can stay the same. Something like:

// Cache name - just a simple example
$cacheName = $this-name.'_'.$this-action.'_'.join('-',
$this-paginate[$this-modelClass]);

// Look for cached data
if (($this-data = Cache::read($cacheName) === false)
{
// Didn't find any so get data
$this-data = $this-paginate($this-modelClass, $conditions);
// write to cache
Cache::write($cacheName, $this-data);
}

hth

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



Re: app attempting to insert records rather than update

2009-06-19 Thread Mauricio Morales

What get you printed out doing a print_r($data) just before the: if
($this-Merit-save($this-data)) {return true;}  ?

What if you save the ID manually into $this-data ?

$this-data['Application']['id'] = yourIDFromYourSession();
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Trouble with Ajax and Session

2009-06-19 Thread Roland Bock

Hi,

not sure if the original post ever made it past the moderators.

Anyway, the problem seems to be fixed now, after upgrading from the 
cake-version provided by Ubuntu-8.04 (1.2.0.5875~prebeta) to cake 1.2.3.

Regards,

Roland

Roland B wrote:
 Hi,
 
 I have a web application using cakephp-1.2 and jQuery-1.2.6.. Ajax
 calls are
 being made to dynamically fetch more data from cake. My problem is
 that the
 ajax requests invalidate the current session if Security.level is set
 to
 high. It works fine with medium.
 
 After searching the web for similar cases (there seem to be a lot, but
 I
 found no fitting solution), I assume that it is related to the session
 cookie. So I looked via LifeHttpHeaders what happens:
 
 The page itself is accompanied by the following cookies:
 REQUEST:
 [...]
 Cookie: EHE=207b97c1c992e56e2ccb89534b902f12
 
 RESPONSE:
 HTTP/1.x 200 OK
 Date: Tue, 16 Jun 2009 09:13:34 GMT
 Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch
 mod_ssl/2.2.8 OpenSSL/0.9.8g
 X-Powered-By: PHP/5.2.4-2ubuntu5.6
 Set-Cookie: EHE=deleted; expires=Mon, 16-Jun-2008 09:13:33 GMT; path=/
 Set-Cookie: EHE=74053fa83ebcd69a28830c3cdc1a87f8; path=/
 Set-Cookie: EHE=207b97c1c992e56e2ccb89534b902f12; path=/
 Set-Cookie: EHE=74053fa83ebcd69a28830c3cdc1a87f8; path=/
 
 While building, the page, an ajax request is fired:
 REQUEST:
 [...]
 Cookie: EHE=74053fa83ebcd69a28830c3cdc1a87f8
 
 RESPONSE:
 HTTP/1.x 302 Found
 Date: Tue, 16 Jun 2009 09:13:35 GMT
 Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch
 mod_ssl/2.2.8 OpenSSL/0.9.8g
 X-Powered-By: PHP/5.2.4-2ubuntu5.6
 Set-Cookie: EHE=deleted; expires=Mon, 16-Jun-2008 09:13:34 GMT; path=/
 Set-Cookie: EHE=cc062e4139634958cf0e874faf2bc573; path=/
 Set-Cookie: EHE=74053fa83ebcd69a28830c3cdc1a87f8; path=/
 Set-Cookie: EHE=cc062e4139634958cf0e874faf2bc573; path=/
 
 The redirect is sending Ajax to the login page.
 
 The cookie's name is defined in core.php:
 Configure::write('Session.cookie', 'EHE');
 
 I wonder two things:
 
 a) if Ajax sends the right cookie, why does it get the login page?
 b) why is the session cookie being sent 4 times per request?
 
 Any idea how to fix the Ajax/session problem?
 
 Thank you very much in advance,
 
 Roland
 
  

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



Re: form validation using model

2009-06-19 Thread puneet sharma
Hello everyone,

this problem has been solved,



On Thu, Jun 18, 2009 at 8:51 AM, puneetratan puneets...@gmail.com wrote:

 Hello everyone,
 i am placing validations using model with the following syntx, can
 anyone tell me where i am wrong, bcoz validations are not coming.

 var $validate = array(
'first_name' = array(
'rule' = 'alphaNumericDashUnderscore',
'message' = 'First Name must be character value'
)

);


 function alphaNumericDashUnderscore($data) {
// $data array is passed using the form field name as the
 key
// have to extract the value to make the function generic
$value = array_values($data);
$value = $value[0];
return preg_match('|^[a-zA-Z-]*$|', $value);
}


 and one more thing, that when i use $form-input then validations
 appears but when i use $form-text then validations does not appear,

 syntx is following

 echo $form-input('User.first_name', array('div' = array('id' =
 'mainDiv', 'title' = 'Div Title', 'style' =
 'display:block;float:left'),'size'='25'));

 echo $form-text('User.first_name');


 plz response me asap..

 Thanks
 Puneet

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



Re: 301 Redirect with Server Webroot Setup

2009-06-19 Thread Wouter de Boer

You have to do this in /app/config/bootstrap.php

something like:
if($_SERVER[REQUEST_URI]==$oldurl){
header(HTTP/1.1 301 Moved Permanently);
header(Location: . $newurl);
exit();
}


On Jun 17, 6:17 pm, jabocs ja...@jnjhardy.com wrote:
 Any help please?

 I'm trying to give my CMS users the ability to declare a custom URL
 301 redirects to a new page in their new websites.

 Basically, I want to have a Table in my MySQL table that contains
 OldURL and NewURL ...

 I would like to be able to compare a URL inside of CakePHP before it
 actually tries to process it.

 In other words if somebody types inhttp://www.mydomain.com/test/gravy.html
 ... that it can look at the URL and compare it to the OldURL fields in
 my new table...

 If I find a match, then send it to a controller that takes that URL
 and creates a 301 redirect header to the NewURL field of the table.

 I thought about maybe beforeFilter but that's too far in at that point
 after it errors out... are there any beforeSomething that I'm not
 aware of?

 Any thoughts?

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



Pagiate contain

2009-06-19 Thread Dave Maharaj :: WidePixels.com
I have a search function built based off the hoc_joins tutorial by Nate
inthe Bakery.
 
Now the search runs fine searching thru 2 associated HABTM tables matching
up items the user selects.
 
My last line is :
$data = $this-paginate('Post', array('Post.id' = $posts));
 
but that is pulling model data unrelated to the search (its running a query
everywhere a Post.id matches any table found inthe db, hasOne, hasMany,
HABTM)
 
How can I cut out models from being queried with contain in pagination?
 
Tried a few ways but nothing
 
 
 
Dave
 

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



Re: Pagiate contain

2009-06-19 Thread Mike Karthauser


On Fri, June 19, 2009 1:24 pm, Dave Maharaj :: WidePixels.com wrote:
 I have a search function built based off the hoc_joins tutorial by Nate
 inthe Bakery.

 Now the search runs fine searching thru 2 associated HABTM tables matching
 up items the user selects.

 My last line is :
 $data = $this-paginate('Post', array('Post.id' = $posts));

 but that is pulling model data unrelated to the search (its running a
 query
 everywhere a Post.id matches any table found inthe db, hasOne, hasMany,
 HABTM)

 How can I cut out models from being queried with contain in pagination?

 Tried a few ways but nothing

$this-paginate['contain'] = array() ;




-- 
Mike Karthauser
Managing Director - Brightstorm Ltd

Email: mi...@brightstorm.co.uk
Web: http://www.brightstorm.co.uk
Tel:  07939 252144 (mobile)
Fax: 0870 1320560

Address: 1 Brewery Court, North Street, Bristol, BS3 1JS


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



RE: Pagiate contain

2009-06-19 Thread Dave Maharaj :: WidePixels.com
Sorry to bother.
got it after all.
 
 
 var $paginate = array(
'limit' =10,
'contain' = array(...
.
.
)))
);
 
Dave

  _  

From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com] 
Sent: June-19-09 9:55 AM
To: cake-php@googlegroups.com
Subject: Pagiate contain


I have a search function built based off the hoc_joins tutorial by Nate
inthe Bakery.
 
Now the search runs fine searching thru 2 associated HABTM tables matching
up items the user selects.
 
My last line is :
$data = $this-paginate('Post', array('Post.id' = $posts));
 
but that is pulling model data unrelated to the search (its running a query
everywhere a Post.id matches any table found inthe db, hasOne, hasMany,
HABTM)
 
How can I cut out models from being queried with contain in pagination?
 
Tried a few ways but nothing
 
 
 
Dave
 




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



Bootstrap variable

2009-06-19 Thread bhushan A

I have problem in accessing variable which is set in config/
bootstrap.php. I have set 2 variables using Configure::write(). I can
access  one variable in views/ folder but unable to get other in views
folder .. it giving
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Global Variable

2009-06-19 Thread Anand

Hello All,

How to define a global variable in CakePHP which i can use anywhere in
the application.

Please provide a code sample.

Waiting for reply

Anand

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



Bootstrap variable

2009-06-19 Thread bhushan A

I have problem in accessing variable which is set in config/
bootstrap.php. I have set 2 variables using Configure::write(). I can
access  one variable in views/ folder but unable to get other in views
folder .. it giving  Notice (8) . Undefined Variable error.

Can you please suggest, what can be the issue. Waiting for your
replies.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Bootstrap variable

2009-06-19 Thread Stu

Well, it seems that your variable isn't defined.

Could you print your bootstar code along with how you're reading your
variables in the view?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Bootstrap variable

2009-06-19 Thread Stu

Well, it seems that your variable isn't defined.

Could you post your bootstrap code along with how you're reading your
variables in the view?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Global Variable

2009-06-19 Thread Rick

You can write a new config value or you can define a variable or
constant in bootstrap.php.

Rick



On Jun 19, 8:42 am, Anand anandprakashwankh...@gmail.com wrote:
 Hello All,

 How to define a global variable in CakePHP which i can use anywhere in
 the application.

 Please provide a code sample.

 Waiting for reply

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



Re: FormHelper - $form-inputs() - $validate

2009-06-19 Thread Rick

You do all of this through the option array in the $form-input call.
For example to turn off the label you add 'label' = false.  There
are a lot of options so you should read the manual section.

Rick


On Jun 18, 6:40 pm, tpynegar tpyne...@hotmail.com wrote:
 Hi,

 I'm trying to put a form together using this tutorial

 http://snook.ca/archives/cakephp/contact_form_cakephp/

 where basically you put together a form and error messages etc from
 the
 model's $validate member.

 This is all working however i was wondering how to format the
 resulting form
 as in resize the text area's and to add line breaks after the elements
 title and
 also how to remove the New Contact from the top of the form
 elements.
 Basically how do i control the formating of the

 $form-inputs()

 command.

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



Re: Poll: what do you hate about CakePHP?

2009-06-19 Thread bato

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



Re: cron job question..

2009-06-19 Thread Rick

Chris,

I'm not sure what the objective of the cron job is but this curl
command

curl -s -o /dev/null http://www.domain.com/daemons/nicebook

won't output anything since it has the output (-o) going to the null
device.

To see what will result normally then do the curl -o some file
http://www.domain.com/daemons/nicebook;

I add the double quotes around the URL just to be safe.

Rick




On Jun 16, 2:16 am, internetchris internetchr...@gmail.com wrote:
 Hey everyone,

 Forgive me if I sound like an idiot. I haven't setup a cron job in the
 past and I feel I am either missing files or I simply don't
 understand. For a school project a friend of mine is trying to setup a
 web application(written in cake php). I'm trying to give him a hand,
 but I'm not familiar with cron jobs. After he downloaded it, it had
 instructions to setup a cron job. When I setup the cron job I provide
 this for the path...

 curl -s -o /dev/nullhttp://www.domain.com/daemons/nicebook

 I have noticed in the files that there isn't a directory called
 daemons and I can't follow this path to anywhere? In setting up a
 cron job I would think that the location in the above URL would
 contain some sort of script file. I have the cron job set to e-mail
 me, but I haven't recieved any e-mails. Am I right in my assumptions,
 or am I misunderstanding something?

 Any help would be appreciated.

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



Re: tableCells and bgcolor doesn't work for me

2009-06-19 Thread Rick

Looking at the docs for $html-tableCells the call is expecting all of
the table rows in one call.  (How else could it keep up with alternate
row counts?)  From the manual:

echo $html-tableCells(array(
array('Jul 7th, 2007', 'Best Brownies', 'Yes'), // row 1
array('Jun 21st, 2007', 'Smart Cookies', 'Yes'),// row 2
array('Aug 1st, 2006', 'Anti-Java Cake', 'No'), // row 3
));

For your array something like this should work:

table
?=
echo $html-tableCells($autors, array ('bgcolor'='#FFCC99'));
?
/table


On Jun 18, 11:28 am, nsens...@hotmail.com nsens...@hotmail.com
wrote:
 Hi, new at cakephp, so I'm trying with some tutorials, but using
 tablecells doesn't work with bgcolor, I get the table with rows and
 data but all rows are white, I mean odds and even rows are in same
 color, what I'm doing wrong?

 table
 ?php foreach($autors as $row) {
 echo $html-tableCells( array (  $row['Autor']['id'],
                                  $row['Autor']['nombre'],
                                  $row['Autor']['apellido'],
                                  $row['Autor']['fecha_nacimiento'],
                                  $row['Autor']['fecha_defuncion'] ) ,

                                  array ('bgcolor'='#FFCC99'));}
 ?
 /table
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Using external server like static server (for image,css,js and file uploaded by user )

2009-06-19 Thread marco.rizze...@gmail.com

Hi
For improve performance  I think to  use an external server like
static server (with lighttpd) to provide static content like
image,css, js and so the file uploaded by user.
I would ask if someone has experience about this and how he has
configured CAKE to do this?

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



Re: Using external server like static server (for image,css,js and file uploaded by user )

2009-06-19 Thread AD7six



On Jun 19, 3:47 pm, marco.rizze...@gmail.com
marco.rizze...@gmail.com wrote:
 Hi
 For improve performance  I think to  use an external server like
 static server (with lighttpd) to provide static content like
 image,css, js and so the file uploaded by user.
 I would ask if someone has experience about this and how he has
 configured CAKE to do this?

Do you want that to apply to absolutely any and all assets?

If so you could do something like this (could also do it in controller
afterFilter, or a helper after render):
http://trac.assembla.com/mi/browser/branches/base/controllers/components/swiss_army.php#L442

Otherwise, you'd put some logic in your app helper url method (or any
other function common to the bits you want to modify) to inject the
host you want

hth

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



Re: How to calculate the difference of date between 2 different rows?

2009-06-19 Thread Brendon Kozlowski (Realm)

These links should contain all the reading material needed to solve
your problem:
http://book.cakephp.org/view/73/Retrieving-Your-Data
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html
(assuming you're using MySQL)
http://teknoid.wordpress.com/2008/09/29/dealing-with-calculated-fields-in-cakephps-find/
(because it'd be a calculated field)

Enjoy.  ;)

On Jun 18, 11:08 pm, keanoppy keano0...@gmail.com wrote:
 any query to capture the date values of two different rows?

 On Jun 19, 10:46 am, stefano ssalvat...@gmail.com wrote:



  try with mktime()

  mktime(5/6/2009) - mktime(3/6/2009)

  maybe :P

  On Thu, Jun 18, 2009 at 9:26 PM, keanoppykeano0...@gmail.com wrote:

   let say this database of mine got 2 columns, 1 is planned date,another
   is actual date.
   at the first row, the planned date is 3/6/2009 and actual is 4/6/2009
   at the second row, they are 5/6/2009 and 10/6/2009 respectively
   how can i create a view to determine the duration between the two
   dates between rows respectively?
   as in planned duration:5/6/2009 - 3/6/2009 and actual duration is
   10/6/2009 - 4/6/2009

  --
  Stefano Salvatori M.http://stefano.salvatori.cl/- Hide quoted text -

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



Re: how tho show files with cakephp?

2009-06-19 Thread Ricky Paz

I've not understood. If I do that, how can i show the file's content
inside browser like youtube or amazon?

On 18 jun, 04:22, Kyo ready2jam2n...@gmail.com wrote:
 If you set everything up with CakePHP correctly, all you need to do is
 place the files into your webroot folder (I think the app/webroot/
 files folder is suitable for you needs).

 hth,

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



Re: Using external server like static server (for image,css,js and file uploaded by user )

2009-06-19 Thread byqsri

Many thanks for your response.

 Do you want that to apply to absolutely any and all assets?

I would use this for all css, all js , all static image , all swf and
all static content.
No link , no form action etc.


 If so you could do something like this (could also do it in controller
 afterFilter, or a helper after 
 render):http://trac.assembla.com/mi/browser/branches/base/controllers/compone...

I try this solution and it works fine for js and images for css I must
change the regular expression but It's exaclty what I'm searching.

Relative to files uploaded by users.
I would also upload them on static server but I would keep the
possibility to control the access to them (like Media View).
Is it possible to do a thing like this or I am crazy?

About this do you know if exists a behaviour for upload that allows me
to uploaad file on an external server?

Many Thanks

Marco
 Otherwise, you'd put some logic in your app helper url method (or any
 other function common to the bits you want to modify) to inject the
 host you want

 hth

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



Re: form validation using model

2009-06-19 Thread Marcelo Andrade

On Thu, Jun 18, 2009 at 12:21 AM, puneetratanpuneets...@gmail.com wrote:
 (..)

 and one more thing, that when i use $form-input then validations
 appears but when i use $form-text then validations does not appear,

I see you solved it.  But just for reference, $form-text
doesn't provide validation messages.  So you have to
put $form-error() near it.

Best regards.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105

http://mfandrade.wordpress.com

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



Re: Poll: what do you hate about CakePHP?

2009-06-19 Thread Marcelo Andrade

On Fri, Jun 19, 2009 at 10:02 AM, batobat...@gmail.com wrote:

 No PHP4 support!!

My two cents:

- Prototype-based ajax.  (jQuery is my js framework of choice.)
- $ajax-div and $ajax-divEnd is boring
- poor sqlite3 support

Atenciosamente.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105

http://mfandrade.wordpress.com

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



How to to something after successful login (like callback) ?

2009-06-19 Thread u2ix

Hello

I want to update a field in database (loginCount) after successful
login.
But I found now way where to insert this action, without to make a
redirect, as a callback or similar.
If I insert it in Users/login it will only be executed on getting the
login page, as I see?

How can I do this?

Thanks for help

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



What debug/IDE do you use?

2009-06-19 Thread kdubya

What development environment/debugger do you use when developing
CakePHP apps? Have you used others? What do like/dislike about the one
you use?

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



Re: app attempting to insert records rather than update

2009-06-19 Thread brian

On Fri, Jun 19, 2009 at 2:04 AM, Jon Chinj...@boogly.net wrote:

 Thanks for the tip.  Sadly, I'm still having problems with it.  When I
 add ?=$form-input('id');? to the view, all it does is generate input
 type=hidden name=data[Application][id] value= id=ApplicationId
 / which doesn't change anything in my controller when I print the
 contents of $this-data.  I also tried making the field called
 application_id in the form, but it didn't have an effect either.

 It's really stumping me.  Any idea what's going on?  Since my primary
 key on Merit is application_id, should Cake already know that if I'm
 trying to set $this-Merit-id?


The PK for Merit should be id, not application_id. That should be
a foreign key pointing to applications table.

If you post the code for the controller action we might be able to sort it out.

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



Re: how tho show files with cakephp?

2009-06-19 Thread brian

Just link to them. If you need them to be inside your interface, you
could have them load inside of an iframe. Though, keep in mind that
not all browsers come equipped to view MSWord files or PDFs. The text
files, certainly, you could read with, eg. PHP, and display the text.

On Fri, Jun 19, 2009 at 11:08 AM, Ricky Pazricky...@gmail.com wrote:

 I've not understood. If I do that, how can i show the file's content
 inside browser like youtube or amazon?

 On 18 jun, 04:22, Kyo ready2jam2n...@gmail.com wrote:
 If you set everything up with CakePHP correctly, all you need to do is
 place the files into your webroot folder (I think the app/webroot/
 files folder is suitable for you needs).

 hth,

 Kyo
 


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



Re: How to to something after successful login (like callback) ?

2009-06-19 Thread brian

On Fri, Jun 19, 2009 at 11:12 AM, u2ixdemian.gempe...@gmail.com wrote:

 Hello

 I want to update a field in database (loginCount) after successful
 login.
 But I found now way where to insert this action, without to make a
 redirect, as a callback or similar.
 If I insert it in Users/login it will only be executed on getting the
 login page, as I see?


You should be able to do this inside login(). Can you post your code?

I'm doing something similar, except that the logins are saved to a
separate table. This way, I can keep a record of dates/times.

CREATE TABLE IF NOT EXISTS logins
(
id INT(10) UNSIGNED NOT NULL auto_increment PRIMARY KEY,
created DATETIME DEFAULT NULL,
user_id INT(10) UNSIGNED NOT NULL,

FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE
)
ENGINE=MyISAM

class Login extends AppModel
{
public $belongsTo = array('User');
}

public $hasMany = array(
'Login' = array(
'className' = 'Login',
'foreignKey' = 'user_id',
'dependent' = true
)
);

UsersController:

// this is the stripped-down version

public function login()
{
if ($user = $this-Auth-user())
{
$this-User-Login-create();
$this-User-Login-save(
array(
'Login' = array(
'user_id' = $user['User']['id']
)
)
);
}
}

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



Fixtures importing table definitions

2009-06-19 Thread Fran Iglesias

Hi,

I'm trying to convert my fixtures files to impor table definitions  
from database, following

http://book.cakephp.org/view/358/Preparing-test-data#Importing-table-information-and-records-361

but it doesn't work. (Missing table errors), both using model or table.

I'm working in a plugin (I don't know if this is important)

I'm using last stable.

Any idea?

---
Fran Iglesias cakephpi...@gmail.com
http://cakephpilia.blogspot.com


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



Invitation to connect on LinkedIn

2009-06-19 Thread Sayed Raianul Kabir
LinkedIn


Sayed Raianul Kabir requested to add you as a connection on LinkedIn:
--

Ivan,

I'd like to add you to my professional network on LinkedIn.

- Sayed Raianul

View invitation from Sayed Raianul Kabir
http://www.linkedin.com/e/VJ7cD2gl3XbYAmrUVF7-QJqlex0y32CC2drixBr/blk/1260486990_2/0OnP0VejoUd30Scz4LqnpPbOYWrSlI/svi/
 
--

DID YOU KNOW you can conduct a more credible and powerful reference check using 
LinkedIn? Enter the company name and years of employment or the prospective 
employee to find their colleagues that are also in your network. This provides 
you with a more balanced set of feedback to evaluate that new hire.
http://www.linkedin.com/e/rsr/inv-27/

 
--
(c) 2009, LinkedIn Corporation


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



fields param throws error

2009-06-19 Thread thatsgreat2345

I have a type that hasmany category, category has man subcategory, and
subcategory hasmany product, and all my belongsto are set as well to
the parent above, and all tables have proper foreign_ids.

My controller uses , Type. Which when I run

debug($this-Type-find('all',array(

'recursive'=2,

'fields'=array('Type.id',

'Type.name',

'Category.id',

'Category.name'

)

)
)
);

It works if I remove fields, and just grab them with find all but when
I add in the Category.id and Category.name
it throws
SELECT `Type`.`id`, `Type`.`name`, `Category`.`id` FROM `types` AS
`Type`   WHERE 1 = 1

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



Help With Join

2009-06-19 Thread Dave Maharaj :: WidePixels.com

I have a search query thats throwing a 1054: Unknown column ' Program.id' in
'on clause'

This is the query :

SELECT DISTINCT (`Job`.`id`) 

as id FROM `jobs` AS `Job` inner JOIN

 jobs_programs AS `JobsProgram` ON 

(`JobsProgram`.`job_id` = `Job`.`id`)
 
inner JOIN programs AS `Program` ON 

(`Program`.`id` = `JobsProgram`.`program_id` 

AND ` Program`.`id` IN ('1', '31')) inner JOIN 

jobs_languages AS `JobsLanguage` ON 

(`JobsLanguage`.`job_id` = `Job`.`id`) inner JOIN 

languages AS `Language` ON (`Language`.`id` = `JobsLanguage`.`language_id`
AND 

`Language`.`id` = ('13')) WHERE 1 = 1

The HABTM tables are standard

programs:
Id
Name

languages:
Id
Name

jobs_languages
id
job_id
language_id

Jobs_programs
id
job_id
program_id

Anyone see where the error could be?

 
Dave Maharaj
Freelance Designer
d...@widepixels.com
www.widepixels.com


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



Get related data from HABTM

2009-06-19 Thread Mateo San Román

Hello,

I have two models: Stores and Warehouse, with a HABTM relationship
between them.
Now, I want to get the warehouses related to a certain Store.


(in other model)

$warehouses = $this-Warehouse-find('all', array('contain' =
'Store'));

This returns all the warehouses trimmed down at the store level

If I do:

$warehouses = $this-Warehouse-find('all', array('contain' = array(
'Store' = array ('conditions' = array(
'Store.id' = $storeid);


It still returns every warehouse, even some empty ones at the Store
level.

btw, using mssql

Thanks in advance

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



Re: FormHelper - $form-inputs() - $validate

2009-06-19 Thread tpynegar

Hey Rick,

Thanks for the reply, i've found another similar tutorials

http://php.dzone.com/news/cakephp-12-creating-a-contact-

The issue is that i'd like to use the _schema as defined by the model
and then call

echo $form-inputs();

What i'm trying to achieve is when a validation fail's i'd like the
error message to come underneath the form element. As in i can
setup the form using

$form-input

but i didn't get the error message when one of the validation's failed
unless i outputted it myself.

Thanks,
Tim.

On Jun 19, 1:57 pm, Rick will...@gmail.com wrote:
 You do all of this through the option array in the $form-input call.
 For example to turn off the label you add 'label' = false.  There
 are a lot of options so you should read the manual section.

 Rick

 On Jun 18, 6:40 pm, tpynegar tpyne...@hotmail.com wrote:



  Hi,

  I'm trying to put a form together using this tutorial

 http://snook.ca/archives/cakephp/contact_form_cakephp/

  where basically you put together a form and error messages etc from
  the
  model's $validate member.

  This is all working however i was wondering how to format the
  resulting form
  as in resize the text area's and to add line breaks after the elements
  title and
  also how to remove the New Contact from the top of the form
  elements.
  Basically how do i control the formating of the

  $form-inputs()

  command.

  Thanks,
  Tim.- Hide quoted text -

 - Show quoted text -

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



automatically adding a

2009-06-19 Thread lefty

how to automatically create() a thingy :)  in another model  ?

Say you have 2 model classes, 'first'  'second', where the first
hasmany of the second.
BUT the first has to have at least one of the second - right from the
start !
How do you implement that ?

maybe can you add that somehow using as a basis the following code -
as simple as possible! :):)  ??  :

class First extends AppModel {
var $name = 'First';
var $hasmany = array('Second');
}
class second extends AppModel {
var $name = 'Second';
var $belongsto = array('First');
}

class FirstsController extends AppController {

var $name = 'Firsts';

function add() {
if (!empty($this-data)) {
if ($this-First-save($this-data)) {
$this-Session-setFlash('Your First has been saved. 
and the 'first
of the second' created :) ');
$this-redirect(array('action' = 'index'));
}
}
}

class SecondController .
naturally each where they belong.
many thx

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



Re: Using external server like static server (for image,css,js and file uploaded by user )

2009-06-19 Thread j-rod

Marco,

For publishing to an external server I have and would use LFTP or
rsync commands that are called once the file upload completes. You can
fork off the update script to the background and keep going. As for
restricting access beyond that you could create a proxy script that
looks for the session cookie and verifies it against a user account.
You would then need your cookie domains to be *.domain.com so that it
would work for your www.domain.com and images.domain.com.

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



Ajax question -- Updating multiple divs

2009-06-19 Thread Nancy

Ok, I've got one select list that needs to drive the contents of two
other select boxes.  I understand how to use observeField and
apparently I can update multiple divs.  My question is, do I have to
do it from only one controller action or can more than one controller
be used?  It's just weird because the data comes from two different
tables and you wouldn't ordinarily access from the same controller.

Here's my current Ajax calls:

echo $ajax-observeField('DeviceDgtypeId', array(
'url' = '/subtypelists/getSubtypelists',
'update' = 'DeviceSubtypelistId',
)
);
echo $ajax-observeField('DeviceDgtypeId', array(
'url' = '/cells/getCellsByDgid',
'update' = 'DeviceCellId',
)
);

So... in a perfect world I'd probably want to do this:
echo $ajax-observeField('DeviceDgtypeId', array(
'url' = array('/cells/getCellsByDgid', /subtypelists/
getSubtypelists),
'update' = array('DeviceCellId',DeviceSubtypelistId),
)
);

But that doesn't seem to work.  So I'm assuming it has to come from
one controller.

So if I have to return two sets of data from one controller, how do I
render it so that the observeField knows which data goes to which div?

I'm so confused!

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



Re: Cakephp 1.2 + swfupload

2009-06-19 Thread rod

I'm sure you can find something on this group:
http://groups.google.com/group/cake-php/search?group=cake-phpq=swfuploadqt_g=Search+this+group
or at swfupload website: http://swfupload.org/search/node/cakeph

I've been using a similar one, Uploadify: www.uploadify.com

On Jun 18, 1:38 pm, Bryan Paddock bryanpadd...@gmail.com wrote:
 Hey guys,
 I've been sitting with this swfupload module for days and just cant seem to
 get it right.

 In my js to create the uploader i have this setting:

 upload_url: /properties/uploadvideo,

 and I have my function uploadvideo() in my properties controller

 I've done some simple debugging like so:

 $fp = fopen('/tmp/debug', 'w');
 fwrite($fp, print_r($this-params['form'], true));
 fclose($fp);

 swfupload successfully sends the file to the server althought all that finds
 its way to the debug file is array()

 cakephp is not handling the file upload...

 any ideas? has anyone here got it working successfully?

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



NOOB Apache question...

2009-06-19 Thread Kronprinz

I managed to get Apache installed and running on my windows xp machine
and pasted the Cake files in the proper directory.

On part 3.2.2 (http://book.cakephp.org/view/31/Permissions) of the
Cookbook, they say to set the permissions for your /app/tmp folder.
How do I do that locally in XP?


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



How do you configure CakePHP for Plesk? I get Internal Server Error

2009-06-19 Thread AmityWeb


HI

I developed an app on my local machine (Vista) and it worked fine. I then
uploaded it to my Linux with Cpanel/WHM and it worked fine (after changing
RewriteBase to the new URL), but when I uploaded it to the clients Plesk
server (with 1and1) I get an Internal Server Error 500 whenever .htaccess is
used in the root httdocs/ folder. I have changed RewriteBase accordingley.
ModRewrite is enabled as I tested it with a test script. 

error_log is not storing the errors from the internal server error. 

So I cannot for the life of me figure out what the issue is, I have searched
loads of forums for this issue, but none of them solve it. 

Thanks
-- 
View this message in context: 
http://www.nabble.com/How-do-you-configure-CakePHP-for-Plesk--I-get-Internal-Server-Error-tp24120764p24120764.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Re: NOOB Apache question...

2009-06-19 Thread Marcelo Andrade

On Fri, Jun 19, 2009 at 9:28 PM, Kronprinzxrsfors...@hotmail.com wrote:

 I managed to get Apache installed and running on my windows xp machine
 and pasted the Cake files in the proper directory.

 On part 3.2.2 (http://book.cakephp.org/view/31/Permissions) of the
 Cookbook, they say to set the permissions for your /app/tmp folder.
 How do I do that locally in XP?

That file permissions applies just to Unix and other *nix
systems.

Best regards.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105

http://mfandrade.wordpress.com

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