setflash does not work

2008-02-24 Thread Tomka

Hello.

I'm using 1.2 beta and tried some baked code:

In my controller:
function view($id = null) {
$this-Session-setFlash(__(Invalid Place., true));
$this-redirect(array(action = index));
}

debug-Level is set to 2:
Configure::write('debug', 2);

If i request this action in the browser I'm directly redirected and
don't see the flash. What's wrong here?

Thanks for answers,

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



modRewrite issues on subdomain

2008-02-24 Thread duRqoo

Hello,

I've finished project(1.2.0.6311) for a client and now i'm trying to
run it on production host(shared-server). Unfortunately after setting
all up  i'm not able to make the site working. On the development
server everything works perfectly, but the production server is giving
me some unexpected errors.

If i try to load root page i get an error that there is no webroot
action in app controller, because it's trying to load app/webroot
extracted from REQUEST_URI as controller/action. If i add a parameter
to the URL, i get expected site and results (see below).

I've made a test code which i uploaded to both servers (development
and also production), to see how the rewrite engine handles url
requests. Both are running as subdomain, php5, modRewrite working,
everything is in it's place. I use these .htaccess files:

in /

   RewriteEngine on
   RewriteBase /
   RewriteRule^$ app/webroot/[L]
   RewriteRule(.*) app/webroot/$1 [L]

in /app

   RewriteEngine on
   RewriteBase /
   RewriteRule^$webroot/[L]
   RewriteRule(.*) webroot/$1[L]

in /app/webroot

   RewriteEngine On
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

I've run two URL requests for both servers. First withou parameters,
just to load root page, and Second with paramater so i'll be accessing
some inner page. And here are the results:


 Without Parameter = Root page 

+ DEVEL SERVER (http://test.binary-love.sk/)

[DOCUMENT_ROOT] = /services/www/www.binary-love.sk
[QUERY_STRING] =
[REQUEST_URI] = /
[SCRIPT_NAME] = /app/webroot/index.php

+ PRODUCTION SERVER  (http://reality.biely-dom.sk/)

[DOCUMENT_ROOT] = /data/web/biely-dom.sk/sub/reality
[QUERY_STRING] =
[REQUEST_URI] = /app/webroot/
[SCRIPT_NAME] = /app/webroot/index.php

 With Parameter = Inner page 

+ DEVEL SERVER (http://test.binary-love.sk/skuska)

[DOCUMENT_ROOT] = /services/www/www.binary-love.sk
[QUERY_STRING] = url=skuska
[REQUEST_URI] = /skuska
[SCRIPT_NAME] = /app/webroot/index.php

+ PRODUCTION SERVER (http://reality.biely-dom.sk/skuska)

[DOCUMENT_ROOT] = /data/web/biely-dom.sk/sub/reality
[QUERY_STRING] = url=skuska
[REQUEST_URI] = /app/webroot/skuska
[SCRIPT_NAME] = /app/webroot/index.php

As you can see production server is always prepending /app/webroot to
the [REQUEST_URI], which is smth that causes error described at the
beginning. I think i know the reason why it ends like this. When i
request root page, rewriteRule in /.htaccess sends me to /app/webroot.
The [REQUEST_URI] already contains /app/webroot which don't pass the
rewriteCond in /app/webroot/.htaccess, because it will treat the URL
request as directory and the rewriteRule in there is skipped. After
that dispatcher parse the [REQUEST_URI] and i'm getting my error.

Any1 knows what could cause this? or better to ask how can i get rid
of that /app/webroot prefix on production server. Must be smth with
configuration mod_rewrite or doc_root or vhost or apache i don't know.
I've deployed 3 other cakephp projects without problems, but here i'm
lost.

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



Re: setflash does not work

2008-02-24 Thread Daniel Hofstetter

Hi Tomka,

Do you have something like

$session-flash();

in your layout/view?

Hope that helps,

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



Re: generating a select statement for a user's country

2008-02-24 Thread Johan @ Notitia.nl

The following works for me:

$this-Dealer-Country-displayField = 'name';
$countries = $this-Dealer-Country-find('list');

$this-set('countries', $countries);


This will return an array like this:

Array
(
[1] = Netherlands
[2] = Belgium
[3] = Germany
[4] = France
)

The key is the Country.id and the value Country.name

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



Re: trouble with Attachments behavior/component

2008-02-24 Thread davidpersson

Hey,


 I don't know if that syntax is correct for overriding the defaults.

The syntax and how you're overriding the defaults is correct.

 Warning (2): Invalid argument supplied for foreach() [APP/models/
 behaviors/attachment.php, line 233]

This has been fixed in 0.40

 id  | 415
 model   | Showcase
 foreign_key | 234
 dirname | files/showcase/espana_keller_j
 basename| espana_keller_39692.mov
 checksum| 86fb86893fd829912145f303f39e869b
 mime_type   | video/quicktime
 thumbnail   | espana_keller_39692.png
 created | 2008-02-13 20:12:57.99675
 modified| 2008-02-13 20:12:57.99675

Your schema does not seem to be up to date with latest schema used by
the package. Have a look at config/sql/attachment.sql

I would recommend to that you download the latest attm release and try
again with latest cake from svn.

I didn't test if this behavior is compatible with other behaviors.
Seems that there is really an incompatiblity with Bindable causing
some troubles. I'll check this and maybe include a fix in one of the
next versions.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



HABTM Recursive on itself?

2008-02-24 Thread Mech7

I am doing a find on a Tag model.. and this finds all the articles on
the Article model, but is there a way to retrieve the articles with
the related tags inside the article array? Setting the recursive
higher does not work? :(
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Working with INNER JOIN tables

2008-02-24 Thread gmail (codehooligans)

Taka,

I'm fairly new to Cake myself but can tell you that is you have your  
model setup correct to link the tables then this INSERT, UPDATE,  
DELETE will be taken care of (see further below). If you are running  
the INNER JOIN as some custom code in the controller then you are  
pretty much on your own. From what I know at the moment.

As an example of a setup model here is one I'm working with. This is a  
model for my Accounts table. There are two other tables in the system:  
Residence and User. The Residence table contains a field/column of  
'account_id'. This is the foreign key to the Account Table. The Users  
table contains a field/column of 'residence_id' This is the foreign  
key to the Residence table.

So to sort of draw things out we have the following 3-tier  
relationship between the Account, Residence and User table

Account - Residence (account_id) - User (residence_id).

What all this means and how things work is when I write code in the  
controller for say the View function I pass in an account_id. When the  
Account record is read in it automagically read in the referenced row  
from the Residence and the User tables as well. All 3 table sets are  
included at one. Nothing to worry about. Hope all this helps. And  
really I've only been working with Cake about a month. I'm sure one of  
the more experienced users on this list will comment I'm total F'in  
wrong.

Below is my actual model code. This was generated using the bake  
command. Note I had the MySQL tables already setup.


function view($id = null) {
if (!$id) {
$this-Session-setFlash('Invalid id for Account.');
$this-redirect('/accounts/index');
}
$this-set('account', $this-Account-read(null, $id));
}




?php
class Account extends AppModel {

var $name = 'Account';

//The Associations below have been created with all possible keys,  
those that are not needed can be removed
var $hasOne = array(
'Residence' =
array('className' = 'Residence',
'foreignKey' = 'account_id',
'conditions' = '',
'fields' = '',
'order' = '',
'dependent' = ''
),
'User' =
array('className' = 'User',
'foreignKey' = 'residence_id',
'conditions' = '',
'fields' = '',
'order' = '',
'dependent' = ''
),

);

}
?






On Feb 23, 2008, at 9:00 PM, takabanana wrote:


 Bueller?  :-)  Can anyone help, or point me in the right direction?
 Thanks!

 -taka

 On Feb 22, 1:06 am, takabanana [EMAIL PROTECTED] wrote:
 How does CakePHP handle (or With CakePHP, how do you do...) INSERT,
 UPDATE, and DELETE across multiple tables with an INNER JOIN query?

 sorry - still very very new to CakePHP.  Looking for books/tutorials
 in working with INNER JOIN table queries since my projects use  
 those a
 TON.

 Thanks for any help/pointers!

 -taka
 


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



Re: Cake 1.2 Console - Fatal Errors - Possible Bug?

2008-02-24 Thread Alan Gibson


Make sure your svn:externals property is uses the repository at
https://svn.cakephp.org/repo/branches/1.2.x.x/cake. I had the same
problem as you where I was stuck at revision 6311, although svn
reported that I was at the latest revision, because I was using the
trunk.

From the root directory of your cake install, do `svn propedit
svn:externals cake` then paste: cake 
https://svn.cakephp.org/repo/branches/1.2.x.x/cake

Now Im really at the latest revision.

On Jan 4, 10:16 am, Larry E. Masters aka PhpNut [EMAIL PROTECTED]
wrote:
 A duplicate ticket...Read my comment in the ticket

 On Jan 4, 2008 10:15 AM, Cake Fan [EMAIL PROTECTED] wrote:





  I submitted a ticket on this problem:

 https://trac.cakephp.org/ticket/3828

  - Cake Fan

  On Jan 4, 11:16 am, Cake Fan [EMAIL PROTECTED] wrote:
   I'm a little confused about this, perhaps I'm missing something... but
   when I update via svn, this fix doesn't happen in my core library.
   For instance, I just looked at line 30 in schema.php (bug fix 6319)
   and the string class is not included after I updated.

   However, I manually added the 'string' class on my box in schema.php
   and it still didn't solve the problem in the console.

   - Cake Fan

   On Jan 3, 5:00 pm, Christian Winther [EMAIL PROTECTED] wrote:

It looks related
  tohttps://trac.cakephp.org/ticket/3793andchangesethttps://trac.cakephp

-Original Message-
From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On
  Behalf Of Cake Fan
Sent: 3. januar 2008 22:57
To: Cake PHP
Subject: Re: Cake 1.2 Console - Fatal Errors - Possible Bug?

Christian,

I am at Revision 6319, but the console still says 6311.  I am only
updating the cake folder, so I'm not changing the app or vendors
folders at all.  Am I missing something here because the problem still
persists after I updated as you suggested.

Thanks for the help!

- Cake Fan

On Jan 3, 3:32 pm, Christian Winther [EMAIL PROTECTED] wrote:
 Update to SVN head from 1.2 branch, was fixed there :)

 -Original Message-
 From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED]
  On Behalf Of Cake Fan
 Sent: 3. januar 2008 22:20
 To: Cake PHP
 Subject: Cake 1.2 Console - Fatal Errors - Possible Bug?

 I have my cake 1.2 shell script working properly in most regards; it
 will help me immensely in converting a large flat table into
 relational data for Cake consumption.

 However, in the shell, whenever I try to call any of the Model query
 commands, I get a failure.

 So far, it has happened with findCount(), find(), findall(), save(),
 and saveall();  The problem seems to be inconsistent and no matter
 what I try or eliminate, it seems to persist.

 My shell script ultra-simplified to this:

  --
 function main() {

$i = 0;
while ($i  1000) {
$formatted_data_array = array (
 'Business' =  array ('name' = 'test')
   );
$this-Business-save($formatted_data_array, false);
$i++;
}
 }

  --

 It will save one time successfully, and then errors out.  I get the
 following error message from the console:

 ++
 C:\Apache\htdocs\project\appcake raw_data

 Welcome to CakePHP v1.2.0.6311 beta Console
 ---
 App : app
 Path: C:\Apache\htdocs\project\app
 ---
 PHP Fatal error:  Class 'String' not found in
  C:\Apache\htdocs\project
 \cake\libs\model\datasources\dbo_source
 .php on line 1455

 Fatal error: Class 'String' not found in
  C:\Apache\htdocs\project\cake
 \libs\model\datasources\dbo_source.php
 on line 1455

 C:\Apache\htdocs\project\app
 +

 Any help would be greatly appreciated!

 - Cake Fan

 --
 /**
 * @author Larry E. Masters
 * @var string $userName
 * @param string $realName
 * @returns string aka PhpNut
 * @access  public
 */

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



Probably a simple question on table relationships

2008-02-24 Thread Vitved

Hi everyone

I'm doing a website for a friend, and wanted to try out cakephp, but
i've ended up in a dead-end.
I have a table containing dog-races. Some of the characteristics of a
given race is referred to another table e.g. size.

I've figured out how to grab the data in the size table and use the
id values when I want to add a new race. the referencing numbers also
get put in table and are correct.

The problem comes when i make my view. I can't wrap my head around how
to translate the numbers in my race-table to the corresponding id in
the size table.

Hope someone understands my ramblings and are able to point me in the
right direction.

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



route not working.. cannot find anybody else with same problem

2008-02-24 Thread Cefleet

Ok I tried to follow this example.
http://bakery.cakephp.org/articles/view/taking-advantage-of-the-pages-controller
to get rid of the pages name
but my problem is I didn't know where to put this.
   $Route-connect('/*', array('controller' = 'pages', 'action' =
'display'));
so i just tried to go straight to the route.php file and do this as my
last thing in the file:
Router::connect('/*', array('controller' = 'pages', 'action' =
'display'));
but when I do that i get an empty page, I mean completely empty.
so has anybody else had this issue?
I have a hunch it may have something to do with my .htaccess file but
I have not been a server admin long so I don't fully understand
modrewrite too well.

This  is my web root .htacces file.

IfModule mod_rewrite.c
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
/IfModule

I tried to change the last RewriteRule to say
^(.*)$ PATH_TO_MY_APP/index.php?url=$1 [QSA,L]
and
^(.*)$ PATH_TO_MY_WEB_ROOT/index.php?url=$1 [QSA,L]

and still nothing.

//this is my app htaccess
IfModule mod_rewrite.c
RewriteEngine on
RewriteRule^$webroot/[L]
RewriteRule(.*) webroot/$1[L]
 /IfModule


//this is all that is not commented out in router.php
Router::connect('/', array('controller' = 'pages', 'action' =
'display', 'home'));
Router::connect('/*', array('controller' = 'pages', 'action' =
'display'));

when I have

Router::connect('/pages/*', array('controller' = 'pages', 'action' =
'display'));

everything works fine but I have /pages/nameOfPage for all of my
static page.

Can anybody please help me?

for reference I have the advanced setup. (
cake in:
 /usr/lib/cake/

and my apps go in:
 /home/myname/CakeApps/NameOfApp

and then the webroot part :
/var/www/nameOfApp

using Apache2, PHP5 Ubuntu 7.10 Athlon64, 2 gig ram, som HD space.
logitech keyboard and mouse, old Altec Lansing speaker, on a homade
desk, with a Santa cup of Coffee made by maxwell house. if you need
any more information you are problably just being nosy.
thanks in advance.

-clint

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



Re: filling an array for a selectbox (v1.2)

2008-02-24 Thread Ronald

I know that, but the data does not come from my database, but from an
API that delivers it in a specific format.
I just need to know what I have to do with the $issuerArray to turn it
over to another array that I can return to the controller that is
calling this component and from there use it to fill my selectbox in
the view.

The $issuerArray looks like this:

Array
(
[0] = IssuerBean Object
(
[issuerID] = 0151
[issuerName] = Issuer Simulator
[issuerList] = Short
)
)

The best thing I've come to is this:

--- in my component function doDirectoryrequest(): ---

for($i = 0; $i  count($issuerArray); $i++)
{
$keys[$i] = $issuerArray[$i]-issuerID;
$values[$i] = $issuerArray[$i]-issuerName;
}

$issuers = array_combine($keys, $values);

return $issuers;

--- in my controller: ---

$this-set('result', $this-Ideal-doDirectoryrequest());

--- in my view: ---

?php echo $form-select('issuer', array('options' = $result,
array(), array(), false)); ?

---

This is resulting in this html code:
select name=data[issuer] id=issuer
option value=/option
optgroup label=options
option value=0151Issuer Simulator/option
/optgroup
optgroup label=1
/optgroup
option value=2/option
/select

But somehow there's a lot of stuff in there I don't want to have.
I just need this :
select name=data[issuer] id=issuer
option value=0151Issuer Simulator/option
/select

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



Re: filling an array for a selectbox (v1.2)

2008-02-24 Thread Dardo Sordi Bogado

Have you tried Set::combine($issuerArray, '{n}.issuerID', '{n}.issuerName' );

On 2/24/08, Ronald [EMAIL PROTECTED] wrote:

  I know that, but the data does not come from my database, but from an
  API that delivers it in a specific format.
  I just need to know what I have to do with the $issuerArray to turn it
  over to another array that I can return to the controller that is
  calling this component and from there use it to fill my selectbox in
  the view.

  The $issuerArray looks like this:

  Array
  (
 [0] = IssuerBean Object
 (
 [issuerID] = 0151
 [issuerName] = Issuer Simulator
 [issuerList] = Short
 )
  )

  The best thing I've come to is this:

  --- in my component function doDirectoryrequest(): ---


  for($i = 0; $i  count($issuerArray); $i++)
  {

 $keys[$i] = $issuerArray[$i]-issuerID;
 $values[$i] = $issuerArray[$i]-issuerName;
  }

  $issuers = array_combine($keys, $values);

  return $issuers;

  --- in my controller: ---

  $this-set('result', $this-Ideal-doDirectoryrequest());

  --- in my view: ---

  ?php echo $form-select('issuer', array('options' = $result,
  array(), array(), false)); ?

  ---

  This is resulting in this html code:
  select name=data[issuer] id=issuer
  option value=/option
  optgroup label=options
  option value=0151Issuer Simulator/option
  /optgroup
  optgroup label=1
  /optgroup
  option value=2/option
  /select

  But somehow there's a lot of stuff in there I don't want to have.
  I just need this :
  select name=data[issuer] id=issuer
  option value=0151Issuer Simulator/option
  /select


  


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



Re: Probably a simple question on table relationships

2008-02-24 Thread Dardo Sordi Bogado

Try a pr(); of the data fetched from db, also have a look at :

http://manual.cakephp.org (specially the blog tutorial)
http://book.cakephp.org

On 2/24/08, Vitved [EMAIL PROTECTED] wrote:

  Hi everyone

  I'm doing a website for a friend, and wanted to try out cakephp, but
  i've ended up in a dead-end.
  I have a table containing dog-races. Some of the characteristics of a
  given race is referred to another table e.g. size.

  I've figured out how to grab the data in the size table and use the
  id values when I want to add a new race. the referencing numbers also
  get put in table and are correct.

  The problem comes when i make my view. I can't wrap my head around how
  to translate the numbers in my race-table to the corresponding id in
  the size table.

  Hope someone understands my ramblings and are able to point me in the
  right direction.

  


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



Re: HABTM Recursive on itself?

2008-02-24 Thread Marcos Hernández





Hi!!

Y have the same problem here. I works fine if you don't set any
conditions, but there's no way if you try to filter (WHERE). The best
solution I've found googling was to change the relationship from HABTM
to a HasMany/BelongsTo combination. Well, I don't know what you think
but for me is a disappoiting one, so I decided to solve it with a
custom SQL query. 

Sorry mate, Cake is not perfect!!

Best regards!!

Mech7 escribi:

  I am doing a find on a Tag model.. and this finds all the articles on
the Article model, but is there a way to retrieve the articles with
the related tags inside the article array? Setting the recursive
higher does not work? :(


  


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





Re: Automagically

2008-02-24 Thread Dardo Sordi Bogado

C'mon the framework name is Cake (I love it), you can't complain
about automagically.

Altough this is not the place to ask, don't you think that in the
Requirements section of the manual also should say Sense of humor ?

LOL

On 2/23/08, BlenderStyle [EMAIL PROTECTED] wrote:

  I actually like the term automagically. To me, automagically means
  the Cake team did something really convenient to help out us
  developers. For example, the way the form helper input method
  automagically figures out what kind of input to make is amazing. All I
  have to do in my view is $form-input('password'); and it does the
  rest automatically like it's magic or something. But of course, it's
  not magic. It's automagic.

  Matt

 


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



Re: Eclipse 3.3.1 and Cake PHP 1.2

2008-02-24 Thread Dardo Sordi Bogado

I've followed that article and it works great. I'm not an expert in
eclipse, my only experience with it was that tutorial. So, once it
worked, never touched it again.

I have this directory layout:
$HOME/php/ --- the webroot and eclipse workplace
   cake (the core)
   project1 (app for project1)
   project2 (app for project2)

On 2/23/08, Technoguru [EMAIL PROTECTED] wrote:

  I have been following the tutorial at
  http://bakery.cakephp.org/articles/view/setting-up-eclipse-to-work-with-cake,
  in order to setup a cakePHP and Eclipse Environment that will give me
  the ability to use cakePHP code completion, as well as run the bake
  script in the Eclipse Workspace.  However it does not seem to work.  I
  am using CakePHP 1.2 and Eclipse 3.3.1 on a Windows XP, that has
  Apache, PHP, and MYSQL already installed.  I get to the point labeled
  Defining projects in the tutorial, and can't get cake and my project
  to link up.
   Can someone explain how my files need to be setup (where do I place
  the core, and where my projects go in relation to it), how to link the
  cake core files into my project so I have access to its classes, how
   to verify that the link was made, and finally the syntax to setup the
  bake script.  The more detail, the better.  Thank you very much.

  UPDATE

  I have made some progress, but the controller still does not inherit
  the core classes. Here is how far I have gotten:
  1. I installed Eclipse PDT
  2. I noticed that I was on the PHP navigator and not the PHP explorer
  initially, so I opened the explorer by going to Windows - Show View -
   Other - PHP Explorer (Under PHP tools)

  3. I had to convert the project to a PDT project in order to get the
  Include Path ability. Right click the project, and click Convert to
  PDT project. Now if you right click you will see the Include
  Pathoptions.
  After including the path to the cake core, it stills seems like it is
  not working. I look in the Outline, and the core classes are not
  present, and auto complete does not work. Can someone please help us
  out. Thanks.
  


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



Re: HABTM

2008-02-24 Thread Ape

Hi Villas,

HABTM works without any problem. Maybe because I was just being lazy
and just 'baked' my models. Hereby a working example of a working
HABTM model:

article.php:
class Article extends AppModel {

var $name = 'Article';
var $useTable = 'articles';
var $primaryKey = 'article_ID';
var $hasAndBelongsToMany = array(
'Tag' = array('className' = 'Tag',
'joinTable' = 'articles_tags',
'foreignKey' = 'article_ID',
'associationForeignKey' = 
'tag_ID',
'unique' = true ) ); }

tag.php:
class Tag extends AppModel {

var $name = 'Tag';
var $useTable = 'tags';
var $primaryKey = 'tag_ID';
var $hasAndBelongsToMany = array(
'Article' = array('className' = 'Article',
'joinTable' = 'articles_tags',
'foreignKey' = 'tag_ID',
'associationForeignKey' = 
'article_ID',
'unique' = true )); }

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



Re: Eclipse 3.3.1 and Cake PHP 1.2

2008-02-24 Thread Ape

Hi Technoguru,

I hope I understood your problem right:

Have you setup Eclipse to use the phpeditor as editor for *.thtml ,
*.ctp and *.php files? See instructions on the article you mentioned:
http://bakery.cakephp.org/articles/view/setting-up-eclipse-to-work-wi...

If so: does the outline windows just say 'outline not available' or
just nothing. Nothing means that you didn't have a functions, class
etc in the current document. 'outline not available' means that it
doesn't recognize the file as being php.

Have you called a core-class in your document? otherwise you won't see
it in the ouline
Do you use Crtl-Space for autocomplete?
Is cake listed in the Include Path folder in the explorer windows?

NB: I always - File: import: 'import as existing project' my apps.

Cheers,
Ape




On Feb 23, 5:26 pm, Technoguru [EMAIL PROTECTED] wrote:
 I have been following the tutorial 
 athttp://bakery.cakephp.org/articles/view/setting-up-eclipse-to-work-wi...,
 in order to setup a cakePHP and Eclipse Environment that will give me
 the ability to use cakePHP code completion, as well as run the bake
 script in the Eclipse Workspace.  However it does not seem to work.  I
 am using CakePHP 1.2 and Eclipse 3.3.1 on a Windows XP, that has
 Apache, PHP, and MYSQL already installed.  I get to the point labeled
 Defining projects in the tutorial, and can't get cake and my project
 to link up.
  Can someone explain how my files need to be setup (where do I place
 the core, and where my projects go in relation to it), how to link the
 cake core files into my project so I have access to its classes, how
  to verify that the link was made, and finally the syntax to setup the
 bake script.  The more detail, the better.  Thank you very much.

 UPDATE

 I have made some progress, but the controller still does not inherit
 the core classes. Here is how far I have gotten:
 1. I installed Eclipse PDT
 2. I noticed that I was on the PHP navigator and not the PHP explorer
 initially, so I opened the explorer by going to Windows - Show View -

  Other - PHP Explorer (Under PHP tools)

 3. I had to convert the project to a PDT project in order to get the
 Include Path ability. Right click the project, and click Convert to
 PDT project. Now if you right click you will see the Include
 Pathoptions.
 After including the path to the cake core, it stills seems like it is
 not working. I look in the Outline, and the core classes are not
 present, and auto complete does not work. Can someone please help us
 out. Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HABTM Recursive on itself?

2008-02-24 Thread Mech7

Ah to bad :p i guess i will have to write queries again hehe :)

On Feb 24, 2:52 pm, Marcos Hernández [EMAIL PROTECTED]
wrote:
 Hi!!
 Y have the same problem here. I works fine if you don't set any conditions, 
 but there's no way if you try to filter (WHERE). The best solution I've found 
 googling was to change the relationship from HABTM to a HasMany/BelongsTo 
 combination. Well, I don't know what you think but for me is a disappoiting 
 one, so I decided to solve it with a custom SQL query.
 Sorry mate, Cake is not perfect!!
 Best regards!!
 Mech7 escribió:I am doing a find on a Tag model.. and this finds all the 
 articles on the Article model, but is there a way to retrieve the articles 
 with the related tags inside the article array? Setting the recursive higher 
 does not work? :(
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Congratulations to gwoo

2008-02-24 Thread Ugo PARSI

For his excellent presentation @ FOSDEM 2008 this afternoon.

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



How do I get a list of fields using the describe function?

2008-02-24 Thread Carl

I guess the real question is what do I pass as a reference to the
model? I tried passing $this-Model and $this-Model and neither
one works.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HABTM

2008-02-24 Thread villas

Corie,I tried your test,  but it still did NOT work!  Any more
ideas?
The only thing I can think of is that HABTM doesn't work with
Firebird.
I suppose I'll have to load the same test with MySql and verify that.
I'll let you know.
As I said previously,  all the SQL queries seem to fire correctly,
the data just doesn't seem to get placed into the array.

Thanks for posting the code,  I didn't realise that it should work
with so few parameters,  but I guess that's the benefit of the Cake
Conventions.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HABTM

2008-02-24 Thread b logica

Perhaps you need to rename the join table to groups_users (ie. lowercase).

It does not require a PK, though.

On Sun, Feb 24, 2008 at 11:59 AM, villas [EMAIL PROTECTED] wrote:

  Hi Ape,

  I tried your test too.  I substituted groups and users in place of
  your artices tags,  of course.
  Did NOT work.

  Here is my latest model for group.php:

 class Group extends AppModel {
 var $name = 'Group';
 var $useTable = 'groups';

 var $hasAndBelongsToMany = array(
 'User' = array(
 'className' = 'User',

 'joinTable' = 'groups_users',
 'foreignKey' = 'group_id',
 'associationForeignKey' = 'user_id',
 'unique' = true
 )
 );
  }

  I set up a something similar in user.php, although I think I'm right
  in saying that the user model is irrelevant if I'm just accessing this
  through the URL http://localhost/cakebeta/groups/index   Here's what I
  get back:

  Array
  (
 [0] = Array
 (
 [Group] = Array
 (
 [id] = 1
 [name] = Administrators
 )

 [User] = Array
 (
 )
 )
  ..

  Here is the data in my GROUPS_USERS table:

  GROUP_IDUSER_ID
  1   1
  2   1
  2   2
  3   1
  3   2
  3   4

  There should have been a user listed for group 1,  but the whole
  [User] is blank.  I wondered whether the GROUPS_USERS table should
  have a primary key,  so I made one across the two fields -- but no
  joy.

  Surely there must be a way to understand why the data is not getting
  into the array. Maybe I need to try and debug through the api
  somehow?  As I said,  I am beginning to think this must be something
  to do with the fact that I'm using Firebird.

  Regards,  villas


 


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



Re: How do I get a list of fields using the describe function?

2008-02-24 Thread the_woodsman

I assume you mean passing a model to a view?

This is generally discouraged, in favour of getting whatever
information you need from the model in the controller, and passing it
on to the view.

You'd have to describe your issue more fully, or search the board more
thoroughly - there's plenty of posts on this floating around: someone
very recently was talking about accessing the Model schema in a
Helper...



On 24 Feb, 15:25, Carl [EMAIL PROTECTED] wrote:
 I guess the real question is what do I pass as a reference to the
 model? I tried passing $this-Model and $this-Model and neither
 one works.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do I get a list of fields using the describe function?

2008-02-24 Thread Chris Hartjes

On Sun, Feb 24, 2008 at 10:25 AM, Carl [EMAIL PROTECTED] wrote:

  I guess the real question is what do I pass as a reference to the
  model? I tried passing $this-Model and $this-Model and neither
  one works.

If you are using CakePHP 1.2, you can do the following:

$this-Model-schema()

and it returns you metadata containing the field names

http://api.cakephp.org/1.2/class_model.html#fea8b01f6b5612d6041eed6f6e29d9d6


Hope that helps.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: Moving from herding elephants to handling snakes...
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Re: route not working.. cannot find anybody else with same problem

2008-02-24 Thread b logica

On Sun, Feb 24, 2008 at 12:31 AM, Cefleet [EMAIL PROTECTED] wrote:

  Ok I tried to follow this example.
  
 http://bakery.cakephp.org/articles/view/taking-advantage-of-the-pages-controller
  to get rid of the pages name
  but my problem is I didn't know where to put this.
$Route-connect('/*', array('controller' = 'pages', 'action' =
  'display'));
  so i just tried to go straight to the route.php file and do this as my
  last thing in the file:
  Router::connect('/*', array('controller' = 'pages', 'action' =
  'display'));
  but when I do that i get an empty page, I mean completely empty.
  so has anybody else had this issue?

If you're seeing a completely blank page I'd suggest having a look at
Apache's (not Cake's, though it couldn't hurt) error log.

  I have a hunch it may have something to do with my .htaccess file but
  I have not been a server admin long so I don't fully understand
  modrewrite too well.

  This  is my web root .htacces file.

  IfModule mod_rewrite.c
 RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
  /IfModule

  I tried to change the last RewriteRule to say
  ^(.*)$ PATH_TO_MY_APP/index.php?url=$1 [QSA,L]
  and
  ^(.*)$ PATH_TO_MY_WEB_ROOT/index.php?url=$1 [QSA,L]

  and still nothing.

  //this is my app htaccess
  IfModule mod_rewrite.c
 RewriteEngine on
 RewriteRule^$webroot/[L]
 RewriteRule(.*) webroot/$1[L]
   /IfModule


Before you take this any further, replace all of that with a clean
install (at least, those files) or you could be going in circles for a
long time.


  //this is all that is not commented out in router.php
  Router::connect('/', array('controller' = 'pages', 'action' =
  'display', 'home'));
  Router::connect('/*', array('controller' = 'pages', 'action' =
  'display'));

I'm not sure how to help with that. For my site, I've decided to just
explicitly set out all of the routes that I want the Pages controller
to handle. Well, sort of explicitly. This works, for example:

Router::connect('/about', array('controller' = 'pages', 'action' =
'display', 'about/index'));
Router::connect('/about/*', array('controller' = 'pages', 'action' =
'display', 'about'));

The second route handles requests for anything in or below the 'about'
directory (which goes another level deeper). So I have all of those
views stored in the app/webroot/views/pages/about directory.

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



Re: How do I get a list of fields using the describe function?

2008-02-24 Thread Carl

I searched the forum before posting, but didn't find an answer to my
question. And I am talking about getting the info in the controller,
not the view. The API says that I should pass a reference to the model
to the describe function, but nothing I pass seems to work. I thought
the model is $this-ModelName so I passed $this-MODELNAME but it
doesn't work. So I assume it's looking for something else. I just
don't know what.

On Feb 24, 9:26 am, the_woodsman [EMAIL PROTECTED] wrote:
 I assume you mean passing a model to a view?

 This is generally discouraged, in favour of getting whatever
 information you need from the model in the controller, and passing it
 on to the view.

 You'd have to describe your issue more fully, or search the board more
 thoroughly - there's plenty of posts on this floating around: someone
 very recently was talking about accessing the Model schema in a
 Helper...

 On 24 Feb, 15:25, Carl [EMAIL PROTECTED] wrote:

  I guess the real question is what do I pass as a reference to the
  model? I tried passing $this-Model and $this-Model and neither
  one works.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: trouble with Attachments behavior/component

2008-02-24 Thread b logica

My take on the documentation was that the behavior supported additions
to the table schema (and that group was optional). I'll try it with
the default.

This is how I'm making it work for the moment. This is included in my
controller action right after doing a find():

$sql = 'SELECT dirname, basename FROM attachments '
. WHERE model = 'MemberProfile' AND foreign_key =
{$member['MemberProfile']['id']};

$member['Attachment'] = Set::extract($this-Member-query($sql), '0.0');

$this-set('member', $member);

I haven't tried to save anything with this model yet, though.

On Sun, Feb 24, 2008 at 8:18 AM, davidpersson [EMAIL PROTECTED] wrote:

  Hey,


  
   I don't know if that syntax is correct for overriding the defaults.
  
  The syntax and how you're overriding the defaults is correct.


   Warning (2): Invalid argument supplied for foreach() [APP/models/
   behaviors/attachment.php, line 233]
  
  This has been fixed in 0.40


   id  | 415
   model   | Showcase
   foreign_key | 234
   dirname | files/showcase/espana_keller_j
   basename| espana_keller_39692.mov
   checksum| 86fb86893fd829912145f303f39e869b
   mime_type   | video/quicktime
   thumbnail   | espana_keller_39692.png
   created | 2008-02-13 20:12:57.99675
   modified| 2008-02-13 20:12:57.99675
  
  Your schema does not seem to be up to date with latest schema used by
  the package. Have a look at config/sql/attachment.sql

  I would recommend to that you download the latest attm release and try
  again with latest cake from svn.

  I didn't test if this behavior is compatible with other behaviors.
  Seems that there is really an incompatiblity with Bindable causing
  some troubles. I'll check this and maybe include a fix in one of the
  next versions.


 


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



Re: Problems creating records Cake 1.2 on postgres

2008-02-24 Thread b logica

I have to wonder if 'action' is acting like a keyword to disrupt things.

On Sat, Feb 23, 2008 at 10:34 PM, Bruce [EMAIL PROTECTED] wrote:

  Since the last message, I have created a new table, model, controller
  and views from scratch with new names and the same structure - the
  problem still exists.

  Table name is job_actions, with a serial field called 'id' (was called
  'job_histories' last time).
  Sequence name (created by postgres) is 'job_actions_id_seq'.
  Model is just the bare bones and is called 'job_action.php'.
  Controller and views were built with bake. Controller name is
  'job_actions.php'.

  All DB ownership seems to be in order with the user defined in cake
  owning the table and the sequence.

  As you say, it looks like it is not reading the names of the sequence
  correctly somewhere along the line.



  


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



Re: where is data from AJAX POST?

2008-02-24 Thread b logica

Right you are. I just went back and checked and found it in
$this-params['form']. That was one of the first things I checked,
though. But I've fiddled around a bit, so there was probably something
else misconfigured when I checked that array.

Thanks!

On Sat, Feb 23, 2008 at 9:50 PM, Dardo Sordi Bogado
[EMAIL PROTECTED] wrote:

  Didn't try it, but I think it's in $this-params['form'], anyway they
  also should be in $_POST.



  On 2/23/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  
I'd like to be able to POST some data periodically using jQuery ajax
calls. The URL contains an ID that is parsed out in the route, so the
controller should receive a value for $this-params['id'].
  
But how do I grab the values for the data I've POSTed? I thought it
would be in $this-data or might be in $this-RequestHandler-params[]
but that seems not to be the case. Because this is ALAX i'm finding it
difficult to debug this.
  
Note that I'm not using Cake's AJAX form creation or anything like
that. I don't see how that would fit with what I'm trying to do. This
isn't for submitting the entire form or saving the model, but for
making incremental saves of data in a textarea (TinyMCE). Think CMS.

  

  


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



Re: Problems creating records Cake 1.2 on postgres

2008-02-24 Thread Chris Hartjes

On Sat, Feb 23, 2008 at 10:34 PM, Bruce [EMAIL PROTECTED] wrote:

  As you say, it looks like it is not reading the names of the sequence
  correctly somewhere along the line.

I ran into this using postgres as well.  Just make sure to define the
sequence in the model itself

var $sequence = 'name of sequence';


-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: Moving from herding elephants to handling snakes...
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Re: filling an array for a selectbox (v1.2)

2008-02-24 Thread Ronald

I just tried that. Now I don't need the for loop, but it still gives
me the same result.

On 24 feb, 14:38, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
 Have you tried Set::combine($issuerArray, '{n}.issuerID', '{n}.issuerName' );

 On 2/24/08, Ronald [EMAIL PROTECTED] wrote:


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



Re: cakephp 1.2 form

2008-02-24 Thread mason k

Thanks for the answer, but I'd love a little more guidance myself.
Can you answer OP's Q1, which is the difference between $ajax-form
and $ajax-submit?

Also, please explain the $this-render('view','ajax'); line of code?
There is nothing in the API (http://api.cakephp.org/1.2/
class_controller.html#90046e6b62c91452a987c9573372c2ac) about a
special 'ajax' value as a layout option.  What does this do?  Does it
render no layout if the request was ajax?  How does the action know
whether an incoming request is coming from an Ajax source or not?


On Feb 23, 4:54 pm, b logica [EMAIL PROTECTED] wrote:
 Try this to close your controller action:

 $this-render('VIEW', 'ajax');

 where VIEW is the name of your view. (or element?)

 On Sat, Feb 23, 2008 at 12:30 PM, brammeleman [EMAIL PROTECTED] wrote:

   I'm trying to create a simpleAjaxbasedform. These are the steps
   I've taken along with the questions that came up:

   I've managed to get the forms' content into a div element. Done by
   creating an 'ajax' instead of an 'html' link. When I submit theform,
   I get redirected back to the index view showing the modified or added
   record. All fine!
   But, when theformvalidation fails, I get redirected to theform
   directly rendered into the layout (instead of in the div element).

   To solve this problem, I've replaced the $form-create helper call by
   the $ajax-formhelper call in theformview.  Telling the $ajax-form
   function to update the div element.

   Q1) what's the difference in using $ajax-formand $ajax-submit?
   should one of them be used exclusively? or do they need to be used in
   a pair (like $form-create and $form-end)?

   Now it works nice when theformvalidation fails. But when the
   submitted data validates, the redirected (index) page gets rendered in
   the div. The funny thing is that somehow the requesthanler doesn't
   know it's anajaxrequest. It renders the content in the default
   layout.

   I'm obviously missing the point somewhere
   Q2) how can you make sure thatformstays in the div, but when it
   validates you get a non-ajaxredirect?

   Thanks for your help,

   Bram

   ps: someone else apparently posted a similar question in the bin:
   http://bin.cakephp.org/saved/521

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



Is it possible to create a fileController for URL's like mycms/files/ ...?

2008-02-24 Thread smacks

Hi guys,

I'm currently working on a content management system (yah, I know ...)
and I would need to have the following URL's linked to a
fileController, because I would need the users to be able to manage
the files on their webserver.

URL's:
mycms/files (linked to action-index in fileController)
mycms/files/edit/1 (linked to action-edit in fileController)
etc ...

The problem is, whenever I goto mycms/files I get redirected to
mycms/app/webroot/files/.
I tried to edit routes.php and set things manually, but it doesn't
seem to work?

Any help appreciated. Please!

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



Re: Is it possible to create a fileController for URL's like mycms/files/ ...?

2008-02-24 Thread Pablo Viojo
This happens because a webroot/files folder exists. Try deleting the folder.

Regards,

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

On Sun, Feb 24, 2008 at 4:27 PM, smacks [EMAIL PROTECTED] wrote:


 Hi guys,

 I'm currently working on a content management system (yah, I know ...)
 and I would need to have the following URL's linked to a
 fileController, because I would need the users to be able to manage
 the files on their webserver.

 URL's:
 mycms/files (linked to action-index in fileController)
 mycms/files/edit/1 (linked to action-edit in fileController)
 etc ...

 The problem is, whenever I goto mycms/files I get redirected to
 mycms/app/webroot/files/.
 I tried to edit routes.php and set things manually, but it doesn't
 seem to work?

 Any help appreciated. Please!

 


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



Re: Error with Microsoft SQL Serveur

2008-02-24 Thread [EMAIL PROTECTED]

I don't understand the default database to 'master' for the login...

And how do you import a mysql database into microsoft sql server?

thanks in advance

Gil

On 22 fév, 12:21, Stege [EMAIL PROTECTED] wrote:
 On 21 Feb., 18:08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:



  Hello everybody,

  I developed an application on my mac with a mysql database.
  On my production server i have a microsoft sql serveur (it's a project
  for my school).

  My application work well with mysql but i have a problem with the
  microsoft mysql serveur. There is the error:

  --- 
  --- 
  --
  Query: SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES

  Warning (512): SQL Error: Le contexte de la base de données a été
  changé en 'FP7'. [CORE\cake\libs\model\datasources\dbo_source.php,
  line 440]
  --- 
  --- 
  --

  If anybody can help me, i have to use this server...

  Thanks a lot for your response.

  PS: Excuse me for my english, i'm french.

 Hi

 I had the same problem with my MSSQL2000 database. My error message
 vanished after setting the default database to 'master' for the login
 I'm using to connect to the database.
 The core problem was that the system tables INFORMATION_SCHEMA were
 missing. I use an imported database, not a created one.

 Hope that works for you, too.

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



Re: Is it possible to create a fileController for URL's like mycms/files/ ...?

2008-02-24 Thread AD7six



On Feb 24, 8:27 pm, smacks [EMAIL PROTECTED] wrote:
 Hi guys,

 I'm currently working on a content management system (yah, I know ...)
 and I would need to have the following URL's linked to a
 fileController, because I would need the users to be able to manage
 the files on their webserver.

 URL's:
 mycms/files (linked to action-index in fileController)
 mycms/files/edit/1 (linked to action-edit in fileController)
 etc ...

 The problem is, whenever I goto mycms/files I get redirected to
 mycms/app/webroot/files/.

IfModule mod_rewrite.c
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d  --- Delete this line
from your webroot .htaccess file.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
/IfModule

hth,

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



Re: Is it possible to create a fileController for URL's like mycms/files/ ...?

2008-02-24 Thread smacks

Thanks guys! You helped me a lot.

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



Re: CakePHP v1.2 stable enough for production?

2008-02-24 Thread NOSLOW

One could argue that since the unit test coverage in 1.2 is much
higher than in 1.1, that 1.2 is more production ready than 1.1.  At
least that's what Nate said at CakeFest.

On Feb 23, 3:42 pm, Greg Baker [EMAIL PROTECTED] wrote:
 I know its beta..  But I'm wondering if people are using 1.2 in
 production environments?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Helping with sorting a table

2008-02-24 Thread swhit

Hello,

I am a complete newbie with CakePHP but am loving it so far! I have a
quick question:

I followed the quick 5 minute tutorial here:
http://www.grahambird.co.uk/cake/tutorials/scaffolding.php

This builds a quick example of a bookmarks manager. Which has a really
cool table layout that is obviously not generated by the Views/
bookmarks.ctp file since there isn't one. It is generated from Cake's
core index.ctp.

Now, I built another project based off of this tutorial from IBM (you
might have to register to view):
https://www6.software.ibm.com/developerworks/education/os-php-cake1/resources.html

While this tutorial builds the login form fine and creates the User
controllers, etc. It also has a Knownusers view that creates a quick
table showing all existing users. It looks like this:

- start of code -
h2List of Users/h2
p/p
table
?php
echo $html-tableHeaders(array_keys($knownusers[0]['User']));
echo 'pShowing all records out of '. $knownuserscount . ' total/
p';

foreach ($knownusers as $thisuser)
{
echo $html-tableCells($thisuser['User']);
}

?
/table
-- end of code --

Now, what I would like to do is easily use all the cool table features
(sorting, the action column, etc.) of the index.ctp file instead of
the knownusers.ctp file that it uses now. However, I cannot get any of
the commands to work within this file (i.e. paginator, etc.)

Is there any I can get this to work easily?

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



Re: Problems creating records Cake 1.2 on postgres

2008-02-24 Thread nate

Some older versions of Postgres won't tell you the sequence name for a
column (I think the earliest version I've tested on is 8.1 or so).  In
those cases, you need to do as Chris says, and provide the sequence
name in the model class using var $sequence.

On Feb 23, 12:12 pm, b logica [EMAIL PROTECTED] wrote:
 What is the model name you're dealing with here? The 'public' part of
 the query refers to the public schema and is used in creating the
 sequence name (from which the last value is to be gotten). It looks
 like something in your table name is causing Cake to come up with an
 incomplete sequence name:

 function lastInsertId($source, $field = 'id') {
         foreach ($this-__descriptions[$source] as $name = $sourceinfo) {
                 if (strcasecmp($name, $field) == 0) {
                         break;
                 }
         }

         if (isset($this-_sequenceMap[$source])) {
                 $seq = $this-_sequenceMap[$source];
         } elseif (preg_match('/^nextval\(\'(\w+)\'/', $sourceinfo['default'],
 $matches)) {
                 $seq = $matches[1];
         } else {
                 $seq = {$source}_{$field}_seq;
         }

         $res = $this-rawQuery(SELECT last_value AS max FROM \{$seq}\);
         $data = $this-fetchRow($res);
         return $data[0]['max'];

 }

 If you can, log into psql and type:

 \ds

 to see your sequence names. Maybe something's screwy there. Otherwise,
 it might be something you've set in your Cake app.

 On Sat, Feb 23, 2008 at 1:27 AM, Bruce [EMAIL PROTECTED] wrote:

   I am working in Cake 1.2 with PHP5 and a postgres backend DB. When I
   try to create records in any app I have tried, I get a warning then an
   SQL error. The record seems to be created in the db, but with my
   limited knowledge, it looks to me like cake is constructing an
   incomplete SQL statement when trying to retrieve the ID of the record
   just written.

   Output is like:

   Warning (2): pg_query() [function.pg-query]: Query failed: ERROR:
   relation public does not exist [CORE/cake/libs/model/datasources/dbo/
   dbo_postgres.php, line 122]

   Code | Context
   $sql    =       SELECT last_value AS max FROM public
    */
      function _execute($sql) {
          return pg_query($this-connection, $sql);

   pg_query - CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line
   122
   DboPostgres::_execute() - CORE/cake/libs/model/datasources/dbo/
   dbo_postgres.php, line 122
   DboPostgres::execute() - CORE/cake/libs/model/datasources/
   dbo_source.php, line 155
   DboPostgres::fetchRow() - CORE/cake/libs/model/datasources/
   dbo_source.php, line 269
   DboPostgres::lastInsertId() - CORE/cake/libs/model/datasources/dbo/
   dbo_postgres.php, line 355
   DboPostgres::create() - CORE/cake/libs/model/datasources/
   dbo_source.php, line 500
   JobHistory::save() - CORE/cake/libs/model/model.php, line 1234
   JobHistoriesController::add() - APP/controllers/
   job_histories_controller.php, line 23
   Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 265
   Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 237
   [main] - APP/webroot/index.php, line 84
   Query: SELECT last_value AS max FROM public

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



Re: filling an array for a selectbox (v1.2)

2008-02-24 Thread Johan @ Notitia.nl

Try this at your component:

var $issuers = array();

function doDirectoryrequest() {
$issuerArray = array('YOUR DATA');
foreach($issuerArray as $issuer)
{
$this-issuers[$issuer['issuerID']] = $issuer['issuerName'];
}
return $this-issuers;
}

And keep your controller and view the same.

Johan de Jong

On 24 feb, 14:24, Ronald [EMAIL PROTECTED] wrote:
 I know that, but the data does not come from my database, but from an
 API that delivers it in a specific format.
 I just need to know what I have to do with the $issuerArray to turn it
 over to another array that I can return to the controller that is
 calling this component and from there use it to fill my selectbox in
 the view.

 The $issuerArray looks like this:

 Array
 (
 [0] = IssuerBean Object
 (
 [issuerID] = 0151
 [issuerName] = Issuer Simulator
 [issuerList] = Short
 )
 )

 The best thing I've come to is this:

 --- in my component function doDirectoryrequest(): ---

 for($i = 0; $i  count($issuerArray); $i++)
 {
 $keys[$i] = $issuerArray[$i]-issuerID;
 $values[$i] = $issuerArray[$i]-issuerName;

 }

 $issuers = array_combine($keys, $values);

 return $issuers;

 --- in my controller: ---

 $this-set('result', $this-Ideal-doDirectoryrequest());

 --- in my view: ---

 ?php echo $form-select('issuer', array('options' = $result,
 array(), array(), false)); ?

 ---

 This is resulting in this html code:
 select name=data[issuer] id=issuer
 option value=/option
 optgroup label=options
 option value=0151Issuer Simulator/option
 /optgroup
 optgroup label=1
 /optgroup
 option value=2/option
 /select

 But somehow there's a lot of stuff in there I don't want to have.
 I just need this :
 select name=data[issuer] id=issuer
 option value=0151Issuer Simulator/option
 /select
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: SQL error when adding item using the scaffolding

2008-02-24 Thread jim starboard

Already there. 3 weeks old. Hard to believe it's not fixed.

On Feb 18, 9:35 am, Pablo Viojo [EMAIL PROTECTED] wrote:
 This IS what you should do:

 1. Fill a ticket
 2. submit a patch [1]

 Regards,

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

 [1]https://trac.cakephp.org/

 On Sun, Feb 17, 2008 at 5:19 PM, jim starboard [EMAIL PROTECTED]
 wrote:



  This IS a cake issue. The scaffolding code should not pass an empty
  string to the ID field. It should be fixed so that the id is not used
  in the generated SQL statement.

  On Feb 16, 8:42 am, skantner [EMAIL PROTECTED] wrote:
   I want to say thanks also, Ben.   This was really annoying me.   I
   started using Cake to save time, not lose time on frustrations like
   this!   I know it wasn't a really a Cake issue, but still...
   //spk

   On Feb 10, 2:22 pm, asturges [EMAIL PROTECTED] wrote:

Thanks Ben, I was having the same problem. I knew it had to be
something with MySQL, and not with Cake's scaffolding. For anyone else
having this problem, edit the MySQL configuration file, which is
probably called my.ini, and is located in the MySQL installation
directory (if you're running windows). In the line that says

# Set the SQL mode to strict
sql-mode=STRICT_TRANS_TABLES,
NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

take out the STRICT_TRANS_TABLES part (and delete the comma). This
was included in the default installation of MySQL 5.0 on my Windows XP
machine. No one else on the IRC seemed to be having the same problem,
so perhaps my installation was not typical. Be aware that this allows
some data to slip into MySQL that would have otherwise been forbidden.
For more information see,
 http://dev.mysql.com/doc/refman/5.0/en/constraint-invalid-data.html.

-Andrew

On Jan 6, 6:43 pm, Ben Coleman [EMAIL PROTECTED] wrote:

 OK I've found the problem and the fix...

 It's caused by the version of MySQL - in v5.1the default SQL mode is
 STRICT_TRANS_TABLES which causes thiserror. If you remove this
 setting from the MySQL config it will let you use '' instead of NULL
 and the Cake code works OK.

 Ben

 On Jan 6, 7:26 pm, Ben Coleman [EMAIL PROTECTED] wrote:

  Hi,

  Just got back into using Cake after some time away from it (and
  PHP
  development in general) I want to knock up an app very quickly so
  I
  want to use the scaffolding. I have a very simple table, model 
  controller defined but when I come to add an item I always get
  this
 error:

  SQLError:1366: Incorrect integer value: '' forcolumn'id' atrow1

  I've defined my table as follows:

  CREATE TABLE genres (
 idINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(50)
  );

  But it seems like the default scaffolding is not using the correct
  SQL
  for theidfield, how can I get round this?
  I'm using MySQL 5.0 and PHP 5.2

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



This needs to be checked everywhere

2008-02-24 Thread jim starboard

Not really sure why this is allowed, but there are places where
inserts are handled with an empty string for an auto-increment
primarykey id. This fails with any strict setup of a db, if there is
auto increment.

There is 3 week old trac listing for this but it really boggles the
mind why you would allow a sql statement to be generated with an empty
string and an explicit reference to a primary key. eg:

SQL Error: 1366: Incorrect integer value: '' for column 'id' at row 1

The key should be left out of the sql so it can be auto-generated.
This is really bad. Complaints about this go back to 2005. This is
bush league shit -- laughable man.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Is it possible to validate a file upload?

2008-02-24 Thread davidpersson

Just found out that my hint was wrong...

use

/**
 * Checks if given data is valid
 */
private function isHtmlFormFileData($data)
{
if(!is_array($data)) {
return false;
}

if(!array_key_exists('name',$data)
|| !array_key_exists('type',$data)
|| !array_key_exists('tmp_name',$data)
|| !array_key_exists('error',$data)
|| !array_key_exists('size',$data)) {
return false;
}

return true;
}

On 13 Jan., 18:06, davidpersson [EMAIL PROTECTED] wrote:
 I implemented such a validation method in one of the classes I'm using
 for my project:

 See 
 Source:https://cakeforge.org/plugins/scmsvn/viewcvs.php/trunk/vendors/transf...

 Scroll down to:
 /**
  * Checks if given data is valid
  */
 private function isHttpPostData($data)

 On 11 Jan., 12:02, Marcin Domanski aka kabturek [EMAIL PROTECTED]
 wrote:

  Hey Did, i miss something here? I am using 1.2.x (latest beta)

  Yep ;)
  did you see the actual Remarks field after posting data? try
  debug($this-data);die(); if you dont have a debugger.
  Cake is right by telling you its not empty cause it contains an array
  of $_FILE['field'] so it is ALWAYS not empty.
  Use customvalidationto check if ['Remarks']['tmp_name'] is not
  empty, ['error;[ == 0 , and ['size'] != 0 etc

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



Re: SQL error when adding item using the scaffolding

2008-02-24 Thread jim starboard


I have say, I love how I'm put in my place in this group. I think I
finally found a home.

On Feb 24, 6:39 pm, nate [EMAIL PROTECTED] wrote:
 On Feb 24, 6:19 pm, jim starboard [EMAIL PROTECTED] wrote:

  Already there. 3 weeks old. Hard to believe it's not fixed.

 Maybe it's because we've got about two week's worth of fixes and
 various other enhancements to do.

 Maybe it's because, in the grand scheme of things, scaffolding isn't
 really that high on the priority list.

 Maybe it's because we've all got jobs and lives to attend to, and
 we're not able to devote every waking hour to this project.

 Maybe it's because all you've been doing here is complaining, rather
 than (at the very least) trying to be constructive, much less trying
 to actually help in some meaningful capacity.  I don't see any patches
 or (better yet) unit tests on either of the open scaffold-related
 tickets.  So I guess I'll get to it when I get to it.

 I could probably go on.  I'm sure there are other possible reasons
 that it hasn't been fixed yet.  But I think... well, think is too
 presumptive.  I *hope*, by this point you get the idea.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: SQL error when adding item using the scaffolding

2008-02-24 Thread nate

On Feb 24, 6:19 pm, jim starboard [EMAIL PROTECTED] wrote:
 Already there. 3 weeks old. Hard to believe it's not fixed.

Maybe it's because we've got about two week's worth of fixes and
various other enhancements to do.

Maybe it's because, in the grand scheme of things, scaffolding isn't
really that high on the priority list.

Maybe it's because we've all got jobs and lives to attend to, and
we're not able to devote every waking hour to this project.

Maybe it's because all you've been doing here is complaining, rather
than (at the very least) trying to be constructive, much less trying
to actually help in some meaningful capacity.  I don't see any patches
or (better yet) unit tests on either of the open scaffold-related
tickets.  So I guess I'll get to it when I get to it.

I could probably go on.  I'm sure there are other possible reasons
that it hasn't been fixed yet.  But I think... well, think is too
presumptive.  I *hope*, by this point you get the idea.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Help configuring CakePHP 1.1 or 1.2 for a total CakePHP newbie

2008-02-24 Thread George C

Hello!

I'd like to get started using Cake, but so far I haven't had a lot of
luck.  I've been attempting to follow the excellent Cook up Web sites
fast with CakePHP, Part 1 hosted at: 
http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake1.html

My first attempt involved using CakePHP 1.2, beta version 6311.  After
downloading it, unpacking it in a folder beneath my webroot, changing
the permissions to 777 on /app/tmp and attempting to visit
http://www.myurl.com/cake12/ (which should bring up the configuration/
welcome page) my browser hangs for a minute before spitting out:

Fatal error: Maximum execution time of 60 seconds exceeded in /var/www/
html/cake12/cake/libs/view/view.php on line 634

Fatal error: Call to a member function on a non-object in /var/www/
html/cake12/cake/libs/cache.php on line 208

Undeterred, I switched to CakePHP 1.1.9.6305, upacked in a folder
beneath my webroot called cake11, changed the permissions of the /app/
tmp folder, and tried to visit http://www.myurl.com/cake11/ - this
time with some success, although I don't see any section about my
cache being set up properly or my tmp directory being writable.
Nonetheless I plowed ahead through the tutorial, and created the files
listed on page 3 of the tutorial.  So, when I visited
http://www.myurl.com/cake11/users/register I saw the registration page
and filled it out.  When I hit the registration button, my URL is
changed to http://www.myurl.com/users/register and I'm told that page
doesn't exist, which makes sense.

I tried changing the ROOT and APP_DIR values in /app/webroot/
index.php, but that only seemed to break everything, so I changed it
back.  My next attempt was to copy all of the files in /webroot/cake11
directly into /webroot.  This works to some degree - I quickly defined
a index() function in /app/controllers/users_controller this displays
a small message using $this-flash, so when I retrieve 
http://www.myurl.com/users
I see the message, but attempting to visit http://www.myurl.com/users/register
gives me the same page doesn't exist message, even though I know
that register.ctp is there.

So, my questions are:
1) Can anyone make sense of the error I'm getting with 1.2?  I'm happy
to stick with 1.1, if need be, but I'd be glad to get it working.

2) What is the correct way to tell CakePHP to use a certain path?
Leaving files in /webroot/cake11 works until it needs to (I'm
guessing) build a URL, at which point it assumes the Cake files should
be in the /webroot folder; and moving them to /webroot seems to make
the register.ctp view seem to not exist at all as far as the web
server is concerned.

Thanks in advance!

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



ACL permissions and inheritance

2008-02-24 Thread Steve

I am working on ACL and I think I'm almost there at getting it to work
properly.

I have the following objects:

Aros:
---
Group
   |- Group.1
  |- User.1
--
User.1 inherits all of Group.1's permissions, this works fine

Acos:
-
Post
   |-Post.1
   |-Post.2
---

Aro_Aco

aro(Group.1), aco(Post), CRUD()

Now, if I grant Group.1 permission to Post with CRUD = , shouldn't
User.1 have the ability to edit any post? I'm not having any luck with
this. If I grant Group.1 permission to edit Post.1 than it works, but
I want to just grant Group.1 permission to edit all posts



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



Just starting out

2008-02-24 Thread kdecot9

I've decided to build a new site that will be a directory of
skateparks where users can submit skateparks along with photos, get
directions, rate and comment on parks, etc and I'm going to try and
use cakePHP to do this. I must say that just starting out, I feel like
i've gotten way in over my head. I've done the basic blog tutorial on
the cakePHP site and I understand it to an extent. I am having some
confusions on how to tackle this, since it is rather involved. Any
ideas on the first things I should tackle and what to look out for
would be appreciated. Also, how would I go about allowing volunteers
contribute to this project without allowing them access to my
databases. I have quite a lot of information stored and I am afraid of
someone deleting it or something similar.



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



Help configuring CakePHP 1.1 or 1.2 for a total CakePHP newbie

2008-02-24 Thread George C

Hello!

I'd like to get started using Cake, but so far I haven't had a lot of
luck.  I've been attempting to follow the excellent Cook up Web sites
fast with CakePHP, Part 1 hosted at: 
http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake1.html

My first attempt involved using CakePHP 1.2, beta version 6311.  After
downloading it, unpacking it in a folder beneath my webroot, changing
the permissions to 777 on /app/tmp and attempting to visit
http://www.myurl.com/cake12/ (which should bring up the configuration/
welcome page) my browser hangs for a minute before spitting out:

Fatal error: Maximum execution time of 60 seconds exceeded in /var/
www/
html/cake12/cake/libs/view/view.php on line 634

Fatal error: Call to a member function on a non-object in /var/www/
html/cake12/cake/libs/cache.php on line 208

Undeterred, I switched to CakePHP 1.1.9.6305, upacked in a folder
beneath my webroot called cake11, changed the permissions of the /app/
tmp folder, and tried to visit http://www.myurl.com/cake11/ - this
time with some success, although I don't see any section about my
cache being set up properly or my tmp directory being writable.
Nonetheless I plowed ahead through the tutorial, and created the files
listed on page 3 of the tutorial.  So, when I visited
http://www.myurl.com/cake11/users/register I saw the registration page
and filled it out.  When I hit the registration button, my URL is
changed to http://www.myurl.com/users/register and I'm told that page
doesn't exist, which makes sense.

I tried changing the ROOT and APP_DIR values in /app/webroot/
index.php, but that only seemed to break everything, so I changed it
back.  My next attempt was to copy all of the files in /webroot/cake11
directly into /webroot.  This works to some degree - I quickly defined
a index() function in /app/controllers/users_controller this displays
a small message using $this-flash, so when I retrieve 
http://www.myurl.com/users
I see the message, but attempting to visit http://www.myurl.com/users/register
gives me the same page doesn't exist message, even though I know
that register.ctp is there.

So, my questions are:
1) Can anyone make sense of the error I'm getting with 1.2?  I'm happy
to stick with 1.1, if need be, but I'd be glad to get it working.

2) What is the correct way to tell CakePHP to use a certain path?
Leaving files in /webroot/cake11 works until it needs to (I'm
guessing) build a URL, at which point it assumes the Cake files should
be in the /webroot folder; and moving them to /webroot seems to make
the register.ctp view seem to not exist at all as far as the web
server is concerned.

Thanks in advance!

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



HABTM with associations

2008-02-24 Thread jim starboard

Have the with association's for HABTM been documented yet? Can't
seem to find any info.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Model primarykey

2008-02-24 Thread Mr-Yellow

The responses to tickets relating to this issue in trac usually have
wontfix and a short non-explainatory note basically saying piss off
and stop asking you don't need this, we know best.

-Ben

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



SQLite

2008-02-24 Thread Yocto

Where can I find a simple demo using SQLite?

Thanks.

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



Re: SQL error when adding item using the scaffolding

2008-02-24 Thread nate

All I'm really saying is, try and show a little respect.  I don't
think that's too much to ask.

On Feb 24, 6:44 pm, jim starboard [EMAIL PROTECTED] wrote:
 I have say, I love how I'm put in my place in this group. I think I
 finally found a home.

 On Feb 24, 6:39 pm, nate [EMAIL PROTECTED] wrote:

  On Feb 24, 6:19 pm, jim starboard [EMAIL PROTECTED] wrote:

   Already there. 3 weeks old. Hard to believe it's not fixed.

  Maybe it's because we've got about two week's worth of fixes and
  various other enhancements to do.

  Maybe it's because, in the grand scheme of things, scaffolding isn't
  really that high on the priority list.

  Maybe it's because we've all got jobs and lives to attend to, and
  we're not able to devote every waking hour to this project.

  Maybe it's because all you've been doing here is complaining, rather
  than (at the very least) trying to be constructive, much less trying
  to actually help in some meaningful capacity.  I don't see any patches
  or (better yet) unit tests on either of the open scaffold-related
  tickets.  So I guess I'll get to it when I get to it.

  I could probably go on.  I'm sure there are other possible reasons
  that it hasn't been fixed yet.  But I think... well, think is too
  presumptive.  I *hope*, by this point you get the idea.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: SQL error when adding item using the scaffolding

2008-02-24 Thread jim starboard


That wasn't sarcasm. You were right.

On Feb 24, 8:17 pm, nate [EMAIL PROTECTED] wrote:
 All I'm really saying is, try and show a little respect.  I don't
 think that's too much to ask.

 On Feb 24, 6:44 pm, jim starboard [EMAIL PROTECTED] wrote:

  I have say, I love how I'm put in my place in this group. I think I
  finally found a home.

  On Feb 24, 6:39 pm, nate [EMAIL PROTECTED] wrote:

   On Feb 24, 6:19 pm, jim starboard [EMAIL PROTECTED] wrote:

Already there. 3 weeks old. Hard to believe it's not fixed.

   Maybe it's because we've got about two week's worth of fixes and
   various other enhancements to do.

   Maybe it's because, in the grand scheme of things, scaffolding isn't
   really that high on the priority list.

   Maybe it's because we've all got jobs and lives to attend to, and
   we're not able to devote every waking hour to this project.

   Maybe it's because all you've been doing here is complaining, rather
   than (at the very least) trying to be constructive, much less trying
   to actually help in some meaningful capacity.  I don't see any patches
   or (better yet) unit tests on either of the open scaffold-related
   tickets.  So I guess I'll get to it when I get to it.

   I could probably go on.  I'm sure there are other possible reasons
   that it hasn't been fixed yet.  But I think... well, think is too
   presumptive.  I *hope*, by this point you get the idea.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



save to database in component

2008-02-24 Thread bob
how do i save to a database in a component in cakephp 1.2?

for example: in my component, i have var $uses = array('MyModel');
then I do $this-MyModel-save(.)...

how do i do this?

thanks

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



Re: HABTM

2008-02-24 Thread villas

My database has all the table and field names in caps.  I notice that
the queries which display in Debug 2 are also caps.

In any case,  I played around with the case on my model's table and
field names but nothing seemed to change anything. However, as soon as
I misspelt a word the alarm bells rang,  so I think it's finding
everything.

I set Debug 3 for the first time,  wow what a list that gives. I found
a reference to the Groups and Groups_Users, but no data was listed.
The entire list is too long to post here,  but maybe the answer is in
there somewhere...

When I get to my MySql machine,  I'll try the same set up and try to
see whether Firebird was the problem.  Guys, thanks ever so much for
your help so far,  it's so frustrating not being able to see the
answer!

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



Re: save to database in component

2008-02-24 Thread francky06l

If your controller is using the model you want to use for saving, then
store the controller on startup of your component.
Afterward you can use the controller reference to save the data.
Something like this in you component :

function startup($controller)
{
 $this-controller = $controller;
}

function saveData($data)
{
   $this-controller-model-save($data);
}

hth



On Feb 25, 2:27 am, bob [EMAIL PROTECTED] wrote:
 how do i save to a database in a component in cakephp 1.2?

 for example: in my component, i have var $uses = array('MyModel');
 then I do $this-MyModel-save(.)...

 how do i do this?

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



Re: SQLite

2008-02-24 Thread nate

You only need to configure your config/database.php, as follows:

var $default = array(
   'driver' = 'sqlite',
   'database' = 'path/to/sqlite/file.db'
);

If the file is relative to your app path, you may need to declare the
constructor in the DATABASE_CONFIG class and use the path constants.

On Feb 24, 7:26 pm, Yocto [EMAIL PROTECTED] wrote:
 Where can I find a simple demo using SQLite?

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



Re: Just starting out

2008-02-24 Thread asturges

Well I'm a beginner too, but I can start you out with some
encouragement at least, and some advice. First of all, I think you've
chosen the right framework: It sounds like your application is exactly
what CakePHP was built for. Here's the process that I've gone through,
which has worked for me.
1) Learn as much php as you can.
2) Get all the installations done correctly (php, apache, mysql,
cakephp)
3) Follow all Cake conventions (http://manual.cakephp.org/appendix/
conventions)
4) Do the blog tutorial, and read the manual (which you've done)
5) Understand database structure, and spend as much time as you need
getting your database set up correctly. This mostly means following
the naming conventions. Once the database is designed well, Cake
starts to do amazing things.
6) Set up your models (/app/models), and make sure your associations
are done correctly (http://manual.cakephp.org/chapter/models - see
section 4)
7) Set up your controllers with scaffolding, and nothing but
scaffolding. Don't worry about the views yet, let the scaffolding
create them for you.
8) When the scaffolding is done right, you'll be able to start using
your application and doing CRUD operations on your database. This is
where you can tweak the DB design.
9) Get the bake application going. This is (or can be) an involved
and complicated process, but it's worth it.
10) Bake everything (it will produce pages and pages of code for,
fleshing out the views the you never created, for example).
11) Tweak. Add. Modify. Change.

I know I haven't actually told how to do any of these things. I just
wanted to outline a process that worked for me. To get help along the
way (i.e. to actually do these steps), the best advice I can give is
to make liberal use of the IRC channel and this group. Don't be afraid
to ask questions, and don't be put off when people are rude to you.
Just be polite, and keep asking questions.

There are my deux centimes.
-Andy


On Feb 24, 6:58 pm, [EMAIL PROTECTED] wrote:
 I've decided to build a new site that will be a directory of
 skateparks where users can submit skateparks along with photos, get
 directions, rate and comment on parks, etc and I'm going to try and
 use cakePHP to do this. I must say that just starting out, I feel like
 i've gotten way in over my head. I've done the basic blog tutorial on
 the cakePHP site and I understand it to an extent. I am having some
 confusions on how to tackle this, since it is rather involved. Any
 ideas on the first things I should tackle and what to look out for
 would be appreciated. Also, how would I go about allowing volunteers
 contribute to this project without allowing them access to my
 databases. I have quite a lot of information stored and I am afraid of
 someone deleting it or something similar.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



formHelper-inputs example

2008-02-24 Thread Juan Luis Baptiste

Hi,

I'm trying to use the inputs method to logically group a couple of
textfields but I haven't figured out how to specify the legend of the
fieldset. For example:

?php echo $form-inputs(array('ftp_user',ftp_password')); ?

Creates the fieldset but with a default legend of New Server (where
Server is the name of the model). If I specify a first parameter with
the model name like:

?php echo $form-inputs('Server', array('ftp_user',ftp_password')); ?

Then all the fields of the model are included in the fieldset with the
legend Server. What I want to do is to group just a couple of the
fields of the model but with a custom legend, for example Remote
Login Information but I don't get how to do that using the inputs
method of formHelper. Ideas ?

Thanks.


Cheers,
-- 
Juan Luis Baptiste

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



Dynamic database switching error in ConnectionManager::getDataSource

2008-02-24 Thread Kotekar

I am facing the error in ConnectionManager::getDataSourcewhile dynamic
database switching logic in the model

// theme.php code
?php
class Theme extends AppModel
{
var $name  = 'Theme';
var $useTable = false;

//  Code to Switch between multiple database
var $useDbConfig;
var $requestURL;
function __construct()
{
if(!empty($_REQUEST['url']))
{
$this-requestURL = $_REQUEST['url'];
if(substr_count($this-requestURL, '/
unicode'))
{
$this-useDbConfig =
'unicode';
parent::__construct();
}
else if(substr_count($this-
requestURL, '/ansi'))
{

$this-useDbConfig = 'ansi';
parent::__construct();
}
else
{
header(Location: /modes/
error);
}
}
}
//  Code Ends Here..

this logic works fine, if the enter the the url directly on the
browser address bar or the links on the same domian page.

if i have clicked from external site reference to this page, i get
this FATAL ERROR message Fatal error:
ConnectionManager::getDataSource - Non-existent data source in /var/
www/html/cake/libs/model/connection_manager.php on line 113

USE CASE to reproduce this error:

1. Try to open this URL by pasting on the browser address bar:
http://saadhaara.com/themes/home/ansi/kannada

2. you'll see few Notice / Warning message along with the HTML content
which is ansci based content (Not easy to read, its in indian
language), but this is the expected result

3. Now, Open this URL: http://kanlit.net/, and click the link
saadhaara which tries to load the same URL as specified above.

4. Now you'll find the FATAL ERROR message and no HTML content

I am wondering, what is the problem with this code. Its works fine in
my local setup of the site in all the USE CASES which specified above.

please provide some light on this, i appreciate your suggestion/
feedback.

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



Email Component not working..

2008-02-24 Thread Affinity Skateboards

I am trying to use the email component on my contact page, but when
trying to add the component in my controller I get:


Missing Component File

You are seeing this error because the component file can't be found or
doesn't exist.

Notice: If you want to customize this error message, create app/views/
errors/missing_component_file.thtml.

Fatal: Create the class below in file : app/controllers/components/
email.php

?php
class EmailComponent extends Object {
}
?

this is what my contact_controller looks like:

?php

class ContactController extends AppController {


var $uses = array('Contact');
var $components = array(Email);

// Code here...
?

Is there something I am missing? I thought that the email component
was a built-in component of cakePHP. Thanks for the help.

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



Mail Component Not Working

2008-02-24 Thread Affinity Skateboards

I am trying to use the mail component on my contact page (
http://www.theskateparkdirectory.com/contact/ ) and I get the
following message:

Missing Component File

You are seeing this error because the component file can't be found or
doesn't exist.

Notice: If you want to customize this error message, create app/views/
errors/missing_component_file.thtml.

Fatal: Create the class below in file : app/controllers/components/
email.php

?php
class EmailComponent extends Object {
}
?

My contact_controller looks like this:

?php

class ContactController extends AppController {


var $uses = array('Contact');
var $components = array(Email);

 // Code Here...
?

Am I doing something wrong? I thought that Email was a built in
component of cakephp. Any help would be most appreciated.


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



Counting on subselects

2008-02-24 Thread Andrew Allen

This may be silly since there is a better to do this I'm sure, but is
there a way to count the number of items in a subselect on pagination?
Or is there a way to count the number of items that are linked in a
hasMany relationship. i.e. can you output the number of comments that
are associated with a post in a blog?

Thank you in advance.

Sincerely,
~Andrew Allen

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



Re: Problems creating records Cake 1.2 on postgres

2008-02-24 Thread b logica

You guys thought of everything. That's pretty sweet.

On Sun, Feb 24, 2008 at 5:36 PM, nate [EMAIL PROTECTED] wrote:

  Some older versions of Postgres won't tell you the sequence name for a
  column (I think the earliest version I've tested on is 8.1 or so).  In
  those cases, you need to do as Chris says, and provide the sequence
  name in the model class using var $sequence.


  On Feb 23, 12:12 pm, b logica [EMAIL PROTECTED] wrote:
   What is the model name you're dealing with here? The 'public' part of
   the query refers to the public schema and is used in creating the
   sequence name (from which the last value is to be gotten). It looks
   like something in your table name is causing Cake to come up with an
   incomplete sequence name:
  
   function lastInsertId($source, $field = 'id') {
   foreach ($this-__descriptions[$source] as $name = $sourceinfo) {
   if (strcasecmp($name, $field) == 0) {
   break;
   }
   }
  
   if (isset($this-_sequenceMap[$source])) {
   $seq = $this-_sequenceMap[$source];
   } elseif (preg_match('/^nextval\(\'(\w+)\'/', 
 $sourceinfo['default'],
   $matches)) {
   $seq = $matches[1];
   } else {
   $seq = {$source}_{$field}_seq;
   }
  
   $res = $this-rawQuery(SELECT last_value AS max FROM \{$seq}\);
   $data = $this-fetchRow($res);
   return $data[0]['max'];
  
   }
  
   If you can, log into psql and type:
  
   \ds
  
   to see your sequence names. Maybe something's screwy there. Otherwise,
   it might be something you've set in your Cake app.
  


  On Sat, Feb 23, 2008 at 1:27 AM, Bruce [EMAIL PROTECTED] wrote:
  
 I am working in Cake 1.2 with PHP5 and a postgres backend DB. When I
 try to create records in any app I have tried, I get a warning then an
 SQL error. The record seems to be created in the db, but with my
 limited knowledge, it looks to me like cake is constructing an
 incomplete SQL statement when trying to retrieve the ID of the record
 just written.
  
 Output is like:
  
 Warning (2): pg_query() [function.pg-query]: Query failed: ERROR:
 relation public does not exist [CORE/cake/libs/model/datasources/dbo/
 dbo_postgres.php, line 122]
  
 Code | Context
 $sql=   SELECT last_value AS max FROM public
  */
function _execute($sql) {
return pg_query($this-connection, $sql);
  
 pg_query - CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line
 122
 DboPostgres::_execute() - CORE/cake/libs/model/datasources/dbo/
 dbo_postgres.php, line 122
 DboPostgres::execute() - CORE/cake/libs/model/datasources/
 dbo_source.php, line 155
 DboPostgres::fetchRow() - CORE/cake/libs/model/datasources/
 dbo_source.php, line 269
 DboPostgres::lastInsertId() - CORE/cake/libs/model/datasources/dbo/
 dbo_postgres.php, line 355
 DboPostgres::create() - CORE/cake/libs/model/datasources/
 dbo_source.php, line 500
 JobHistory::save() - CORE/cake/libs/model/model.php, line 1234
 JobHistoriesController::add() - APP/controllers/
 job_histories_controller.php, line 23
 Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 265
 Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 237
 [main] - APP/webroot/index.php, line 84
 Query: SELECT last_value AS max FROM public
  
 Any suggestions?
  


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



Re: Counting on subselects

2008-02-24 Thread b logica

One of the things about Cake that I'm not so hot about is having to
give up (mostly) writing SQL. For some people, that's a feature, I
guess.

Anyway, don't fight the framework ;-) Do your find() on Posts,
grabbing Comments along with them. When iterating over them in the
view, you can simply do a sizeof() on your array. eg.

this is your $posts var set in the controller:

Array
(
[0] = Array
(
[Post] = Array
(
[id] = 1
[created] = ...
...
[Comment] = Array
(
[0] = Array
(
[id] ...

[1] = Array
(
[id] ...


foreach($posts as $post)
{
?
h3?= $post['title'] ?/h3
h5(?= sizeof($post['Comment']) ? comments)/h5
...


If you're using Bindable behavior you can restrict the SELECT to just
grabbing the Comment IDs to save some time/memory, etc.

Pagination isn't a factor in any of this (though I may have
misunderstood your question).

On Mon, Feb 25, 2008 at 12:02 AM, Andrew Allen [EMAIL PROTECTED] wrote:

  This may be silly since there is a better to do this I'm sure, but is
  there a way to count the number of items in a subselect on pagination?
  Or is there a way to count the number of items that are linked in a
  hasMany relationship. i.e. can you output the number of comments that
  are associated with a post in a blog?

  Thank you in advance.

  Sincerely,
  ~Andrew Allen

  


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



Cake Blog Tutorial

2008-02-24 Thread Kishor

Hi friends I've implemented cake blog tutorial from cake manual and
it's work perfect.But i'm confuse how cake model save method
works.Means
this blog tutorial use posts table

CREATE TABLE posts (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(50),
body TEXT,
created DATETIME DEFAULT NULL,
modified DATETIME DEFAULT NULL
);


And for add/edit view contains only title and body fields then how
remaining fields cake calculates

means created and modified. I've added one extra field to table
but while adding new entry it only takes above fields

INSERT INTO `posts` (`title`,`body`,`created`,`modified`) VALUES
('test','test purpose','2008-02-25 07:26:38','2008-02-25 07:26:38')

So Can any one explain me how it works ? I

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



Cake Blog Tutorial

2008-02-24 Thread Kishor

Hi friends I've implemented cake blog tutorial from cake manual and
it's work perfect.But i'm confuse how cake model save method
works.Means
this blog tutorial use posts table

CREATE TABLE posts (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(50),
body TEXT,
created DATETIME DEFAULT NULL,
modified DATETIME DEFAULT NULL
);


And for add/edit view contains only title and body fields then how
remaining fields cake calculates

means created and modified. I've added one extra field to table
but while adding new entry it only takes above fields

INSERT INTO `posts` (`title`,`body`,`created`,`modified`) VALUES
('test','test purpose','2008-02-25 07:26:38','2008-02-25 07:26:38')

So Can any one explain me how it works ? I

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



Re: Counting on subselects

2008-02-24 Thread Adam Royle

If you want to sort on the column as well, I suggest you create a
counter cache. Basically, you store the count of subitems in a field
in the main table, which is updated on create/update/delete.

There is even a behaviour that can do this automatically for you.

http://bakery.cakephp.org/articles/view/countercache-or-counter_cache-behavior

Cheers,
Adam

On Feb 25, 3:02 pm, Andrew Allen [EMAIL PROTECTED] wrote:
 This may be silly since there is a better to do this I'm sure, but is
 there a way to count the number of items in a subselect on pagination?
 Or is there a way to count the number of items that are linked in a
 hasMany relationship. i.e. can you output the number of comments that
 are associated with a post in a blog?

 Thank you in advance.

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



Re: Counting on subselects

2008-02-24 Thread francky06l

I use to bindModel again with hasMany and use the filterQuery to
count.

On Feb 25, 8:33 am, Adam Royle [EMAIL PROTECTED] wrote:
 If you want to sort on the column as well, I suggest you create a
 counter cache. Basically, you store the count of subitems in a field
 in the main table, which is updated on create/update/delete.

 There is even a behaviour that can do this automatically for you.

 http://bakery.cakephp.org/articles/view/countercache-or-counter_cache...

 Cheers,
 Adam

 On Feb 25, 3:02 pm, Andrew Allen [EMAIL PROTECTED] wrote:

  This may be silly since there is a better to do this I'm sure, but is
  there a way to count the number of items in a subselect on pagination?
  Or is there a way to count the number of items that are linked in a
  hasMany relationship. i.e. can you output the number of comments that
  are associated with a post in a blog?

  Thank you in advance.

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