Re: Route passing parameters as an action as named parameters

2010-08-17 Thread Mateo San Román
Thanks, that will work any way to put 'product_slug' on $this-
params['named']['product_slug'] ?



On 17 ago, 00:56, Andras Kende and...@kende.com wrote:
 Try somethign like:

 core/routes.php

 Router::connect('/area/:product_slug', array('controller'= 'area', 'action' 
 = 'category'), array('pass' = array('product_slug')));

 controller:

 public function category() {
         $product = $this-Area-find('first', array('recursive' = -1, 
 'conditions' =  array('Area.slug' = $this-params['product_slug'])));
         var_dump($product);

 }

 Andras Kendehttp://www.kende.com

 On Aug 17, 2010, at 1:29 AM, Mateo San Román wrote:

  Hello

  I'm trying to route an URL like this :

  /area/maize

  to this

  /area/product:maize

  Is this possible?

  Thanks in advance

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
  with their CakePHP related questions.

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

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

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


Re: Improvement suggested for the CakeTestFixture class. Keywords: $records crashes when using non-uniform columns; simpletest

2010-08-17 Thread AD7six


On Aug 16, 11:27 pm, BlueDuck holliph...@gmail.com wrote:
 It drives me absolutely batty that all the $records have to have the
 same columns or else the multiinsert fails.  

Under what circumstances do rows in the same table have a different
schema?

 Not sure if this is
 really the most optimal code here, but this change in /var/www/
 wednesdays/cake/tests/lib/cake_test_fixture.php in the insert function
 did the trick.  I'd suggest that someone do a little optimization and
 consider for the next release.

The optimization is quite simply to not apply your suggested
change :)

  Also - no need to publish this post if
 there you can route to the right place.

 Essentially, I move the multiinsert into the loop so that the field
 list for each record is used instead of the field list from just the
 last record.

     function insert($db) {
         if (!isset($this-_insert)) {
             $values = array();

             if (isset($this-records)  !empty($this-records)) {
                 foreach ($this-records as $record) {
                     $fields = array_keys($record);
                     $values[0] = '(' . implode(', ', array_map(array(
 $db, 'value'), array_values($record))) . ')';
                     $result = $db-insertMulti($this-table, $fields,
 $values);
                     if ($result === false) return false;
                 }
             }
             return true;
         }
     }


In doing that you've changed e.g. an insert with 500 items into 500
individual inserts. Here's a reference 
http://dev.mysql.com/doc/refman/5.1/en/insert.html

The why you want to do this might yield a different and more useful
bit of info.

hth,

AD

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

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


Re: Complex find neighbors query

2010-08-17 Thread AD7six


On Aug 17, 4:07 am, Josh K joshkrae...@gmail.com wrote:
 It seems like my problem is that find neighbors is ignoring 'value' =
 $id. The $id is set to 8997, but it's returning 11 and 14 and the prev
 and next options in the array.

Your conditions don't look very conditiony either

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

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


Re: How to dive into CakePHP after having worked with RoR for a while?

2010-08-17 Thread psybear83
Yeah, so I guess I'm gonna do that. Thanks ;-)

On 16 Aug., 17:55, AD7six andydawso...@gmail.com wrote:
 On Aug 16, 5:13 pm, psybear83 psybea...@gmail.com wrote:

  Hi all

  I have worked with RoR in the period of let's say 2007 to 2009... I
  didn't work as a professional with it but as a hobby, but I know quite
  something about RoR, I guess.

  I'm working for a new company now, and they are using CakePHP. So now
  I have to dive into CakePHP after knowing quite a lot already about
  RoR. So is there maybe a fast way to do that?

 well, you should start with the book.cakephp.org and do the blog
 tutorial.

  So I'm not wasting too
  much time for stuff I already know?

 skip anything you find obvious (do not simply skip the whole blog
 tutorial - it's the most important 15-30 minutes of your experience
 with cakephp). Rewind when the bit you skipped turns out to be
 different and important ;)

 AD

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

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


Re: Easy cake pagination!

2010-08-17 Thread AD7six


On Aug 16, 5:25 pm, Okalany Daniel dokala...@gmail.com wrote:
 Hi, Andy Dawson,
 i'm having a similar problem,

How similar is your sql error or code ? I find it hard to compare to
things I can't see :).

 but i don't understand your fix.

I didn't get as far as to propose a fix. However I'll give you this
hint: the book almost certainly has a relevant example and hasMany/
hasAndBelongsToMany don't generate joins in the main query - hasOnes
do.

AD

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

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


Re: Change the File Name for a Model

2010-08-17 Thread AD7six


On Aug 15, 12:13 am, sanedevil sanede...@gmail.com wrote:
 Thanks again guys!

 @AD7six, i checked the app::import, but couldn't figure out a way that
 will help me. can u pls enlighten me?

sure use the sane path: useTable ;)

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

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


Re: Strange problem with form helper...

2010-08-17 Thread Zippoxer
No that's not the problem. The Auth component is enabled.
Please what's the problem? I'm waiting two days and can't keep working
with CakePHP...

On Aug 16, 9:37 pm, Zippoxer zippo...@gmail.com wrote:
 Ohh, I think that's the problem. It looks enabled, but when I don't
 allow access to login action it still allows.
 Here's the full app_controller.php code:

 class AppController extends Controller {

     var $components = array('Auth');

     function beforeFilter() {
         parent::beforeFilter();
         $this-helpers[] = 'Menu';
         $this-Auth-userModel = 'Player';
         $this-Auth-allow('login', 'register');
         $this-Auth-fields = array(
             'username' = 'name',
             'password' = 'password'
         );
     }

 }

 On Aug 16, 9:13 pm, Miles J mileswjohn...@gmail.com wrote:



  Do you have the Auth component enabled?

  On Aug 16, 2:04 am, Zippoxer zippo...@gmail.com wrote:

   This is the form code in the view:
   ?php
       echo $form-create('Player');
       echo $form-input('name', array('label' = 'Name'));
       echo $form-input('password', array('label' = 'Password'));
       echo $form-end('Login');
   ?

   And in the controller I just do:
   print_r($this-data);

   Then I see an array with the username and password, but the password
   is always empty.

   On Aug 16, 6:16 am, Sam s...@masterscommission360.com wrote:

We need more info... can you paste your view, and perhaps your
controller action?

On Aug 15, 1:24 pm, Zippoxer zippo...@gmail.com wrote:

 I've created a simple authentication form with username and password
 input fields.
 The problem is that the password is always empty through $this-data
 in the controller, but username is not empty.
 What's the problem?

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

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


Re: Session call from other app

2010-08-17 Thread Hashim Ikram
You can use a field named as updated in which you place the time when the
user login, and by ajax call after every 2 min or whatever suites you to
change that updated filed by current time-stamp.
On chat site check that if the updated field is more than 2min older, if yes
then delete that row.
I hope this mail will help you.

Regards
Hashim Ikram

On Mon, Aug 16, 2010 at 9:26 PM, Davor Ilic webfa...@gmail.com wrote:

 Don´t know how cron is working. do you know good tutorials about this
 thema.

 2010/8/16 Zaky Katalan-Ezra procsh...@gmail.com

 Ping the database for every 20 sec with AJAX and in every new page load.
 In every ping update the session modified column.
 In chat check if a session exists and if the modified value is newer the
 40 sec.
 Delete the session row at logout and run cron every hour to delete dead
 sessions in order to keep the table clean

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

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


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

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


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

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


Re: Warning (2): Cannot modify header information - headers already sent by

2010-08-17 Thread milos

I have just descovered something very important. My controller was working
just fine with all redirect etc. After I changed the controller file to utf8
and whenever I had a redirect or session command it gave me information
already send by my controller file.

It is because I change it to utf8. I changed it back to ansi and it was all
ok.
It is very hard to see this error because part of controller does work.
Probably when notepad++ changed my file to ut8 it added some chars which are
not readable to us, but are to the server.

Check this when you get an error

-- 
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Warning-2-Cannot-modify-header-information-headers-already-sent-by-tp1318933p2637476.html
Sent from the CakePHP mailing list archive at Nabble.com.

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

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


One for the experts: Cake mixing up SQL-queries

2010-08-17 Thread dmc
Hi,

I'm letting Cake (Version 1.3.3) do some automatic imports over night
and it's doing the same thing for about half a million times.
It's working pretty well but every night I get some (about 10) really
weird SQL-errors.
I just don't understand how these even can occur.
It seems that cake is mixing up conditions from different queries
sometimes and even misspelling model-names.

This is the function that is doing the SQL-queries:

function __saveArticle($product, $hashkey, $shopId)
{
$this-VsArticle-create();
$this-VsArticle-id = false;
$this-data[VsArticle] = $product;

$this-VsArticle-recursive = -1;
$existingArticle = $this-VsArticle-find('all', array(limit = 1,
fields = array(VsArticle.id,VsArticle.toparticle), 'conditions'
= array(
'VsArticle.artnr' = $this-data[VsArticle][artnr],
'VsArticle.vs_shop_id' = $shopId)));

if(!empty($existingArticle))
{
$this-VsArticle-id = $existingArticle[0][VsArticle][id];
$this-updateCount++;
}
else
{
$this-data[VsArticle][status] = imported;
$this-data[VsArticle][vs_shop_id] = $shopId;
$this-newCount++;
}

if($existingArticle !== false)
{
if($this-VsArticle-save($this-data))
{
$lastArticleId = $this-VsArticle-id;
$this-VsArticleHasVsCategory-deleteAll(vs_article_id 
=
$lastArticleId, false);

foreach($this-data[VsArticle][categoriesIds] as 
$categoryId)
{
$this-VsArticleHasVsCategory-create();

$this-data[VsArticleHasVsCategory][vs_article_id] =
$lastArticleId;

$this-data[VsArticleHasVsCategory][vs_category_id] =
$categoryId;

$this-data[VsArticleHasVsCategory][vs_shop_id] = $shopId;
$this-data[VsArticleHasVsCategory][hash] = 
$hashkey;

$this-VsArticleHasVsCategory-save($this-data);
}
}
}

}


And here are some of the errors (with the corresponding SQL-Query):

[14-Aug-2010 01:58:35] PHP Warning: SQL Error: 1054: Unknown column
'vs_articles.id' in 'where clause' in /var/cakephp/cake/libs/model/
datasources/dbo_source.php on line 682
[14-Aug-2010 01:58:35] SQL ERROR: SELECT `VsArticle`.`id`,
`VsArticle`.`toparticle` FROM `vs_articles` AS `VsArticle` WHERE
`vs_articles`.`id` = 12040 ORDER BY `VsArticle`.`title` ASC LIMIT 1

[14-Aug-2010 04:48:20] PHP Warning: SQL Error: 1054: Unknown column
'VsArticle.artnr' in 'where clause' in /var/cakephp/cake/libs/model/
datasources/dbo_source.php on line 682
[14-Aug-2010 04:48:20] SQL ERROR: DELETE FROM `vs_articles` WHERE
`VsArticle`.`artnr` = '441124' AND `VsArticle`.`vs_shop_id` = 120

[15-Aug-2010 04:15:27] PHP Warning: SQL Error: 1054: Unknown column
'VsArticle.artnr' in 'where clause' in /var/cakephp/cake/libs/model/
datasources/dbo_source.php on line 682
[15-Aug-2010 04:15:27] SQL ERROR: DELETE `VsArticleHasVsCategory` FROM
`vs_article_has_vs_category` AS `VsArticleHasVsCategory` WHERE
`VsArticle`.`artnr` = '51715236-2-6-3-38-242' AND
`VsArticle`.`vs_shop_id` = 141

I know, it's not easy to understand, but please have a look at the
last error I posted.
As you can easily see, it's mixing up to queries:

   existingArticle = $this-VsArticle-find('all', array(limit
= 1, fields = array(VsArticle.id,VsArticle.toparticle),
'conditions' = array(
'VsArticle.artnr' = $this-data[VsArticle][artnr],
'VsArticle.vs_shop_id' = $shopId)));
AND
   $this-VsArticleHasVsCategory-deleteAll(vs_article_id =
$lastArticleId, false);

So somewhere in the cake-core the SQL-querybuilding get's pretty much
mixed up.
I just don't know what could trigger this and where exactly it
happens.
Not easy to debug, as this import is running for about six hours.

Does anybody have ANY idea what could cause this odd behavior?


best,

d.

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

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


Re: General Questions.

2010-08-17 Thread Neocrypter
Thanks for the response, i may be miss understanding what your saying here
but, the other lang i am working with has XML-RPC but it is a
failed implantation and unreliable so im going to be using straight http
post data to achieve what i need after all im communicating from a scripting
language inside of a video game :P there are some heavy limitations on what
i can do, But now the Json suggestion sonds intriguing ive never worked with
json so i guess its time to look up some tutorials on it.

On Mon, Aug 16, 2010 at 8:39 PM, Hugo M ham1...@gmail.com wrote:

 Hi Neocrypter! It's easy! You can use JSON or XML to comunicate with
 your app. You don't need a special class, you can just take post data
 from any action in any controller. Example:

 In your controller:

 var $helpers = array('Xml');

 function recieve_post() {
 //Saving external data
 $this-MyModel-save($this-data);
 $this-set('response', 'ok');
 }

 In your view:

 $xml-serialize($response, array('format'='tags', 'root'='root_node');

 or

 json_encode($response)

 If you want to count your data, in json's case you can do a string
 length  1024 (if your encoding takes 2 bytes per char), the same with
 the result of xml serialize.

 And that's all. You probably will need to validate user session and
 other things but... well that's another price (?) :P

 2010/8/16 Neocrypter neocryp...@gmail.com:
  Hello all I just discovered Cake last night and after playing with it
  for a few moments I must say im impressed, I personally have never
  truly worked with an MVC patten before and its been many years since
  ive done any php work (around PHP 3)  But I have taken up the mantel
  of a developer again to help one of my associates with a project. I
  ran through both the tutorials that are in the manual last night and
  was amazed at how fast things were up and running,  But before i dive
  head first into my app I need to write i have  a couple question,
 
  How hard is it to rig up a class to recive  data from external
  sources. I am writing an app in Second Life, which will send post data
  to the website to stick in the db. I was looking at doing that with
  Codeignighter but after working with it for a week and still not
  having a simple CRUD app set up  and working the way i think it should
  ive decided to look around at other frameworks.
 
  also is there any functions to count the amount of data that cake will
  send out in one chunk, im also going to be sending data back from the
  site to the application in Second Life but there is a limit to the
  amount of data that can be recived in one post 2kb to be exact.( im
  well aware that there is probaly nothing to keep track of such a thing
  built in but never hurts to ask )
 
  Thanks
  Neocrypter
 
  Check out the new CakePHP Questions site http://cakeqs.org and help
 others with their CakePHP related questions.
 
  You received this message because you are subscribed to the Google Groups
 CakePHP group.
  To post to this group, send email to cake-php@googlegroups.com
  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
   more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en
 

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

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


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

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


Save moltiple fields at once

2010-08-17 Thread Konstantin
Hello!

I have a settings table and I want to edit all fields on one page and
save them all with one click. Table structure and sample html are
listed below.
How can I create a form in CakePHP? $form-input seems to work with
only a single element, and I don't know how to loop through all
elements and create multiple inputs.

Thanks!

CREATE TABLE IF NOT EXISTS `settings` (
  `id` int(11) NOT NULL,
  `field` varchar(255) NOT NULL,
  `value` varchar(255) NOT NULL
);

table
tr
  thField 1:/th
  tdinput value=Value 1/td
/tr
tr
  thField 2:/th
  tdinput value=Value 2/td
/tr
tr
  thField 3:/th
  tdinput value=Value 3/td
/tr
/table

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

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


ODBC Connection with Intersystems cache

2010-08-17 Thread Oriol Franquesa
Hello!

Why in cakephp 1.2 there was a dbo_odbc.php driver and others and in
version 1.3 had been removed? I need to connect with a Intersystems
Cache database through ODBC and I don't know how exactly do it. I've
achieved to connect with a normal script through odbc_connect()
function but in cake I don't exactly how reference DSN and configure
the connection.

Thanks!

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

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


findById() does not work correctly after adding column to table in db

2010-08-17 Thread func0der
Hey guys,

i just wanted to change a controller of mine and added a new column to
a table in the database.
As far as i thought findById() gets the whole row out of the table
but that isn't happening.
Do i have to change anything in my controller, clear the cache or
anything else?

Greetings
func0der

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

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


Re: Strange problem with form helper...

2010-08-17 Thread Brendan Farquharson
Try enabling 'Session' component as well in your app_controller.php


On 17 August 2010 12:01, Zippoxer zippo...@gmail.com wrote:

 No that's not the problem. The Auth component is enabled.
 Please what's the problem? I'm waiting two days and can't keep working
 with CakePHP...

 On Aug 16, 9:37 pm, Zippoxer zippo...@gmail.com wrote:
  Ohh, I think that's the problem. It looks enabled, but when I don't
  allow access to login action it still allows.
  Here's the full app_controller.php code:
 
  class AppController extends Controller {
 
  var $components = array('Auth');
 
  function beforeFilter() {
  parent::beforeFilter();
  $this-helpers[] = 'Menu';
  $this-Auth-userModel = 'Player';
  $this-Auth-allow('login', 'register');
  $this-Auth-fields = array(
  'username' = 'name',
  'password' = 'password'
  );
  }
 
  }
 
  On Aug 16, 9:13 pm, Miles J mileswjohn...@gmail.com wrote:
 
 
 
   Do you have the Auth component enabled?
 
   On Aug 16, 2:04 am, Zippoxer zippo...@gmail.com wrote:
 
This is the form code in the view:
?php
echo $form-create('Player');
echo $form-input('name', array('label' = 'Name'));
echo $form-input('password', array('label' = 'Password'));
echo $form-end('Login');
?
 
And in the controller I just do:
print_r($this-data);
 
Then I see an array with the username and password, but the password
is always empty.
 
On Aug 16, 6:16 am, Sam s...@masterscommission360.com wrote:
 
 We need more info... can you paste your view, and perhaps your
 controller action?
 
 On Aug 15, 1:24 pm, Zippoxer zippo...@gmail.com wrote:
 
  I've created a simple authentication form with username and
 password
  input fields.
  The problem is that the password is always empty through
 $this-data
  in the controller, but username is not empty.
  What's the problem?

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

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


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

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


Re: Strange problem with form helper...

2010-08-17 Thread Zippoxer
Still the same.
After submiting the login form with test_username/test_password, here
is print_r($this-data):
Array ( [Player] = Array ( [name] = test_username [password] = ) )

I noticed that even if I remove the password field form the form,
print_r($this-data) is exactly the same (with 'password' field).

On Aug 17, 2:08 pm, Brendan Farquharson brenf...@gmail.com wrote:
 Try enabling 'Session' component as well in your app_controller.php

 On 17 August 2010 12:01, Zippoxer zippo...@gmail.com wrote:



  No that's not the problem. The Auth component is enabled.
  Please what's the problem? I'm waiting two days and can't keep working
  with CakePHP...

  On Aug 16, 9:37 pm, Zippoxer zippo...@gmail.com wrote:
   Ohh, I think that's the problem. It looks enabled, but when I don't
   allow access to login action it still allows.
   Here's the full app_controller.php code:

   class AppController extends Controller {

       var $components = array('Auth');

       function beforeFilter() {
           parent::beforeFilter();
           $this-helpers[] = 'Menu';
           $this-Auth-userModel = 'Player';
           $this-Auth-allow('login', 'register');
           $this-Auth-fields = array(
               'username' = 'name',
               'password' = 'password'
           );
       }

   }

   On Aug 16, 9:13 pm, Miles J mileswjohn...@gmail.com wrote:

Do you have the Auth component enabled?

On Aug 16, 2:04 am, Zippoxer zippo...@gmail.com wrote:

 This is the form code in the view:
 ?php
     echo $form-create('Player');
     echo $form-input('name', array('label' = 'Name'));
     echo $form-input('password', array('label' = 'Password'));
     echo $form-end('Login');
 ?

 And in the controller I just do:
 print_r($this-data);

 Then I see an array with the username and password, but the password
 is always empty.

 On Aug 16, 6:16 am, Sam s...@masterscommission360.com wrote:

  We need more info... can you paste your view, and perhaps your
  controller action?

  On Aug 15, 1:24 pm, Zippoxer zippo...@gmail.com wrote:

   I've created a simple authentication form with username and
  password
   input fields.
   The problem is that the password is always empty through
  $this-data
   in the controller, but username is not empty.
   What's the problem?

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
  with their CakePHP related questions.

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

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

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


Re: Save moltiple fields at once

2010-08-17 Thread Max Dörfler

Hi,

see saveAll http://book.cakephp.org/view/1031/Saving-Your-Data
You can create the form which generates the needed output to feed 
saveAll like the following:


?php
echo $this-Form-create('Setting');
foreach ($settings as $key = $setting) {
echo $this-Form-input('Setting.'.$key.'.id', array('value' = 
$setting['Setting']['id']));

echo $this-Form-input('Setting.'.$key.'.value');
}
echo $this-Form-end('edit');
?

This should work. Please correct me, if there is an easier way.

Regards
Max

Am 17.08.2010 10:39, schrieb Konstantin:

Hello!

I have a settings table and I want to edit all fields on one page and
save them all with one click. Table structure and sample html are
listed below.
How can I create a form in CakePHP? $form-input seems to work with
only a single element, and I don't know how to loop through all
elements and create multiple inputs.

Thanks!

CREATE TABLE IF NOT EXISTS `settings` (
   `id` int(11) NOT NULL,
   `field` varchar(255) NOT NULL,
   `value` varchar(255) NOT NULL
);

table
tr
   thField 1:/th
   tdinput value=Value 1/td
/tr
tr
   thField 2:/th
   tdinput value=Value 2/td
/tr
tr
   thField 3:/th
   tdinput value=Value 3/td
/tr
/table

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

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


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

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


Re: Autocomplete result not shown

2010-08-17 Thread Kasimir
Hi!

I've found the issue. Javascripts weren't loaded at the right time.
I changed in my view the lines
echo $javascript-link('scriptaculous-1.8.3/lib/prototype');
echo $javascript-link('scriptaculous-1.8.3/src/scriptaculous');

into
$this-addScript(prototype, $javascript-link('scriptaculous-1.8.3/
lib/prototype'));
$this-addScript(scriptaculous, $javascript-
link('scriptaculous-1.8.3/src/scriptaculous'));

Now they're loaded earlier and the everything is ok.

reets
Oliver

On 16 Aug., 15:51, Kasimir ore...@googlemail.com wrote:
 Hi group!

 After reading many pages and this group I'm not able to find my bug,
 why my result of the autocomplete-request is not shown on my page.

 Here's what I have so far:

 controller:
 --
 class RadacctsController extends AppController {
         var $name = 'Radaccts';
         var $helpers = array('Html', 'Form', ''Ajax', 'Number', 'Time');
         var $uses = array('Radacct', 'Radcheck');
 
        function autoComplete(){
                 $this-set('results', $this-Radcheck-find('all', array(
             'conditions' = array(
                 'Radcheck.UserName LIKE' = $this-data['Radacct']
 ['Username'].'%',
                         ),
                         'limit' = '15',
             'fields' = array('username')
                  )));
                 $this-layout = 'ajax';
         }

 my view index.ctp
 

 div class=radaccts form
 ?php
 echo $javascript-link('scriptaculous-1.8.3/lib/prototype');
 echo $javascript-link('scriptaculous-1.8.3/src/scriptaculous');

 echo $ajax-form(array(
                 'type' = 'post',
                 'options' = array(
                         'update'='login_liste',
                         'url' = array(
                                 'controller' = 'radaccts',
                                 'action' = 'autoComplete'
                         )
                 )
         )
 );
 echo $ajax-autoComplete('Radacct.Username', '/radaccts/
 autoComplete');
 echo $form-end('Show logins');

 echo $ajax-div('login_liste');
 ?
 /div

 and my view auto_complete.ctp
 -
 ?php //pr($this-params); ?
 ul
  ?php foreach($results as $result): ?
      li?php echo $result['Radcheck']['username']; ?/li
  ?php endforeach; ?
 /ul

 What is strange is, I have to press the submit-button to get the
 request sent. In the wireshark-trace I see the request and afterwards
 the result ullimy results/li/ul.

 So were is the but to have shown my results under the input-field?

 Thanks for your help
 Oliver

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

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


Re: findById() does not work correctly after adding column to table in db

2010-08-17 Thread Andras Kende
Try to clear the cache /tmp/cache/models


Andras Kende
http://www.kende.com

On Aug 17, 2010, at 6:32 AM, func0der wrote:

 Hey guys,
 
 i just wanted to change a controller of mine and added a new column to
 a table in the database.
 As far as i thought findById() gets the whole row out of the table
 but that isn't happening.
 Do i have to change anything in my controller, clear the cache or
 anything else?
 
 Greetings
 func0der
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

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

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


Re: findById() does not work correctly after adding column to table in db

2010-08-17 Thread Hashim Ikram
Set debug level to 1 in core.php,
As far as it is 0 it will not take any change in database schema.
Once it gives you result according to new schema set debug level as you
want.

Regards
Hashim Ikram

On Tue, Aug 17, 2010 at 6:45 PM, Andras Kende and...@kende.com wrote:

 Try to clear the cache /tmp/cache/models


 Andras Kende
 http://www.kende.com

 On Aug 17, 2010, at 6:32 AM, func0der wrote:

  Hey guys,
 
  i just wanted to change a controller of mine and added a new column to
  a table in the database.
  As far as i thought findById() gets the whole row out of the table
  but that isn't happening.
  Do i have to change anything in my controller, clear the cache or
  anything else?
 
  Greetings
  func0der
 
  Check out the new CakePHP Questions site http://cakeqs.org and help
 others with their CakePHP related questions.
 
  You received this message because you are subscribed to the Google Groups
 CakePHP group.
  To post to this group, send email to cake-php@googlegroups.com
  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
   more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en

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

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


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

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


Adding data using SCHEMA

2010-08-17 Thread Azril Nazli
Is ist possible to add some data automaticalle in schema cli

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

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


Re: can't delete record from table

2010-08-17 Thread Tomfox Wiranata
hey anthony...that was it thx

your right it is bad formit was just simple testing first..i
changed tht as well...

thx so much

On 16 Aug., 14:25, Anthony anthony.c.fra...@gmail.com wrote:
 A function stops executing when return is called.

 Your return is before your delete.

 Though deleting a record in a function called __getRecord sounds like
 poor form to me.

 On Aug 15, 6:14 am, Tomfox Wiranata tomfox.wiran...@gmail.com wrote:

  hi,

  i am trying to delete a record from a table. to do that i call a
  different model from my controller. anyway, i can retrieve the correct
  data perfectly, that tells me the process is right. but i can't delete
  a specifi record. first i declared the foreign model in my controller

  var $uses = array('User', 'Test');

  now i am retreiving the first record from that table, tests. it
  happens in my controller:

      function __getRecord()
      {
          $erg = $this-Test-find('first');
          $id = $erg['Test']['id'];

                  $this-set('proxies', $erg);
                                        return $erg['Test']['name'];
                  $this-Test-delete($id);
      }

  After i got it i want to delete it from the table so i am passing the
  $id to the delete function. but cake just wont delete the record.

  i checked. the correct id is passed...

  i am calling this function like
  $this-Session-write('abc.test', $this-__getRecord());

  can u see the problem? looking forward to your help :)
  THX

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

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


Re: Easy cake pagination!

2010-08-17 Thread bradmaxs
What is the relationship of the category and picture table?  It seems
that the pictures should possibly have a has one category and games
has many pictures.  When you look at the picture array, there is no
category reference there.  I would think there would need to be a
category_id for it to be possible. Haven't had coffee yet so go easy.

On Aug 16, 7:27 am, Abraham Boray abrahambo...@gmail.com wrote:
 Guys I'm lost, in the middle of a project I have to separate between
 two pictures form
    1- Pictures 4 the iPhone
    2- Pictures 4 the Web

 I get this array from the controller by callin :
         $this-Picture-recursive = 0;
         $this-set('pictures', $this-paginate());

 the array is a set of pictures and the GAME (to which they belong)
 And every game have a CATEGORY

  Array
 (
     [0] = Array
         (
             [Picture] = Array
                 (
                     [id] = 1
                     [name] = Image_15.png
                     [type] = image/png
                     [size] = 328004
                     [filesize] = 320 KB
                     [ext] = png
                     [group] = image
                     [path] = /files/iPhone/Image_15.png
                     [created] = 2010-08-02 16:19:33
                     [modified] = 2010-08-02 16:19:33
                     [type_id] = 30
                 )
                 )

 [Game] = Array
                 (
                     [0] = Array
                         (
                             [id] = 9
                             [game_name] = Game2
                             [GamesPicture] = Array
                                 (
                                     [id] = 43
                                     [game_id] = 9
                                     [picture_id] = 24
                                 )

                             [Category] = Array
                                 (
                                     [id] = 3
                                     [name] = web
                                 )
                                                 )
                                 )
 )

 So wot I want is to paginate this including just the web CATEGORY
 PICTURES(Filtring)
 WHERE CATEGORY.nam='web'

 I tried this but it'snot working :
 /// 
 
  $this-set('pictures', $this-paginate('conditions' =
 array('Category.name' = 'web')));

 this is the database structure so to get a clearer IDEA.
 /// 
 
 Field   TABLE PICTURE
         id
         name
         type
         size
         int(11)
         filesize
         group
         type_id         int(11)

 Field   TABLE GAME
          id
          game_name
          start_date
          end_date
          category_id
          modified

  Field  TABLE Games_pictures
         id
         game_id
         picture_id

 Thank u  guys 4 ur future help, I'm stuck and got really to get this
 done as soon as I can Fix it
 Thank u in advance
 {A|B}

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

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


Conditional validation on multiple records

2010-08-17 Thread tersmitten
I have an array of data that I want to validate. Like this:

$this-data['Model'][0]['field1']
$this-data['Model'][0]['field2']
$this-data['Model'][0]['field3']
$this-data['Model'][1]['field1']
$this-data['Model'][1]['field2']
$this-data['Model'][1]['field3']
$this-data['Model'][2]['field1']
$this-data['Model'][2]['field2']
$this-data['Model'][2]['field3']

All the rules are set up (and working) to. The only problem is that I
want to use certain rules only if certain conditions are satisfied.
For instance:

Validate field2 and field3 only if field1 = 1

I already have a function to delete, keep rules on the fly, but this
is not on a per record basis :-( Is there any way to accomplish that?
Have a per record $validate array?

PS; I found the ConditionalValidation behavior but I'm not sure that
does the trick for me

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

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


Re: Strange problem with form helper...

2010-08-17 Thread Zippoxer
Tried more tons of things, nothing works... :\

On Aug 17, 2:47 pm, Zippoxer zippo...@gmail.com wrote:
 Still the same.
 After submiting the login form with test_username/test_password, here
 is print_r($this-data):
 Array ( [Player] = Array ( [name] = test_username [password] = ) )

 I noticed that even if I remove the password field form the form,
 print_r($this-data) is exactly the same (with 'password' field).

 On Aug 17, 2:08 pm, Brendan Farquharson brenf...@gmail.com wrote:



  Try enabling 'Session' component as well in your app_controller.php

  On 17 August 2010 12:01, Zippoxer zippo...@gmail.com wrote:

   No that's not the problem. The Auth component is enabled.
   Please what's the problem? I'm waiting two days and can't keep working
   with CakePHP...

   On Aug 16, 9:37 pm, Zippoxer zippo...@gmail.com wrote:
Ohh, I think that's the problem. It looks enabled, but when I don't
allow access to login action it still allows.
Here's the full app_controller.php code:

class AppController extends Controller {

    var $components = array('Auth');

    function beforeFilter() {
        parent::beforeFilter();
        $this-helpers[] = 'Menu';
        $this-Auth-userModel = 'Player';
        $this-Auth-allow('login', 'register');
        $this-Auth-fields = array(
            'username' = 'name',
            'password' = 'password'
        );
    }

}

On Aug 16, 9:13 pm, Miles J mileswjohn...@gmail.com wrote:

 Do you have the Auth component enabled?

 On Aug 16, 2:04 am, Zippoxer zippo...@gmail.com wrote:

  This is the form code in the view:
  ?php
      echo $form-create('Player');
      echo $form-input('name', array('label' = 'Name'));
      echo $form-input('password', array('label' = 'Password'));
      echo $form-end('Login');
  ?

  And in the controller I just do:
  print_r($this-data);

  Then I see an array with the username and password, but the password
  is always empty.

  On Aug 16, 6:16 am, Sam s...@masterscommission360.com wrote:

   We need more info... can you paste your view, and perhaps your
   controller action?

   On Aug 15, 1:24 pm, Zippoxer zippo...@gmail.com wrote:

I've created a simple authentication form with username and
   password
input fields.
The problem is that the password is always empty through
   $this-data
in the controller, but username is not empty.
What's the problem?

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
   with their CakePHP related questions.

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

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

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


Re: One for the experts: Cake mixing up SQL-queries

2010-08-17 Thread cricket
What do the tables for these models look like? Also, can you post the
association arrays?

On Mon, Aug 16, 2010 at 9:06 PM, dmc daniel.mitsc...@gmail.com wrote:
 Hi,

 I'm letting Cake (Version 1.3.3) do some automatic imports over night
 and it's doing the same thing for about half a million times.
 It's working pretty well but every night I get some (about 10) really
 weird SQL-errors.
 I just don't understand how these even can occur.
 It seems that cake is mixing up conditions from different queries
 sometimes and even misspelling model-names.

 This is the function that is doing the SQL-queries:

 function __saveArticle($product, $hashkey, $shopId)
 {
        $this-VsArticle-create();
        $this-VsArticle-id = false;
        $this-data[VsArticle] = $product;

        $this-VsArticle-recursive = -1;
        $existingArticle = $this-VsArticle-find('all', array(limit = 1,
 fields = array(VsArticle.id,VsArticle.toparticle), 'conditions'
 = array(
                'VsArticle.artnr' = $this-data[VsArticle][artnr],
                'VsArticle.vs_shop_id' = $shopId)));

        if(!empty($existingArticle))
        {
                $this-VsArticle-id = $existingArticle[0][VsArticle][id];
                $this-updateCount++;
        }
        else
        {
                $this-data[VsArticle][status] = imported;
                $this-data[VsArticle][vs_shop_id] = $shopId;
                $this-newCount++;
        }

        if($existingArticle !== false)
        {
                if($this-VsArticle-save($this-data))
                {
                        $lastArticleId = $this-VsArticle-id;
                        
 $this-VsArticleHasVsCategory-deleteAll(vs_article_id =
 $lastArticleId, false);

                        foreach($this-data[VsArticle][categoriesIds] as 
 $categoryId)
                        {
                                $this-VsArticleHasVsCategory-create();
                                
 $this-data[VsArticleHasVsCategory][vs_article_id] =
 $lastArticleId;
                                
 $this-data[VsArticleHasVsCategory][vs_category_id] =
 $categoryId;
                                
 $this-data[VsArticleHasVsCategory][vs_shop_id] = $shopId;
                                $this-data[VsArticleHasVsCategory][hash] 
 = $hashkey;
                                
 $this-VsArticleHasVsCategory-save($this-data);
                        }
                }
        }

 }


 And here are some of the errors (with the corresponding SQL-Query):

 [14-Aug-2010 01:58:35] PHP Warning: SQL Error: 1054: Unknown column
 'vs_articles.id' in 'where clause' in /var/cakephp/cake/libs/model/
 datasources/dbo_source.php on line 682
 [14-Aug-2010 01:58:35] SQL ERROR: SELECT `VsArticle`.`id`,
 `VsArticle`.`toparticle` FROM `vs_articles` AS `VsArticle` WHERE
 `vs_articles`.`id` = 12040 ORDER BY `VsArticle`.`title` ASC LIMIT 1

 [14-Aug-2010 04:48:20] PHP Warning: SQL Error: 1054: Unknown column
 'VsArticle.artnr' in 'where clause' in /var/cakephp/cake/libs/model/
 datasources/dbo_source.php on line 682
 [14-Aug-2010 04:48:20] SQL ERROR: DELETE FROM `vs_articles` WHERE
 `VsArticle`.`artnr` = '441124' AND `VsArticle`.`vs_shop_id` = 120

 [15-Aug-2010 04:15:27] PHP Warning: SQL Error: 1054: Unknown column
 'VsArticle.artnr' in 'where clause' in /var/cakephp/cake/libs/model/
 datasources/dbo_source.php on line 682
 [15-Aug-2010 04:15:27] SQL ERROR: DELETE `VsArticleHasVsCategory` FROM
 `vs_article_has_vs_category` AS `VsArticleHasVsCategory` WHERE
 `VsArticle`.`artnr` = '51715236-2-6-3-38-242' AND
 `VsArticle`.`vs_shop_id` = 141

 I know, it's not easy to understand, but please have a look at the
 last error I posted.
 As you can easily see, it's mixing up to queries:

       existingArticle = $this-VsArticle-find('all', array(limit
 = 1, fields = array(VsArticle.id,VsArticle.toparticle),
 'conditions' = array(
                'VsArticle.artnr' = $this-data[VsArticle][artnr],
                'VsArticle.vs_shop_id' = $shopId)));
 AND
       $this-VsArticleHasVsCategory-deleteAll(vs_article_id =
 $lastArticleId, false);

 So somewhere in the cake-core the SQL-querybuilding get's pretty much
 mixed up.
 I just don't know what could trigger this and where exactly it
 happens.
 Not easy to debug, as this import is running for about six hours.

 Does anybody have ANY idea what could cause this odd behavior?


 best,

 d.

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

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


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

You received this message because you are 

Re: cakephp basecamp clone (kilobit) installation issues

2010-08-17 Thread cricket
Looks like you didn't post the full error msg.

On Mon, Aug 16, 2010 at 4:07 PM, the_islander andretan...@gmail.com wrote:
 Hey there, firstly thanks for any support I receive from here on
 out! :)

 I've installed kilobit (http://bitbucket.org/bjornpost/cakephp-
 basecamp/) but having real troubles getting it to work. I've spoken to
 the creator and he gave me a few pointers, but my knowledge of cakephp
 is far too limited.

 So, here's what i've done.
 - Downloaded kilobit from bitbucket
 - downloaded cakephp
 - setup my database
 - moved the files to a subdomain rather than sub directory (as per
 author's suggestion)

 but im still getting the following errors and i think its because i
 havent defined my 'APP' setting. However, i've looked through the code
 and i cant find where i should be doing this.

 } else {
        $Dispatcher = new Dispatcher();
        $Dispatcher-dispatch($url);
 $GLOBALS        =       array(
        GLOBALS = array(
        GLOBALS = array()
 )
 )
 require - APP/webroot/index.php, line 88
 [main] - APP/index.php, line 23

 I'd be really grateful for any help or pointers on this one.
 All the best

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

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


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

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


Re: Strange problem with form helper...

2010-08-17 Thread Zippoxer
Okay it works, the problem was that I wrote: print_r($this-data) in
an action instead of in beforeFilter()...

On Aug 17, 7:57 pm, Zippoxer zippo...@gmail.com wrote:
 Tried more tons of things, nothing works... :\

 On Aug 17, 2:47 pm, Zippoxer zippo...@gmail.com wrote:



  Still the same.
  After submiting the login form with test_username/test_password, here
  is print_r($this-data):
  Array ( [Player] = Array ( [name] = test_username [password] = ) )

  I noticed that even if I remove the password field form the form,
  print_r($this-data) is exactly the same (with 'password' field).

  On Aug 17, 2:08 pm, Brendan Farquharson brenf...@gmail.com wrote:

   Try enabling 'Session' component as well in your app_controller.php

   On 17 August 2010 12:01, Zippoxer zippo...@gmail.com wrote:

No that's not the problem. The Auth component is enabled.
Please what's the problem? I'm waiting two days and can't keep working
with CakePHP...

On Aug 16, 9:37 pm, Zippoxer zippo...@gmail.com wrote:
 Ohh, I think that's the problem. It looks enabled, but when I don't
 allow access to login action it still allows.
 Here's the full app_controller.php code:

 class AppController extends Controller {

     var $components = array('Auth');

     function beforeFilter() {
         parent::beforeFilter();
         $this-helpers[] = 'Menu';
         $this-Auth-userModel = 'Player';
         $this-Auth-allow('login', 'register');
         $this-Auth-fields = array(
             'username' = 'name',
             'password' = 'password'
         );
     }

 }

 On Aug 16, 9:13 pm, Miles J mileswjohn...@gmail.com wrote:

  Do you have the Auth component enabled?

  On Aug 16, 2:04 am, Zippoxer zippo...@gmail.com wrote:

   This is the form code in the view:
   ?php
       echo $form-create('Player');
       echo $form-input('name', array('label' = 'Name'));
       echo $form-input('password', array('label' = 'Password'));
       echo $form-end('Login');
   ?

   And in the controller I just do:
   print_r($this-data);

   Then I see an array with the username and password, but the 
   password
   is always empty.

   On Aug 16, 6:16 am, Sam s...@masterscommission360.com wrote:

We need more info... can you paste your view, and perhaps your
controller action?

On Aug 15, 1:24 pm, Zippoxer zippo...@gmail.com wrote:

 I've created a simple authentication form with username and
password
 input fields.
 The problem is that the password is always empty through
$this-data
 in the controller, but username is not empty.
 What's the problem?

Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
with their CakePHP related questions.

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

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

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


Re: Change the File Name for a Model

2010-08-17 Thread sanedevil
You are rite! thanks!

On Aug 16, 8:15 pm, Miles J mileswjohn...@gmail.com wrote:
 Why are you using App::import()? Just use the ole regular
 include_once.

 On Aug 14, 3:13 pm, sanedevil sanede...@gmail.com wrote:

  Thanks again guys!

  @AD7six, i checked the app::import, but couldn't figure out a way that
  will help me. can u pls enlighten me?

  On Aug 13, 4:31 pm, AD7six andydawso...@gmail.com wrote:

   On Aug 13, 4:19 pm, sanedevil sanede...@gmail.com wrote:

Thanks all guys!

seems i cant achieve what i want. I'll change the class name and make
the changes elsewhere in the app.

as a sidenote (and a general query), cake stresses on convention over
configuration, but doesn't it provide configuration for the desperate
and crazy cases (like me ;-) )?

   Ps if your model class is named Con *only* because the db table is
   named cons - then just useTable your way out of that paper bag.

   Pps - filenames should be lower case.

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

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


Problem with tinyint(1)

2010-08-17 Thread Arnold Roa
hi, i have a field icon, tinyint(1).

im doing this:

$this-Software-saveField('icon',2);

but the query generated is:

UPDATE `software` SET `icon` = 1, `modified` = '2010-08-17 12:58:37' WHERE
`software`.`id` = 1115

Why is icon = 1 and not icon = 2?

is this okey? or is a bug?

if i set icon = 2 directly in my db, mysql allows that value.

Arnold

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

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


Re: Problem with tinyint(1)

2010-08-17 Thread Fran Iglesias
Hi,

El 17/08/2010, a las 20:02, Arnold Roa escribió:

 hi, i have a field icon, tinyint(1).
 is this okey? or is a bug?

tinyint(1) is boolean for Cake.
You could define the field as tinyint(2)
---
Fran Iglesias cakephpi...@gmail.com
http://cakephpilia.blogspot.com

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

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


CakePHP 1.3 error in command: this-Html-link( $this-Html-image(cal.png) ... ,

2010-08-17 Thread Tom
I got error in this code (cakePHP 1.3):

$options = $this-Html-link( $this-Html-image(cal.png),
   'cal.png',
   array('onClick'=return showCalendar('.
$htmlAttributes['id'].', '.$this-format.'); return false;),
   array('escape'=false));

please help me...

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

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


Re: findById() does not work correctly after adding column to table in db

2010-08-17 Thread func0der
Sorry -.- I worked it out.
Wrong Database.



On 17 Aug., 16:43, Hashim Ikram l050...@gmail.com wrote:
 Set debug level to 1 in core.php,
 As far as it is 0 it will not take any change in database schema.
 Once it gives you result according to new schema set debug level as you
 want.

 Regards
 Hashim Ikram

 On Tue, Aug 17, 2010 at 6:45 PM, Andras Kende and...@kende.com wrote:
  Try to clear the cache /tmp/cache/models

  Andras Kende
 http://www.kende.com

  On Aug 17, 2010, at 6:32 AM, func0der wrote:

   Hey guys,

   i just wanted to change a controller of mine and added a new column to
   a table in the database.
   As far as i thought findById() gets the whole row out of the table
   but that isn't happening.
   Do i have to change anything in my controller, clear the cache or
   anything else?

   Greetings
   func0der

   Check out the new CakePHP Questions sitehttp://cakeqs.organd help
  others with their CakePHP related questions.

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

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
  with their CakePHP related questions.

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

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

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


Re: check if a conversation with exactly those users exist

2010-08-17 Thread euromark
yeah!!!
a friend helped my out
just awesome :)


SELECT u.`conversation_id`, c.`title`
FROM `faf_conversation_users` u, `faf_conversations` c
WHERE c.`id` = u.`conversation_id`
GROUP BY u.`conversation_id`
HAVING sum(case when u.`user_id` in (\''.implode('\', \'',
$users).'\') then 1 else 0 end) = '.count($users).' AND count(*) =
'.count($users).';



On 15 Aug., 02:32, schaefer marksch...@web.de wrote:
 right now i tried some EXISTS subquery

         function existingConversations($users, $limit = 5) {
                 $options = array(
                         'conditions' = 
 array('ConversationUser.user_id'=$users, 'EXISTS
 (SELECT * from `faf_conversation_users` AS `ConversationUser2` WHERE
 ConversationUser2.conversation_id = Conversation.id having COUNT(*) =
 '.count($users).')'),
                         'group' = array('ConversationUser.conversation_id'),
                         'contain' = array('Conversation'),
                         'fields' = array('Conversation.id', 
 'Conversation.title',
 'Conversation.last_message'),
                         'limit' = $limit,
                         'order' = array('Conversation.last_message'='DESC')
                 );

                 return $this-ConversationUser-find('all', $options);
         }

 resulting in

 SELECT `Conversation`.`id`, `Conversation`.`title`,
 `Conversation`.`last_message` FROM `faf_conversation_users` AS
 `ConversationUser` LEFT JOIN `faf_conversations` AS `Conversation` ON
 (`ConversationUser`.`conversation_id` = `Conversation`.`id`)
 WHERE `ConversationUser`.`user_id` IN (1, 2, 4) AND EXISTS (
   SELECT * from faf_conversation_users AS ConversationUser2 WHERE
 `ConversationUser2`.`conversation_id` = `Conversation`.`id` having
 COUNT(*) = 3
 )
 GROUP BY `ConversationUser`.`conversation_id`
 ORDER BY `Conversation`.`last_message` DESC
 LIMIT 5

 again - too many results... (wrong ones of corse)

 On 14 Aug., 13:42, schaefer marksch...@web.de wrote:



  well, maybe somebody has a clue how to do it in sql or in cake (and
  indirektly in sql then)

  right now i dont get it to work
  i shows too many results of course

  maybe this simply cant be done in a single request..?

  On 13 Aug., 11:16, AD7six andydawso...@gmail.com wrote:

   On Aug 12, 11:06 pm, schaefer marksch...@web.de wrote:

nobody who can help?

   What working sql are you trying to execute in cake.

   If you're not sure - your asking the question in the wrong place.

   hth,

   AD- Zitierten Text ausblenden -

  - Zitierten Text anzeigen -

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

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


Re: One for the experts: Cake mixing up SQL-queries

2010-08-17 Thread dmc
These are the Models and the corresponding SQL-Structure:

class VsArticle extends AppModel {

var $name = 'VsArticle';

var $actsAs = array(Containable);

var $displayField = title;
var $order = VsArticle.title;

var $belongsTo = array(VsShop = array(exclusive = true),
VsMake = array(exclusive = true));
var $hasAndBelongsToMany = array(VsCategory = array(
className = VsCategory,
joinTable = vs_article_has_vs_category,
unique = true,
exclusive = true
));
}

id  bigint(20)
status  varchar(45)
artnr   varchar(255)
title   varchar(255)
price   float
img_url varchar(1024)
imglarge_urlvarchar(1024)
deeplinkvarchar(1024)
descr   text
descr_short text
gender  int(11)
created datetime
modifieddatetime
vs_make_id  int(11)
vs_shop_id  int(11)
original_category   varchar(255)
original_make   varchar(255)




class VsArticleHasVsCategory extends AppModel {
var $name = 'VsArticleHasVsCategory';
var $useTable = vs_article_has_vs_category;
}

id  bigint(20)
vs_article_id   bigint(20)
vs_category_id  int(11)
vs_shop_id  int(11)
hashvarchar(255)




Did you see the mixed up Query?

DELETE `VsArticleHasVsCategory` FROM
`vs_article_has_vs_category` AS `VsArticleHasVsCategory` WHERE
`VsArticle`.`artnr` = '51715236-2-6-3-38-242' AND
`VsArticle`.`vs_shop_id` = 141

The whole query makes no sense at all: it is deleting from the Table/
Model VsArticleHasVsCategory (which is correct) but is referring to
the Table/Model VsArticle in the WHERE-statement.
And the WHERE-statement corresponds to the first model-find-statement
in the function:

'conditions' = array(
'VsArticle.artnr' = $this-data[VsArticle]
[artnr],
'VsArticle.vs_shop_id' = $shopId
)


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

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


Re: Warning (2): Cannot modify header information - headers already sent by

2010-08-17 Thread Vikas.R.Hanagodimath
Comment all print and echo in your script.

Kind Regards
Vikas.R.Hanagodimath


On Tue, Aug 17, 2010 at 04:47, milos milosvuci...@gmail.com wrote:

 I have just descovered something very important. My controller was working
 just fine with all redirect etc. After I changed the controller file to utf8
 and whenever I had a redirect or session command it gave me information
 already send by my controller file. It is because I change it to utf8. I
 changed it back to ansi and it was all ok. It is very hard to see this error
 because part of controller does work. Probably when notepad++ changed my
 file to ut8 it added some chars which are not readable to us, but are to the
 server. Check this when you get an error
 --
 View this message in context: Re: Warning (2): Cannot modify header
 information - headers already sent 
 byhttp://cakephp.1045679.n5.nabble.com/Warning-2-Cannot-modify-header-information-headers-already-sent-by-tp1318933p2637476.html
 Sent from the CakePHP mailing list 
 archivehttp://cakephp.1045679.n5.nabble.com/at Nabble.com.

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

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


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

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


Re: Easy cake pagination!

2010-08-17 Thread Okalany Daniel
the model Place hasMany Count, and Count belongs to place.
So using the Containable behaviour, i can specify conditions for child
fields like:

$this-Place-Behaviors-attach('Containable');
$this-paginate['Place'] = array(
'contain' = array('Count'=array(
'conditions'=array('Count.date'=date('Y-m-d'))
)),
//'order' = 'Count.count DESC'
);
$places = $this-paginate('Place');

But i'd like to order the parent Model by a field in a child model. When i
uncomment the line that starts 'order', i get the error:
SQL Error: 1054: Unknown column 'Count.count' in 'order clause'

Thanks in advance.



On Tue, Aug 17, 2010 at 10:28 AM, AD7six andydawso...@gmail.com wrote:



 On Aug 16, 5:25 pm, Okalany Daniel dokala...@gmail.com wrote:
  Hi, Andy Dawson,
  i'm having a similar problem,

 How similar is your sql error or code ? I find it hard to compare to
 things I can't see :).

  but i don't understand your fix.

 I didn't get as far as to propose a fix. However I'll give you this
 hint: the book almost certainly has a relevant example and hasMany/
 hasAndBelongsToMany don't generate joins in the main query - hasOnes
 do.

 AD

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

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




-- 
OKALANY DANIEL,
P.O BOX 26150,
Kampala.,
Uganda.
http://okasoft.net
--
When confronted by our worst nightmares, the choices are few; Fight or
flight. We hope to find the strength to stand against our fears but
sometimes, despite ourselves, we run. What if the nightmare gives chase?
Where can we hide then?

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

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


Re: jQuery ajax pagination in 1.3

2010-08-17 Thread philthathril
I was having the same issue about the ajax pagination occurring every
other page (and I'm using MooTools). The key was that I *was* putting
the call to $js-writeBuffer() in my default.ctp view file in the
'content' div that got updated. However, this file was not seeing the
new content. So, I moved my writeBuffer() call from default.ctp to my
table.ctp (custom) element file and it worked! Yay! Recap...

default.ctp
div id=content
?php echo $content_for_layout; ?
/div
...
?php echo $js-writeBuffer(); ? // Keep this at the bottom of the
page for the original-loaded content (if there is no table with
pagination)
/body


table.ctp (custom element) - this file gets read with each ajax
request
table
...
/table
?php echo $js-writeBuffer(); ? // Put this call in the view that
gets updated

Hope this helps some people out there because I really haven't seen
any clear explanation elsewhere.

Happy coding,
~Philip

On Dec 16 2009, 3:39 pm, mark_story mark.st...@gmail.com wrote:
 Yeah you need the writeBuffer() at the bottom of the view, or in 
 yourajaxlayout. Otherwise the event scripts don't get sent along.  I'll
 have to look into the jquery issue, I thought jquery did global eval()
 on all the script blocks in an html response, but seems I might have
 been wrong.

 -Mark

 On Dec 16, 5:27 am, Dave davidcr...@gmail.com wrote:

  I have run into issues like this as well.  For some reason sometimes when
  content is pulled in viaajaxI need to call $js-writeBuffer; at the bottom
  of the view in the action which is called to get all of the javascript to
  echo properly.

  It kind of makes sense, if you have $js-writeBuffer at the bottom of your
  layout, and your layout isn't refreshed, then you won't get the javascript
  from the new view

  I am not sure if this is how it is supposed to work, but that's just what
  i've noticed

  On Tue, Dec 15, 2009 at 2:21 PM, Joe Theory joethe...@gmail.com wrote:
   I am having the same problem and can confirm that it happens
   specifically when using JQuery.   Using the Js Helper with Mootools
   works just fine.

   On Dec 14, 3:44 am, Scronkey scron...@gmail.com wrote:
I believe I know what's going on now but I'm not sure how to fix it.

On the first (successful)ajaxcall the next set of content is loaded,
including the paginator links, however the paginator links are not
successfully bound to a jQueryajaxcall, therefore the next click
results in a normal page request which then results in correctly bound
events.

Marks post mentions the use of 'evalScripts' = true to chain theajax
requests however this seems to have no effect with jQuery (his example
uses MooTools).

Is there a way I can ensure the events are rebound using jsHelper with
jQuery after theajaxcall?

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
   with their CakePHP related questions.

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

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

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


Accessing variables in referenced tables in views

2010-08-17 Thread Andrew Alexander
I am attempting to create a forum in php. In my project I have tables:
threads, posts, users. And each post has a foreign key for a thread
and a user. In my thread view I want to replace the user_id field with
the corresponding username for each post. I've tried echo
$post['User']['username']; but that gives me an error.

Is there a way to access the username variable from the thread view?


Here's the code I have in view now:
?php
$i = 0;
foreach ($thread['Post'] as $post):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class=altrow';
}
?
tr?php echo $class;?
td?php echo $post['subject'];?/td
td?php echo $post['body'];?/td
td?php echo $post['created'];?/td
td?php echo $post['user_id']; ?/td
td class=actions
?php echo $this-Html-link(__('View', true), 
array('controller'
= 'posts', 'action' = 'view', $post['id'])); ?
?php echo $this-Html-link(__('Edit', true), 
array('controller'
= 'posts', 'action' = 'edit', $post['id'])); ?
?php echo $this-Html-link(__('Delete', true),
array('controller' = 'posts', 'action' = 'delete', $post['id']),
null, sprintf(__('Are you sure you want to delete # %s?', true),
$post['id'])); ?
/td
/tr
?php endforeach; ?

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

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


School for CakePHP NY

2010-08-17 Thread NYCProgie
Hi All, does anyone know of a school in the NY that teaches CakePHP?

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

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


Problem calling ModelA-find('list') with a belongTo ModelB with a specific conditions

2010-08-17 Thread Mariano
Hello,

I have a ModelA with a belongTo with a condition, like:

class ModelA extends AppModel {
 var $name = 'ModelA';
 var $belongsTo = array( 'ModelB' = array ('type' = 'inner',
'conditions' = array ( 'ModelB.id' = '1' ) ) );
}

calling

ModelA-find('all) the query is executed as follow:

SELECT ... AS ... FROM `model_a` AS `ModelA` inner JOIN `model_b` AS
`ModelB` ON (`ModelA`.`model_b_id` = `ModelB`.`id` AND `ModelB`.`id` =
1) WHERE 1 = 1

but calling:

ModelA-find('list') the query is executed in an other  way (which I
think is wrong):

SELECT ... AS ... FROM `model_a` AS `ModelA` WHERE 1 = 1

without the JOIN and the ON condition.

Is this a bug? Is something wrong in my code?

Thanks and Regards,
Mariano.-

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

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


Componente Auth

2010-08-17 Thread Oscar
Buen día, empecé a utilizar el framework cakephp hace unos meses y
actualmente he concluido con una aplicación, en esta manejo el
componente Auth, pero al parecer hay un pequeño bug que no he logrado
detectar, el problema radica en que se pierde la sessión y por lo
tanto me saca del servidor, es decir me redirecciona al login de mi
sitio, ¿alguien tiene alguna idea de cual pudiera ser el problema?

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

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


Problem with start cakePHP

2010-08-17 Thread Skiner
Hi,
 I trying  start  with cakePHP with this tuto.
http://www.ibm.com/developerworks/opensource/tutorials/os-php-cake1/section2.html


an .. I have two problems:

1. I can't connect  to postgreSQL,
this is part  from my database.php

class DATABASE_CONFIG {

var $default = array(
'driver' = 'postgres',
'persistent' = false,
'host' = 'localhost',
'login' = 'cake_adm',
'password' = 'test.2010',
'database' = 'cake_db1',
'prefix' = '',
);
}
And info from page:
Your database configuration file is present.
Cake is NOT able to connect to the database.

I have installed php-pgsql,  Im using phpPgAdmin to manage my  db.  I
can login  with this login and password, creating table etc. but
cakePHP can't connect , I don't  know why


And my 2nd problem :

I using Fedora 13,  on this ystem on default med rewrite is enable,
I edit  my  httpd.conf files and  set :

DocumentRoot /var/www/html

#
# Each directory to which Apache has access can be configured with
respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the default to be a very restrictive set of
# features.
#
Directory /
#Options FollowSymLinks
#AllowOverride None
  Options Indexes MultiViews
  AllowOverride All
  Order allow,deny
 Allow from all
/Directory

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
Directory /var/www/html
#
# Possible values for the Options directive are None, All,
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI
MultiViews
#
# Note that MultiViews must be named *explicitly* --- Options All
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes MultiViews

#
# AllowOverride controls what directives may be placed in .htaccess
files.
# It can be All, None, or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
/Directory



When  i execute :

[r...@mir conf]# httpd -M |grep rewrite
httpd: Could not reliably determine the server's fully qualified
domain name, using ::1 for ServerName
 rewrite_module (shared)
Syntax OK


I have instaled cakePHP  on /var/www/html :

[r...@mir conf]# ls /var/www/html/
app  cake  index.php  index.php~  plugins  README  test.php~  vendors

My .htaccess file :
[r...@mir conf]# cat  /var/www/html/app/.htaccess
IfModule mod_rewrite.c
RewriteEngine on
RewriteRule^$webroot/[L]
RewriteRule(.*) webroot/$1[L]
 /IfModule[r...@x51r conf]#


My PHP version:
[r...@mir conf]# php -v
PHP 5.2.13 (cli) (built: Mar  6 2010 12:40:51)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

I don't know how start, or where I made mistake ?

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

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


Auth problem

2010-08-17 Thread Oscar
Hello, I'm having problems with the Auth component it seems that the
session get lost because, I get out every time I use the aplication,
does someone have an idead about this problem?

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

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


$ajax-link inside a controller

2010-08-17 Thread deathwebo
Hello everyone. the thing goes like this : I have a menu in my wepage
that its always visible for  user navigation. In my app i have a Help
button in the menu, when you click that button it will appear a new
div with information of the place your visiting right now in the app,
depending on the information given by the $this-params['controller']
and $this-params['action'].

The thing is that that div is updated by the button in my menu, so its
an $ajax-link() but the thing is that i cant use ajax links in the
controller, and i dont want to refresh the page and nothing like that,
what can be done in these situation ? thanks everyone!

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

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


Re: Accessing variables in referenced tables in views

2010-08-17 Thread Andras Kende


Is your thread.php model has a belongsTo User ?

?php print_r($threads); ? is this prints the User array ?

Andras Kende
http://www.kende.com

On Aug 17, 2010, at 11:22 AM, Andrew Alexander wrote:

 I am attempting to create a forum in php. In my project I have tables:
 threads, posts, users. And each post has a foreign key for a thread
 and a user. In my thread view I want to replace the user_id field with
 the corresponding username for each post. I've tried echo
 $post['User']['username']; but that gives me an error.
 
 Is there a way to access the username variable from the thread view?
 
 
 Here's the code I have in view now:
   ?php
   $i = 0;
   foreach ($thread['Post'] as $post):
   $class = null;
   if ($i++ % 2 == 0) {
   $class = ' class=altrow';
   }
   ?
   tr?php echo $class;?
   td?php echo $post['subject'];?/td
   td?php echo $post['body'];?/td
   td?php echo $post['created'];?/td
   td?php echo $post['user_id']; ?/td
   td class=actions
   ?php echo $this-Html-link(__('View', true), 
 array('controller'
 = 'posts', 'action' = 'view', $post['id'])); ?
   ?php echo $this-Html-link(__('Edit', true), 
 array('controller'
 = 'posts', 'action' = 'edit', $post['id'])); ?
   ?php echo $this-Html-link(__('Delete', true),
 array('controller' = 'posts', 'action' = 'delete', $post['id']),
 null, sprintf(__('Are you sure you want to delete # %s?', true),
 $post['id'])); ?
   /td
   /tr
   ?php endforeach; ?
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

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

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


IIS7 Rewrite Wrong?

2010-08-17 Thread Matt
Maybe I am missing something but the code in the wiki for rewriting
URLs in IIS7 did not work for me.  I've been working all night on and
off and finally came up with this (I am an Apache guy and this is my
first rodeo with IIS URL rewriting):


?xml version=1.0 encoding=UTF-8?
configuration
system.webServer
 rewrite
rules
rule name=To Default stopProcessing=false
match url=^$ ignoreCase=false /
action type=Rewrite url=appdir/ 
logRewrittenUrl=true  /
/rule

rule name=Get regular files 
stopProcessing=false
match url=(.*) ignoreCase=false /
action type=Rewrite 
url=appdir/{R:1}
logRewrittenUrl=true  /
/rule

rule name=Go to Cake PHP 
stopProcessing=true
match url=appdir/(.*)$ 
ignoreCase=false /
conditions logicalGrouping=MatchAll
add input={REQUEST_FILENAME} 
matchType=IsDirectory
negate=true /
add input={REQUEST_FILENAME} 
matchType=IsFile
negate=true /
/conditions
action type=Rewrite 
url=index.php?url={R:1}
appendQueryString=true logRewrittenUrl=true  /
/rule
/rules
/rewrite
/system.webServer
/configuration

I think this is the right configuration.  Can someone else using using
IIS7 and URL Rewriting 2.0 verify that this works?  The problem with
the sample on the web site is that it doesn't correctly access images
and css.

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

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