Getting an array of errors during validation

2008-12-11 Thread gearvOsh

So I understand the Model validation using $validate. I applied snooks
multiple validations using 
http://snook.ca/archives/cakephp/multiple_validation_sets_cakephp/,
all that works perfectly.

I do however dislike it when a field errors, the error message is
shown after the input. Id rather a list of all errors be shown above
the form, so what im asking is...

Is there a way to get an array of all current errors in the form?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Getting simpletest to work with test DB

2008-12-11 Thread Marcus

On Dec 10, 8:33 pm, Ed Howland [EMAIL PROTECTED] wrote:
 Hi,

 I've got simpletest installed but now I am having problems with the test DB.

 I had to change the name of the variable to $test_suite from $test.
 After that I could see the create table statements.

 Here is my setup:

         var $test_suite = array(
                 'driver' = 'mysql',
                 'persistent' = false,
                 'host' = 'localhost',
                 'login' = 'eddie',
                 'password' = 'eddie',
                 'database' = 'bph_test',
                 'prefix' = '',
         );

 But now every test reports
 Error:  Database table forms for model Form was not found. The rest of
 the test aborts.

Same problem here. The error message Database table not found
appeared with changeset 7870 of CakePHP.

When calling ClassRegistry::init('Foo') in the startTest method of a
test case, Cake tries to set up 'Foo' with all the associated models
and fails when initializing the first related model: CakePHP reads the
schema definition from database with wrong connection.

When calling ClassRegistry::init('Foo'), Cake uses the 'default'
connection for getting the schema for 'Foo' and everything works fine.
Then the first related Model is initialized, CakePHP tries to read the
schema, but now with the 'test_suite' connection, which raises the
error because the table doesn't exist in the test database.

Is this an error that should be filed to trac?

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



Re: Getting an array of errors during validation

2008-12-11 Thread Marcus

On Dec 11, 9:14 am, gearvOsh [EMAIL PROTECTED] wrote:
 So I understand the Model validation using $validate. I applied snooks
 multiple validations 
 usinghttp://snook.ca/archives/cakephp/multiple_validation_sets_cakephp/,
 all that works perfectly.

 I do however dislike it when a field errors, the error message is
 shown after the input. Id rather a list of all errors be shown above
 the form, so what im asking is...


Simply use FormHelper::error() to print error messages wherever and
whenever you want:

echo($form-error('Model.field1');
echo($form-error('Model.field2');

(http://api.cakephp.org/class_form_helper.html)

Don't forget to remove the error message from your input fields:

echo($form-input('Model.field1', array('error' = false)));
echo($form-input('Model.field2', array('error' = false)));

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



Re: Getting an array of errors during validation

2008-12-11 Thread gearvOsh

Ok ill take a look at that. Hopefully I can do something to get an
array so I can do a simple loop.

On Dec 11, 12:27 am, Marcus [EMAIL PROTECTED] wrote:
 On Dec 11, 9:14 am, gearvOsh [EMAIL PROTECTED] wrote:

  So I understand the Model validation using $validate. I applied snooks
  multiple validations 
  usinghttp://snook.ca/archives/cakephp/multiple_validation_sets_cakephp/,
  all that works perfectly.

  I do however dislike it when a field errors, the error message is
  shown after the input. Id rather a list of all errors be shown above
  the form, so what im asking is...

 Simply use FormHelper::error() to print error messages wherever and
 whenever you want:

 echo($form-error('Model.field1');
 echo($form-error('Model.field2');

 (http://api.cakephp.org/class_form_helper.html)

 Don't forget to remove the error message from your input fields:

 echo($form-input('Model.field1', array('error' = false)));
 echo($form-input('Model.field2', array('error' = false)));

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



Re: How and where to insert a tracking script. ?

2008-12-11 Thread majna

Copy default.ctp layout form cake\libs\view\layouts\
to your app/views/layouts/ directory.
Now cake will use this one.
read http://book.cakephp.org/view/96/Layouts


On Dec 10, 8:25 pm, Tanay [EMAIL PROTECTED] wrote:
 I want to insert a small counter and a login code so that they are run
 on all cake pages. I am using default theme and css. Tell me the
 default template file so that i can insert these codes.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Limitation in number of records when using CakeAMF

2008-12-11 Thread Adam Royle

Hi kiang,

At first I thought you were insane, because I was returning 1000 rows
in an array and all was fine... except then I tried with longer data,
and got the same problem as you experience. So I did some debugging
and have found the solution!

Cake was always returning 0 as the length of the data, but that was
not a problem for requests under 8000 bytes. It was only when it hit
8001 or higher that cake didn't accept the response.

So it turns out to be a bug, the length being calculated from the
wrong stream, so always being set to 0!

I've added a patch that fixes the problem.

https://trac.cakefoundation.org/amf/attachment/ticket/14/cakeamf_fix_length_bug.patch

Hope that helps.

Cheers,
Adam

kiang wrote:
 When working with CakeAMF, I found once the records transfered reached
 about 60 (9 int columns, 5 varchar columns, 3 datetime columns) or 567
 (Only with one ID column), flash can't get the data. I don't know if
 the limitation came from flash or CakeAMF, but it didn't happened when
 using amfphp.

 Although I could divide the data into smaller pieces and fetch them in
 more than one connection, I still would like to know why and how to
 resolve it.

 I've reported it as bug here:
 https://trac.cakefoundation.org/amf/ticket/14

 Environments:
 Ubuntu 8.10 desktop with latest PHP,MySQL and Apache in repository.
 CakePHP, svn #7899
 Flex 3 application

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



Re: Getting an array of errors during validation

2008-12-11 Thread gearvOsh

I figured it out. $validationErrors contains the array, I simply set
it in the view.

// login.ctp
?php echo $this-element('errors', array('errors' = $form-
validationErrors['User'])); ?

// elements/errors.ctp
?php if (!empty($errors)) { ?
div class=failed
h5?php printf(__d('errors', 'totalErrors', true), count
($errors)); ?/h5

ul
?php foreach ($errors as $field = $error) { ?
li?php echo $error; ?/li
?php } ?
/ul
/div
?php } ?

But since im doing i18n/l10n and am not able to do __() in the model
or the view, I had to do it in the controller.

// Validation
$this-User-validate = array(
'username' = array(
'notEmpty' = array(
'rule' = 'notEmpty',
'message' = __d('errors', 'usernameEmpty2', true)
)),
'password' = array(
'notEmpty' = array(
'rule' = 'notEmpty',
'message' = __d('errors', 'passwordEmpty2', true)
)),
);

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



Re: Getting an array of errors during validation

2008-12-11 Thread gearvOsh

Oh and also stupid me, its basically in the manual:

http://book.cakephp.org/view/410/Validating-Data-from-the-Controller

My way doesnt require you to set the data to the view though, but
either way works.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Newbie question on form validating

2008-12-11 Thread AJV

Just starting on Cake (1.2.0). I'm trying to make a form that checks
if a code that a user has inputted is in the correct format, then
check if it's found in a database. If the first check/validation
fails, it returns the user to the first page and displays an error
above the code-field.

And I don't understand how it's done.

What are the steps in achieving this? Is there a tutorial about this?

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



Re: Limitation in number of records when using CakeAMF

2008-12-11 Thread kiang

Thanks for your patch. After applying it to plugins/amf/views/amf.php,
the flash could get more data now. :)

---
kiang

On 12月11日, 下午5時10分, Adam Royle [EMAIL PROTECTED] wrote:
 Hi kiang,

 At first I thought you were insane, because I was returning 1000 rows
 in an array and all was fine... except then I tried with longer data,
 and got the same problem as you experience. So I did some debugging
 and have found the solution!

 Cake was always returning 0 as the length of the data, but that was
 not a problem for requests under 8000 bytes. It was only when it hit
 8001 or higher that cake didn't accept the response.

 So it turns out to be a bug, the length being calculated from the
 wrong stream, so always being set to 0!

 I've added a patch that fixes the problem.

 https://trac.cakefoundation.org/amf/attachment/ticket/14/cakeamf_fix_...

 Hope that helps.

 Cheers,
 Adam

 kiang wrote:
  When working with CakeAMF, I found once the records transfered reached
  about 60 (9 int columns, 5 varchar columns, 3 datetime columns) or 567
  (Only with one ID column), flash can't get the data. I don't know if
  the limitation came from flash or CakeAMF, but it didn't happened when
  using amfphp.

  Although I could divide the data into smaller pieces and fetch them in
  more than one connection, I still would like to know why and how to
  resolve it.

  I've reported it as bug here:
 https://trac.cakefoundation.org/amf/ticket/14

  Environments:
  Ubuntu 8.10 desktop with latest PHP,MySQL and Apache in repository.
  CakePHP, svn #7899
  Flex 3 application

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



Re: Newbie question on form validating

2008-12-11 Thread gearvOsh

I just finished doing this today, these two links should help:

http://book.cakephp.org/view/125/Data-Validation
http://groups.google.com/group/cake-php/browse_thread/thread/d5e98df32a08c5cd#
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth, Session Timouts Login

2008-12-11 Thread lazlo2019

Hi

Thanks for replying. I've got $this-Session-destroy(); in my logout
method which doesn't solve it. Redirecting to a non-auth page would be
inconvenient. Any other ideas?

Cheers

On Dec 10, 8:40 pm, thatsgreat2345 [EMAIL PROTECTED] wrote:
 On logout delete the session cookies, or redirct to a page with out
 auth component on logout.

 On Dec 10, 9:51 am, lazlo2019 [EMAIL PROTECTED] wrote:

  Hi

  Here's the scenario. Set the timeout to a very low number (I'm using 1
  for arguments sake) and security to high. Login as normal. Logout or
  wait for the session to timeout and end up back at the login page. If
  I then try to login within the timeout limit it'll be fine. If however
  I try to login after the timeout period I'll get not authorized to
  view that location error. This continues until you attempt to login
  within the timeout period of a previous login attempt.

  However, if I pass the timeout period BUT use FF Web Dev Toolbar or
  whatever to delete the domain/session cookies, it let's me in.

  I can see in Auth.php where the flow differs depending on pre or post
  timeout. It's line 294 (RC2) (if ($loginAction == $url) {). If you try
  pre-timeout its false, post-timeout its true.

  My timeout needs to be low and security high and I can just imagine
  getting the call why do I have to login twice? once the site goes
  live.

  Replicated in RC2 and RC3.

  Anyone got any ideas or able to replicate? Any ideas appreciated.

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



Re: Newbie question on form validating

2008-12-11 Thread AJV

I'm really confused with this - can't get even the simplest examples
working.

I set a test case like this:

?php
//app/model/Contact.php
class Contact extends AppModel
{
var $name = 'Contact';
var $validate = array(
'email' = array(
'rule' = array('email', true),
'message' = 'Please supply a valid email address.'
)
);

}
?

###
?php
// app/controllers/contacts_controller.php
class ContactsController extends AppController {

var $name='Contacts';
var $uses = array('Contact');
var $helpers = array('form');

function add(){

if( !empty( $this-data ) ){

if ($this-Contact-validates()){
echo yes;
}

if( $this-Contact-save( $this-data ) ){
$lastId = $this-Contact-getLastInsertId();
$this-flash('Your new user has been created.','/c/
contacts/view/'.$lastId );
}
}
}
}
?



!-- /app/views/contacts/add.thtml  --
h1Enter Contact Information/h1

form method=post action=?php echo $html-url('/contacts/add')?


?php echo $form-label('Contact.email', Contact's E-mail); ?
?php echo $form-error('Contact.email'); ?
?php echo $form-text('Contact.email', array('size' = '80') ); ?


 br /
?php echo $form-submit('Check validity'); ?
/form

When I submit anything, like  or 1oi321 or whatever,
everything validates. The e-mail addresses also validate, which is
nice :) but it clearly isn't working at all. What am I missing? Wrong
configuration? My cake version is 1.2.0.7692 RC3.


On Dec 11, 11:38 am, gearvOsh [EMAIL PROTECTED] wrote:
 I just finished doing this today, these two links should help:

 http://book.cakephp.org/view/125/Data-Validationhttp://groups.google.com/group/cake-php/browse_thread/thread/d5e98df3...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question on form validating

2008-12-11 Thread AJV

A small typo - the path to the model file is of course /app/models/.

BUT I just noticed that I can change the model file to whatever, even
remove it, and it still works. Is this normal?!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



named params and prefix routing

2008-12-11 Thread Marcelius

Hello!

I have this route like the manual says for prefix routing:

Router::connect('/owner/:controller/:action/*', array
('prefix'='owner', 'owner'=true));

This works fine until I want to create a url with some named params in
it:

Router::url(array(controller=invoices, action=edit, 5,
owner=true));
returns /owner/invoices/edit/5 as expected.

Router::url(array(controller=invoices, action=edit, 5,
owner=true, key=val));
returns /invoices/edit/5/owner:1/key:val not as expected.

Something wrong in my routes? Please note that that's the only route
available.

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



Re: Newbie question on form validating

2008-12-11 Thread grigri

Yes; Cake supports dynamic models.

If you don't create an actual model file, cake will instantiate an
instance of AppModel with the name and useTable set up to work
properly. This is only useful for basic models though as you can't
specify associations, behaviors, validation or anything specific for
the auto-model.

Its main use is for join tables in HABTM.

hth
grigri

On Dec 11, 11:29 am, AJV [EMAIL PROTECTED] wrote:
 A small typo - the path to the model file is of course /app/models/.

 BUT I just noticed that I can change the model file to whatever, even
 remove it, and it still works. Is this normal?!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $form-input() helper question

2008-12-11 Thread Jon Bennett

Hi maytawn,

  Thanks for the suggestion.  I tried it... but it did not seem to work.

  I added the CSS to my main css file.  And this is what I have in the
  view:

what was the outputted html like? What did Firebug say tell you about
the elements? What I suggested with definitely work in theory, but the
CSS was untested, merely there to show how you can apply more than one
class to an element.

cheers,

jon


-- 

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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP 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: Newbie question on form validating

2008-12-11 Thread AJV

I'm quessing this has something to do with communicating with the
model file. Even if I write die() or some broken code to the model,
nothing happens. Are there any ways to confirm that the controller
talks to the model, and if not, how could it be fixed?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question on form validating

2008-12-11 Thread AJV

OK, thanks for that info!

Still, the problem persists.

I installed a fresh cake and made this tutorial:

http://bakery.cakephp.org/articles/view/multiple-rules-of-validation-per-field-in-cakephp-1-2

But even though I followed every step, it just doesn't work, no
validation is happening.



On Dec 11, 1:48 pm, grigri [EMAIL PROTECTED] wrote:
 Yes; Cake supports dynamic models.

 If you don't create an actual model file, cake will instantiate an
 instance of AppModel with the name and useTable set up to work
 properly. This is only useful for basic models though as you can't
 specify associations, behaviors, validation or anything specific for
 the auto-model.

 Its main use is for join tables in HABTM.

 hth
 grigri

 On Dec 11, 11:29 am, AJV [EMAIL PROTECTED] wrote:

  A small typo - the path to the model file is of course /app/models/.

  BUT I just noticed that I can change the model file to whatever, even
  remove it, and it still works. Is this normal?!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question on form validating

2008-12-11 Thread AJV

:D

Well I guess I just confirmed my newbie status, I had written the
names of the model files Capitalized. I noticed that small letters
work much better :D

Well, that was a fun couple of hours.

Aapo

On Dec 11, 2:49 pm, AJV [EMAIL PROTECTED] wrote:
 I'm quessing this has something to do with communicating with the
 model file. Even if I write die() or some broken code to the model,
 nothing happens. Are there any ways to confirm that the controller
 talks to the model, and if not, how could it be fixed?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



can't connect to oracle

2008-12-11 Thread baranangsi...@gmail.com

i try oracle driver in cake rc3..., but don't success. here is
database.php :

var $default = array(
'driver' = 'oracle',
'persistent' = false,
'host' = 'localhost',
'login' = 'hr',
'password' = 'hr',
'database' = 'XE',
'prefix' = '',
);



but, in RC2 and RC1, there's no problem...

thankx

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



dynamically fetch the data

2008-12-11 Thread Sami

hi,
  how to post selected index in selection box , This my coding...
In controller:
..var $name = 'Alerts';
var $helpers = array('Html', 'Form','Util');
   var $paginate=array('limit'=10,'page'=1,'order'=array
('Alert.created'='DESC'));
function index() {
   $this-Alert-recursive = 0;
   $this-set('alerts', $this-paginate());
   }
In index.ctp
...
script type='text/javascript'
function orders(dd){
alert(dd);
//return dd;
}/script
...
echo $form-input('i',array('type'='select','options'=array(
'0'='Sort by Date Descending',
'1'='Sort by Date Ascending',
'2'='Sort by Category/Date Descending',
'3'='Sort by Title/Date Descending'),
'onChange'='orders(this.value)'));

i got id, but i dont have idea to pass the data from index.ctp file to
controller file.
Here input value  is not a database variable. If user select the order
in selection box how to change the paginate order query at
dynamically. I dont have idea. Any body help me, i really thanks to u.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Getting simpletest to work with test DB

2008-12-11 Thread mark_story

How are your fixtures setup?
Are you using imports?
Are you initializing your models in setup() or startTest()?
Are you using ClassRegistry::init() or are you use new Model()?

-Mark

On Dec 10, 2:33 pm, Ed Howland [EMAIL PROTECTED] wrote:
 Hi,

 I've got simpletest installed but now I am having problems with the test DB.

 I had to change the name of the variable to $test_suite from $test.
 After that I could see the create table statements.

 Here is my setup:

         var $test_suite = array(
                 'driver' = 'mysql',
                 'persistent' = false,
                 'host' = 'localhost',
                 'login' = 'eddie',
                 'password' = 'eddie',
                 'database' = 'bph_test',
                 'prefix' = '',
         );

 But now every test reports
 Error:  Database table forms for model Form was not found. The rest of
 the test aborts.

 Any idea what I am doing wrong?

 Thanks,
 Ed

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



Re: Accessing cake variable from non-cake file

2008-12-11 Thread Rob

So a couple of ways to deal with this depending on exactly what you
need the data for. You could write it to a cookie, or put some code in
your non-Cake stuff to access the data you need with a query.

I know Cake can be set up to use database tables for session data (I
had to set it up that way for a site where I couldn't write to the tmp
directory), so you should be able to access the session data from
those tables. I'd look at the core libs to understand how Cake uses
that data if you decide to try that.

On Dec 10, 11:01 pm, RJ [EMAIL PROTECTED] wrote:
 anyone who encountered this kind of a problem

 On Dec 10, 2:31 pm, RJ [EMAIL PROTECTED] wrote:

  Thks for ur reply Rob

  I tried the session way... but it isn't working

  In a controller file , i created a session variable :
  $this-Session-write('status','value');

  In non-cake file, i tried accessing that variable :
  $_SESSION['status']

  but gt a blank value

  Thanks,
  RJ

  On Dec 10, 1:55 am, Rob [EMAIL PROTECTED] wrote:

   I would think you'd need to stuff the data into the session if you
   want to access it from a non-Cake PHP page.

   On Dec 9, 9:50 am, RJ [EMAIL PROTECTED] wrote:

Our project is partly built using cakephp.. by that i mean only few
modules are built in cakephp , while the rest are normal php files.

Now while signing out(done through non-cake file), i want to access a
cake-variable so as to store that in database.

The variable in question is a global variable i.e declared in
app_controller.php file

My question is can i access a cake-variable from logout.php (non-cake
file)

Any help wld be appreciated.

Thanks,
RJ


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



Re: Another Dynamic Database Issue

2008-12-11 Thread Rob

As long as it is SQL server security, it is essentially a table, and
you should be able to model that with Cake. You basically just need
the model for your users data and point Auth at that model.

That said, I have never tried this with SQL express, so it might take
a bit of playing to get it to work.

Ultimately to use Auth, you have to tell Cake about the tables to use
for authentication, and I'm thinking there would be a fair amount of
code you'd need to add to get it to work with a table that is storing
data differently than the standard Auth expects (e.g. - hashed
passwords for instance).

On Dec 10, 1:23 pm, bademan [EMAIL PROTECTED] wrote:
 After chasing my tail a bit, I think I failed to expalin my dilemma
 better. The database in question is an MS SQL Express DB and the user
 accounts are not necessarily stored in a table within the DB, they are
 more like DB system accounts (i.e. stored in SQLSERVER//Security//
 Logins). This is why I am still unsure that Auth and Acl might be able
 to solve the issue. Can you let me know if my task is still possible
 (i.e. given the original context). Thanks.

 B.I.

 On Dec 9, 3:32 pm, AD7six [EMAIL PROTECTED] wrote:

  On Dec 9, 10:10 pm, WebbedIT [EMAIL PROTECTED] wrote:

I just use Auth and ACL for what you're talking about.

   As Rob states Auth and ACL should be the way to go, but a word of
   warning!  I for one have had problems employing Auth and ACL and
   judging by the amount of blogs and tutorials on the subject so do many
   others.

   I came across the following blog today (within this group) which looks
   promising to as a reference for finally getting my head around Auth
   and ACL.  May be worth a look ;)

  http://www.ad7six.com/MiBlog/Authenticationhttp://www.ad7six.com/MiBl...

   Good luck!

  Careful, like so many things out there those posts from my blog are
  old and (at least the technical details are) obsolete ;) that content
  predates 1.2 and the auth/acl components although the general concepts
  are of course still valid.

  I'd recommend 
  startinghttp://book.cakephp.org/view/641/Simple-Acl-controlled-Application
  on any acl/auth quest. and quite simply any auth solution that isn't
  based on the core auth component is imo not a best practice - the auth
  component get's imporved and is widely used (and phenomenally
  configurable) whereas other solutions are not or even if they are have
  a much smaller userbase.

  AD


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



Re: can't connect to oracle

2008-12-11 Thread Rob

What error are you seeing ?

On Dec 11, 4:23 am, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 i try oracle driver in cake rc3..., but don't success. here is
 database.php :

 var $default = array(
                 'driver' = 'oracle',
                 'persistent' = false,
                 'host' = 'localhost',
                 'login' = 'hr',
                 'password' = 'hr',
                 'database' = 'XE',
                 'prefix' = '',
         );

 but, in RC2 and RC1, there's no problem...

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



Re: Bake doesn't do anything for me

2008-12-11 Thread Rob

It sounds like you may have a problem with your database connection,
and Cake isn't seeing any tables that it can build a model for.

Have you validated your connection by loading the web page for your
app?

On Dec 10, 1:25 pm, Lucki [EMAIL PROTECTED] wrote:
 cake bake does provide the options, but if I press me it just says:

 
 Welcome to CakePHP v1.2.0.7692 RC3 Console
 ---
 App : app
 Path: /usr2/webroot/editorsch/cake/app
 ---
 Interactive Bake Shell
 ---
 [D]atabase Configuration
 [M]odel
 [V]iew
 [C]ontroller
 [P]roject
 [Q]uit
 What would you like to Bake? (D/M/V/C/P/Q) m

 ---
 Bake Model
 Path: /BASEPATH/cake/app/models/
 ---
 

 And exits without doing anything.

 On Dec 9, 6:17 pm, Sam Sherlock [EMAIL PROTECTED] wrote:

  does cake bake provide options m,v,c  then after pressing m you'll get a
  list 1 - x of you models pressing the corresponding number gets walks you
  through the process of creating models

  2008/12/9 Lucki [EMAIL PROTECTED]

   Is there an issue using Bake with Oracle?

   I already set a project up manually, then tried using bake to see what
   it would do for models and and I wanted to bake the scaffold code for
   each of my models. But all cake bake model does is display the model
   path and not write any files. All cake bake model ModelName does is
   write a boiler plate file that is clearly not picking up anything from
   the database.

   cake bake controller ModelNamePlural does write the boiler plate
   that just sets var $scaffold.

   cake bake controller ModelNamePlural scaffold says it's baking
   scaffold for ModelName But doesn't write any files.

   This is /really/ frustrating. I've heard what a great tool this is and
   it's just /not/ working.

   I really want to have the scaffold controllers and views written out
   as place to start developing from. That's the whole point of bake,
   isn't it?


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



Submitting a form with ajax using a diffrent controller

2008-12-11 Thread Chris

Hello people,

Im just starting with CakePHP, and so far it's great. But now im
making a tutorial for a blog. And i want to add comments using Ajax.

I've installed prototype, and that's working. But i have a form in my
posts/view.ctp file. And i want to use the comments controller for
adding a post to the database.

so i've used this:

?=$ajax-form('/comments/add', 'post', array('update'='comments')); ?

?= $form-input('naam'); ?
?= $form-input('content'); ?
?= $form-input('comment.post_id',array('type'='hidden','value'=
$post['Post']['id']));?
?= $form-end('Comment toevoegen'); ?

The action in the comments controller is this:
function add()
{
if(!empty($this-data))
{
$this-Comment-create();
if ($this-Comment-save($this-data))
{
$comments = 
$this-Comment-find('all',array('conditions'=array
('post_id'=$this-data['Comment']['post_id']), 'recursive'= -1));
$this-set(compact('comments'));
$this-render('add_succes','ajax');
}
else
{
$this-render('add_failure','ajax');
}
}
}

But somehow the source of the form is this:

form id=form1521548612 onsubmit=event.returnValue = false; return
false; method=post action=/posts/comments/addfieldset
style=display:none;input type=hidden name=_method
value=POST //fieldsetscript type=text/javascript
//![CDATA[
Event.observe('form1521548612', 'submit', function(event) { new
Ajax.Updater('comments','/posts/comments/add', {asynchronous:true,
evalScripts:true, parameters:Form.serialize('form1521548612'),
requestHeaders:['X-Update', 'comments']}) }, false);
//]]
/script   div class=input textlabel for=naamNaam/labelinput
name=data[naam] type=text value= id=naam //div   div
class=input textlabel for=contentContent/labelinput
name=data[content] type=text value= id=content //div input
type=hidden name=data[comment][post_id] value=19
id=commentPostId /   div class=submitinput type=submit
value=Comment toevoegen //div/form

so when i try to add a comment i get a error that there is not an
action in my posts controller called comments
Why does he add posts in the action of the form. I know that im in
the posts controller, but i thought if you start with / in starts in
the root of your controller files?

Who can help me?

Thanks

 Chris

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



Re: More then 1 .po file for i18n/l10n

2008-12-11 Thread James K

Yes, you can make folders and separate po files in the locale
directories.

So if I made a file in locale/eng/LC_MESSAGES/users/ called
profile.po, to get the keys out of it, in your app, you'd use the __d
function: __d('users/profile', 'welcome_text')

On Dec 10, 8:57 pm, gearvOsh [EMAIL PROTECTED] wrote:
 So I have an existing language system on a site that I am converting
 to CakePHP. This language system has about 8 files, each with a long
 list of variables. I noticed in Cake it only has a default.po file,
 are we able to add more then just the default.po file? If so, what if
 there are 2 variables named the same, but in 2 different .po files.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: dynamically fetch the data

2008-12-11 Thread WebbedIT

Sami, this is now your 4th post on this topic ... please try and group
related topics together so people can see the full history of your
issue.

As long as the data submitted on the page refresh is being sent in the
$data[] array, it should automatically be available to the controller.

On Dec 11, 2:14 pm, Sami [EMAIL PROTECTED] wrote:
 hi,
   how to post selected index in selection box , This my coding...
 In controller:
 ..var $name = 'Alerts';
         var $helpers = array('Html', 'Form','Util');
        var $paginate=array('limit'=10,'page'=1,'order'=array
 ('Alert.created'='DESC'));
         function index() {
                $this-Alert-recursive = 0;
                $this-set('alerts', $this-paginate());
            }
 In index.ctp
 ...
 script type='text/javascript'
 function orders(dd){
 alert(dd);
 //return dd;}/script

 ...
 echo $form-input('i',array('type'='select','options'=array(
         '0'='Sort by Date Descending',
         '1'='Sort by Date Ascending',
         '2'='Sort by Category/Date Descending',
         '3'='Sort by Title/Date Descending'),
         'onChange'='orders(this.value)'));

 i got id, but i dont have idea to pass the data from index.ctp file to
 controller file.
 Here input value  is not a database variable. If user select the order
 in selection box how to change the paginate order query at
 dynamically. I dont have idea. Any body help me, i really thanks to u.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HABTM relation on same model - cake doesn't save other fields now?!

2008-12-11 Thread miller218


I've just checked the content of the $this-data variable which is saved by
the edit function in the controller.. It contains all changes!! but somehow
the $this-DictWord-save($this-data) function just saves the HABTM
relation and ignores the other fields!
Any ideas?


-- 
View this message in context: 
http://n2.nabble.com/HABTM-relation-on-same-model---cake-doesn%27t-save-other-fields-now-%21-tp1638973p1643578.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Re: named params and prefix routing

2008-12-11 Thread Lane

What were you expecting the Router to return if not /invoices/edit/5/
owner:1/key:val?

On Dec 11, 4:39 am, Marcelius [EMAIL PROTECTED] wrote:
 Hello!

 I have this route like the manual says for prefix routing:

 Router::connect('/owner/:controller/:action/*', array
 ('prefix'='owner', 'owner'=true));

 This works fine until I want to create a url with some named params in
 it:

 Router::url(array(controller=invoices, action=edit, 5,
 owner=true));
 returns /owner/invoices/edit/5 as expected.

 Router::url(array(controller=invoices, action=edit, 5,
 owner=true, key=val));
 returns /invoices/edit/5/owner:1/key:val not as expected.

 Something wrong in my routes? Please note that that's the only route
 available.

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



Ajax Form Reload

2008-12-11 Thread marco.rizze...@gmail.com

Hi
I would a advice.
I have a view where I have a ajax form and a list of element that I
get from the property set in the form.
Now I would that the form is a ajax form and then I submit the form
then the view is reload exactly where the view is previously loaded.
How can I do it?
Many Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Getting simpletest to work with test DB

2008-12-11 Thread Ed Howland

On Thu, Dec 11, 2008 at 2:19 AM, Marcus [EMAIL PROTECTED] wrote:

 Same problem here. The error message Database table not found
 appeared with changeset 7870 of CakePHP.

So an earlier changeset might work for me?

 When calling ClassRegistry::init('Foo') in the startTest method of a
 test case, Cake tries to set up 'Foo' with all the associated models
 and fails when initializing the first related model: CakePHP reads the
 schema definition from database with wrong connection.


 When calling ClassRegistry::init('Foo'), Cake uses the 'default'
 connection for getting the schema for 'Foo' and everything works fine.
 Then the first related Model is initialized, CakePHP tries to read the
 schema, but now with the 'test_suite' connection, which raises the
 error because the table doesn't exist in the test database.


I poked around some more and I think I am seeing the same thing.

 Is this an error that should be filed to trac?

Nothing open in trac at the moment. perhaps a closed
 Marcus

On Thu, Dec 11, 2008 at 8:22 AM, mark_story [EMAIL PROTECTED] wrote:

 How are your fixtures setup?
var $fixtures = array('app.form', 'app.program');

 Are you using imports?
App::import('Model', 'Form');

 Are you initializing your models in setup() or startTest()?
function start() {
parent::start();
$this-Form = new TestForm();
}

 Are you using ClassRegistry::init() or are you use new Model()?
Tried both. But it came with new Model();

It seems like a DB connection issue, as Marcus said. I wonder if it
work with models with no associations.

Ed
 




-- 
Ed Howland
http://greenprogrammer.blogspot.com
http://twitter.com/ed_howland

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



Re: Getting simpletest to work with test DB

2008-12-11 Thread Marcus

On Dec 11, 3:22 pm, mark_story [EMAIL PROTECTED] wrote:
 How are your fixtures setup?
 Are you using imports?
 Are you initializing your models in setup() or startTest()?
 Are you using ClassRegistry::init() or are you use new Model()?

Hey Mark,

(i) Fixtures Setup (comments and wihitespaces stripped out)

user_group_fixture.php:

class UserGroupFixture extends CakeTestFixture
{
  public $name = 'UserGroup';
  public $import = array('model' = 'UserGroup', 'records' = true);
}

user_fixture.php:

class UserFixture extends CakeTestFixture
{
  public $name = 'User';
  public $import = array('model' = 'User', 'records' = false);
  public $records = array(
array(
  'id'= 1,
  'user_group_id' = 2,
  'name'  = 'foo',
  'password'  =
'288f5ed10f9b731149ad3e3bcdd6add568bb61a3',
  'salt'  = '34da1b0c',
  (...)
)
  );
}

(ii) Using imports

Yes, schema is imported in all cases, records just in some cases.

(iii) Initializing of models

The model is initialized with ClassRegistry::init():

user.test.php

class UserTestCase extends CakeTestCase
{
  public $User = null;
  public $fixtures = array('app.user', 'app.user_group');
  public function start()
  {
parent::start();
Configure::write('debug', 2);
  }

  public function end()
  {
  parent::end();
  }

  public function startTest($method)
  {
$this-User = ClassRegistry::init('User');
$this-User-query(--  STARTING TEST:  .
$method .  );
  }

  public function endTest($method)
  {
  }

  public function testHashPassword()
  {
$this-assertEqual($this-User-hashPassword('foo'), 'bar');
  }
}

In this example, the user model is associated with the user_group
model (user belongsTo user_group, user_group hasMany user). Tests are
failing with Error:  Database table user_groups for model UserGroup
was not found. in this case.

This setup was fine until revision 7869. As of revision 7870 tests are
failing.

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



Re: Getting simpletest to work with test DB

2008-12-11 Thread Marcus

On Dec 11, 5:01 pm, Ed Howland [EMAIL PROTECTED] wrote:
  Same problem here. The error message Database table not found
  appeared with changeset 7870 of CakePHP.

 So an earlier changeset might work for me?

Maybe. Here it works when I downgrade CakePHP to revision 7869.

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



Re: Another Dynamic Database Issue

2008-12-11 Thread bademan

I smell security implications... maybe it  is just the burrito. Since
these accounts are SQL system accounts, that would imply that to
connect to the server in the first place, I would need a SQL login
account that has high level security access. This would be a bad idea
because the username and password will be in the database.php
file... right? Again maybe I am looking at this the wrong way.

My reasoning above stems from the fact that when a user log into the
system, they have to be validated somehow. Now I would like to use the
user's supplied username and password to connect to the MS SQL DB but
in conventional cases, one has to connect to the database with a
specific (static) username and password and then check to see if the
supplied login credentials validate against the users table. From what
I have see so far Auth and Acl work better with the later case.

If my thinking is incorrect, then I need to go back to the manual
again otherwise I am still up in a bind... Thanks for you input guys.

B.I.

On Dec 11, 8:34 am, Rob [EMAIL PROTECTED] wrote:
 As long as it is SQL server security, it is essentially a table, and
 you should be able to model that with Cake. You basically just need
 the model for your users data and point Auth at that model.

 That said, I have never tried this with SQL express, so it might take
 a bit of playing to get it to work.

 Ultimately to use Auth, you have to tell Cake about the tables to use
 for authentication, and I'm thinking there would be a fair amount of
 code you'd need to add to get it to work with a table that is storing
 data differently than the standard Auth expects (e.g. - hashed
 passwords for instance).

 On Dec 10, 1:23 pm, bademan [EMAIL PROTECTED] wrote:

  After chasing my tail a bit, I think I failed to expalin my dilemma
  better. The database in question is an MS SQL Express DB and the user
  accounts are not necessarily stored in a table within the DB, they are
  more like DB system accounts (i.e. stored in SQLSERVER//Security//
  Logins). This is why I am still unsure that Auth and Acl might be able
  to solve the issue. Can you let me know if my task is still possible
  (i.e. given the original context). Thanks.

  B.I.

  On Dec 9, 3:32 pm, AD7six [EMAIL PROTECTED] wrote:

   On Dec 9, 10:10 pm, WebbedIT [EMAIL PROTECTED] wrote:

 I just use Auth and ACL for what you're talking about.

As Rob states Auth and ACL should be the way to go, but a word of
warning!  I for one have had problems employing Auth and ACL and
judging by the amount of blogs and tutorials on the subject so do many
others.

I came across the following blog today (within this group) which looks
promising to as a reference for finally getting my head around Auth
and ACL.  May be worth a look ;)

   http://www.ad7six.com/MiBlog/Authenticationhttp://www.ad7six.com/MiBl...

Good luck!

   Careful, like so many things out there those posts from my blog are
   old and (at least the technical details are) obsolete ;) that content
   predates 1.2 and the auth/acl components although the general concepts
   are of course still valid.

   I'd recommend 
   startinghttp://book.cakephp.org/view/641/Simple-Acl-controlled-Application
   on any acl/auth quest. and quite simply any auth solution that isn't
   based on the core auth component is imo not a best practice - the auth
   component get's imporved and is widely used (and phenomenally
   configurable) whereas other solutions are not or even if they are have
   a much smaller userbase.

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



Using the PagesController

2008-12-11 Thread Rob Wilkerson

This is a pretty straightforward question, I think, but I can't find
much information about using the page controller effectively, so I
decided to just ask.  My homepage is using the typical page controller
(moved to app/controllers) and home.ctp view.  However, now I need to
make some dynamic information available. I need to load a model, but
only for the homepage.

Given that there's a single page controller (and I don't particularly
want a separate controller for each page), is there any way to tell
the controller to load the model I need, but only when the homepage is
requested? If so, how do I need to modify the PagesController to make
that happen?

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



Re: named params and prefix routing

2008-12-11 Thread Andras Kende
Hello,

I had some issue with multiple admin routes, links or paginator links were
incorrect or mixed up ...
this routes works for me now without :

routes.php
?php
   ..
   ..

$parts = explode('/',$_SERVER['REQUEST_URI']);
$area = $parts[1];
$areas = array(admin, nurse, practice);
if (in_array($area,$areas)){
Router::connect(/.$area., array(controller=page,
prefix=$area, action=index, $area));
Router::connect(/.$area./:controller/:action, array(prefix=$area,
.$area.=true));
Router::connect(/.$area./:controller/:action/*,
array(prefix=$area, .$area.=true));
Router::connect(/.$area./:controller/:action/*,
array(prefix=$area));
}
?


Andras Kende

On Thu, Dec 11, 2008 at 6:39 AM, Marcelius [EMAIL PROTECTED] wrote:


 Hello!

 I have this route like the manual says for prefix routing:

 Router::connect('/owner/:controller/:action/*', array
 ('prefix'='owner', 'owner'=true));

 This works fine until I want to create a url with some named params in
 it:

 Router::url(array(controller=invoices, action=edit, 5,
 owner=true));
 returns /owner/invoices/edit/5 as expected.

 Router::url(array(controller=invoices, action=edit, 5,
 owner=true, key=val));
 returns /invoices/edit/5/owner:1/key:val not as expected.

 Something wrong in my routes? Please note that that's the only route
 available.

 Thanks in advance!
 


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



Re: Another Dynamic Database Issue

2008-12-11 Thread Rob

You are correct, the Cake connection is controlled by the database.php
settings, so it uses a particular user to connect to the database.

I hadn't thought this through before, but by virtue of the fact that
you would want to use the built-in database security, you'd need to
come up with a way to have each session have a connection that was
based on the particular user. Sounds like a fairly large amount of
twisting of Cake to me.

Traditional web services use a single user with access to appropriate
tables, and handles data access separately. I believe it would be
possible to utilize the in-built SQL authentication, but like I said
it would be a fairly large number of hoops to jump through (like
setting up a user who isn't a DBA to be able to query the security
tables in order to validate if the user should be able to use things
or not).

Nothing like building the whole security layer all over again if you
want a challenge ;-)

On Dec 11, 8:32 am, bademan [EMAIL PROTECTED] wrote:
 I smell security implications... maybe it  is just the burrito. Since
 these accounts are SQL system accounts, that would imply that to
 connect to the server in the first place, I would need a SQL login
 account that has high level security access. This would be a bad idea
 because the username and password will be in the database.php
 file... right? Again maybe I am looking at this the wrong way.

 My reasoning above stems from the fact that when a user log into the
 system, they have to be validated somehow. Now I would like to use the
 user's supplied username and password to connect to the MS SQL DB but
 in conventional cases, one has to connect to the database with a
 specific (static) username and password and then check to see if the
 supplied login credentials validate against the users table. From what
 I have see so far Auth and Acl work better with the later case.

 If my thinking is incorrect, then I need to go back to the manual
 again otherwise I am still up in a bind... Thanks for you input guys.

 B.I.

 On Dec 11, 8:34 am, Rob [EMAIL PROTECTED] wrote:

  As long as it is SQL server security, it is essentially a table, and
  you should be able to model that with Cake. You basically just need
  the model for your users data and point Auth at that model.

  That said, I have never tried this with SQL express, so it might take
  a bit of playing to get it to work.

  Ultimately to use Auth, you have to tell Cake about the tables to use
  for authentication, and I'm thinking there would be a fair amount of
  code you'd need to add to get it to work with a table that is storing
  data differently than the standard Auth expects (e.g. - hashed
  passwords for instance).

  On Dec 10, 1:23 pm, bademan [EMAIL PROTECTED] wrote:

   After chasing my tail a bit, I think I failed to expalin my dilemma
   better. The database in question is an MS SQL Express DB and the user
   accounts are not necessarily stored in a table within the DB, they are
   more like DB system accounts (i.e. stored in SQLSERVER//Security//
   Logins). This is why I am still unsure that Auth and Acl might be able
   to solve the issue. Can you let me know if my task is still possible
   (i.e. given the original context). Thanks.

   B.I.

   On Dec 9, 3:32 pm, AD7six [EMAIL PROTECTED] wrote:

On Dec 9, 10:10 pm, WebbedIT [EMAIL PROTECTED] wrote:

  I just use Auth and ACL for what you're talking about.

 As Rob states Auth and ACL should be the way to go, but a word of
 warning!  I for one have had problems employing Auth and ACL and
 judging by the amount of blogs and tutorials on the subject so do many
 others.

 I came across the following blog today (within this group) which looks
 promising to as a reference for finally getting my head around Auth
 and ACL.  May be worth a look ;)

http://www.ad7six.com/MiBlog/Authenticationhttp://www.ad7six.com/MiBl...

 Good luck!

Careful, like so many things out there those posts from my blog are
old and (at least the technical details are) obsolete ;) that content
predates 1.2 and the auth/acl components although the general concepts
are of course still valid.

I'd recommend 
startinghttp://book.cakephp.org/view/641/Simple-Acl-controlled-Application
on any acl/auth quest. and quite simply any auth solution that isn't
based on the core auth component is imo not a best practice - the auth
component get's imporved and is widely used (and phenomenally
configurable) whereas other solutions are not or even if they are have
a much smaller userbase.

AD


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

Re: Using the PagesController

2008-12-11 Thread brian

This is what elements are for. There's no need to modify PagesController.

On Thu, Dec 11, 2008 at 11:58 AM, Rob Wilkerson [EMAIL PROTECTED] wrote:

 This is a pretty straightforward question, I think, but I can't find
 much information about using the page controller effectively, so I
 decided to just ask.  My homepage is using the typical page controller
 (moved to app/controllers) and home.ctp view.  However, now I need to
 make some dynamic information available. I need to load a model, but
 only for the homepage.

 Given that there's a single page controller (and I don't particularly
 want a separate controller for each page), is there any way to tell
 the controller to load the model I need, but only when the homepage is
 requested? If so, how do I need to modify the PagesController to make
 that happen?

 Thanks.
 


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



Re: Using the PagesController

2008-12-11 Thread Rob Wilkerson

On Thu, Dec 11, 2008 at 12:04 PM, brian [EMAIL PROTECTED] wrote:

 This is what elements are for. There's no need to modify PagesController.

This is true, so let me ask a couple of follow up questions around
best practices, etc.

First, in this case, I'd only need this element once. Is an element
still the best option?
Second, how should I make a model available to the element so that I
can find() the records I need to display?

Thanks for your help.

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



Re: Using the PagesController

2008-12-11 Thread Sam Sherlock
I would say that element would be best but because you need to model-find
you need to use something like requestAction
or
http://mark-story.com/posts/view/reducing-requestaction-use-in-your-cakephp-sites-with-fat-models

as your doing a little and only want template echo'd in view and calls to
helpers and elements



2008/12/11 Rob Wilkerson [EMAIL PROTECTED]


 On Thu, Dec 11, 2008 at 12:04 PM, brian [EMAIL PROTECTED] wrote:
 
  This is what elements are for. There's no need to modify PagesController.

 This is true, so let me ask a couple of follow up questions around
 best practices, etc.

 First, in this case, I'd only need this element once. Is an element
 still the best option?
 Second, how should I make a model available to the element so that I
 can find() the records I need to display?

 Thanks for your help.

 


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



Tip: ignoring tmp dirs in Subversion

2008-12-11 Thread Ed Howland

This always confused me.

cd app
svn up
find tmp -type d | grep -v svn| xargs -L1 svn propset svn:ignore '*'
svn commit -m ignoring app/tmp in subversion

HTH someone
Ed

-- 
Ed Howland
http://greenprogrammer.blogspot.com
http://twitter.com/ed_howland

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



Re: Getting simpletest to work with test DB

2008-12-11 Thread mark_story

Thanks marcus, I'll try to get this setup locally and see if I can get
it fixed.  Perhaps you could file a ticket as well so I don't forget.
But your test looks like it should be working, so that's a problem.

-Mark

On Dec 11, 11:09 am, Marcus [EMAIL PROTECTED] wrote:
 On Dec 11, 3:22 pm, mark_story [EMAIL PROTECTED] wrote:

  How are your fixtures setup?
  Are you using imports?
  Are you initializing your models in setup() or startTest()?
  Are you using ClassRegistry::init() or are you use new Model()?

 Hey Mark,

 (i) Fixtures Setup (comments and wihitespaces stripped out)

 user_group_fixture.php:

 class UserGroupFixture extends CakeTestFixture
 {
   public $name = 'UserGroup';
   public $import = array('model' = 'UserGroup', 'records' = true);

 }

 user_fixture.php:

 class UserFixture extends CakeTestFixture
 {
   public $name = 'User';
   public $import = array('model' = 'User', 'records' = false);
   public $records = array(
     array(
       'id'                        = 1,
       'user_group_id'             = 2,
       'name'                      = 'foo',
       'password'                  =
 '288f5ed10f9b731149ad3e3bcdd6add568bb61a3',
       'salt'                      = '34da1b0c',
       (...)
     )
   );

 }

 (ii) Using imports

 Yes, schema is imported in all cases, records just in some cases.

 (iii) Initializing of models

 The model is initialized with ClassRegistry::init():

 user.test.php

 class UserTestCase extends CakeTestCase
 {
   public $User = null;
   public $fixtures = array('app.user', 'app.user_group');
   public function start()
   {
     parent::start();
     Configure::write('debug', 2);
   }

   public function end()
   {
       parent::end();
   }

   public function startTest($method)
   {
     $this-User = ClassRegistry::init('User');
     $this-User-query(--  STARTING TEST:  .
 $method .  );
   }

   public function endTest($method)
   {
   }

   public function testHashPassword()
   {
     $this-assertEqual($this-User-hashPassword('foo'), 'bar');
   }

 }

 In this example, the user model is associated with the user_group
 model (user belongsTo user_group, user_group hasMany user). Tests are
 failing with Error:  Database table user_groups for model UserGroup
 was not found. in this case.

 This setup was fine until revision 7869. As of revision 7870 tests are
 failing.

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



Re: Tip: ignoring tmp dirs in Subversion

2008-12-11 Thread Marcus

On Dec 11, 6:40 pm, Ed Howland [EMAIL PROTECTED] wrote:
 This always confused me.

 cd app
 svn up
 find tmp -type d | grep -v svn| xargs -L1 svn propset svn:ignore '*'
 svn commit -m ignoring app/tmp in subversion

This isn't a good solution: If you check out your project on another
machine, the whole 'tmp' directory and its structure is missing.

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



Re: Newbie question on form validating

2008-12-11 Thread gearvOsh

Yes, I was about to to point out that it might be because your model
file name is capitalized.

On Dec 11, 4:57 am, AJV aapo.vi...@gmail.com wrote:
 :D

 Well I guess I just confirmed my newbie status, I had written the
 names of the model files Capitalized. I noticed that small letters
 work much better :D

 Well, that was a fun couple of hours.

 Aapo

 On Dec 11, 2:49 pm, AJV aapo.vi...@gmail.com wrote:

  I'm quessing this has something to do with communicating with the
  model file. Even if I write die() or some broken code to the model,
  nothing happens. Are there any ways to confirm that the controller
  talks to the model, and if not, how could it be fixed?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using PHP to export MySQL data MS excel files

2008-12-11 Thread Reggie Mason

Sorry liaogz82, I don't have any examples to show, and searching
google was not fruitful.

On Dec 9, 8:15 pm, liaogz82 liaog...@gmail.com wrote:
 hi Reggie,

 As i am a newbie in cakePHP, I am not sure how to integrate the pear
 libraries into the vendor folder of cake. Have you publish any
 documents or post any blog that will aid me in getting started?

 On Dec 10, 3:12 am, Reggie Mason tehtr...@gmail.com wrote:

  I've had success with the PEAR's Spreadsheet Excel Writer 
  --http://pear.php.net/package/Spreadsheet_Excel_Writer, with CakePHP.
  I'm not sure about charts; I'd leave that to Excel. Make sure PEAR is
  in your include path, and include it in your view.  Enjoy.

  On Nov 26, 12:54 am, liaogz82 liaog...@gmail.com wrote:

   Hi,

   I am looking into ways to use cakePHP to query into MySQL database to
   extract out the relevant data, then export out a report in MS excel
   that will include several pie charts. Such reports are to review by
   user on the browser first before it is being exported. Is there anyway
   to do it?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Tip: ignoring tmp dirs in Subversion

2008-12-11 Thread Ed Howland

On Thu, Dec 11, 2008 at 12:16 PM, Marcus rik...@gmail.com wrote:

 On Dec 11, 6:40 pm, Ed Howland ed.howl...@gmail.com wrote:
 This always confused me.

 cd app
 svn up
 find tmp -type d | grep -v svn| xargs -L1 svn propset svn:ignore '*'
 svn commit -m ignoring app/tmp in subversion

 This isn't a good solution: If you check out your project on another
 machine, the whole 'tmp' directory and its structure is missing.

It worked for me I did two commit+checkout round trips, and the tmp
structure was maintained. I did have to svn rm the old cache files,
but now svn st reports no changes. I think that works because the
pattern supplied was '*' and svn propset does not apply that to
directories.

Let me know if you have a different experience.

Ed



 Marcus
 




-- 
Ed Howland
http://greenprogrammer.blogspot.com
http://twitter.com/ed_howland

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



Problem with seeing files?

2008-12-11 Thread webdev.ter...@gmail.com

this is my first day with Cake, so far so good I had thought, got the
installation and db up and connected then I went to view my file I
created but get a 404 everytime, I have found other posts on this but
they are all lucky enough to be working on Apache servers and I am
unfortunately on IISany clue how I can resolve this?

Thanks
terion

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



Prevent redirect in Auth

2008-12-11 Thread Dav

Hi,

I want to use the Auth component but I don't want it to send out the
location: header.
(I'm not using ajax)

I just want to be able to override and control what should happen when
a controller with auth is accessed.

For instance just print out a custom error message.

Doable?

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



Routers and paginator problem

2008-12-11 Thread Chikiro

I have router:
//category single
Router::connect('/categories/:slug/*,
array('controller'='categories', 'action'='view'),
array('pass'=array('slug'), 'slug'='[0-9a-z-]+'));
//categories list
Router::connect('/categories/*', array('controller'='categories',
'action'='index'));

I want to have a list of categories (url mysite.com/categories/)
and a list of articles of each category (url mysite.com/categories/
category-slug)
also I want pagination if there are too many articles (url mysite.com/
categories/category-slug/page:page_num)

$paginator-numbers(array('url' = array('slug'=$slug)));

but paginators returns links like mysite.com/categories/category-slug-
from-pass/category-slug-from-paginator/page:page_number

What's wrong?

I removed value 'pass' from router but don't like that solution.
Is there somthing else I can do?

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



API Documentation Question

2008-12-11 Thread Nancy

So, I've been trying to use the API documentation found here:
http://api.cakephp.org/classes.html

But I can't figure out how to find the parameters and options that one
can send to the methods.   Is there better documentation of the API
elsewhere or am I just not using it correctly?

Thanks!

Nancy

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



Finding Auth'd users Username

2008-12-11 Thread bioselem...@gmail.com

I've been wacking my head on the wall for the past few days on this.
I've got a basic auth login/logout system set up but for some reason
nothing i try gets me the username. I just want to display it as in
Your logged in as xyz. I know it's probably something stupid and I'm
no doubt going about it the wrong way. Any help?

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



Re: Pagination link URL doesn't work with extra variable

2008-12-11 Thread Chikiro

When you have in router variable 'pass' it appears twice. (i don't
know if it's a bug or a feature)
$this-params[pass'][] and $this-paramas['location']
I removed array 'pass' from Router::connect and urls are fine now, but
I need to get variables from $this-params in controller.
Perhaps there is better solution.

On Oct 19, 4:07 pm, Daehee Park dae...@gmail.com wrote:
 Nice, now the links actually are clickable and route to the correct
 pagination view. But the link still looks like this:

 http://localhost/test/newyorkcity/spots/newyorkcity/page:2

 So using the options() in the paginationhelper is passing it twice to the
 controller? If I *don't* use the options, however, the location is only
 passed once through the url formatting but the links are no longer
 clickable.

 For reference, here are my changes as suggested by Mathew:

 ?php $paginator-options(array('url' = array('location' =
 $this-params['location']))); ?

 Router::connect('/:location/spots/*', array('controller' = 'spots',
 'action' = 'index'), array('pass' = array('location'), 'location' =
 '[a-z]+'));

 On Sun, Oct 19, 2008 at 8:48 AM, Mathew nfoscar...@yahoo.com wrote:

   Router::connect('/:location/spots/:page', array('controller' =
   'spots', 'action' = 'index'), array('pass' = array('location'),
   'location' = '[a-z]+'));

  Your router should be like this.

  Router::connect('/:location/spots/*, array('controller' ='spots',
  'action' = 'index'), array('pass' = array('location'),'location' =
  '[a-z]+'));

  You also need to add the location as an option for pagination in your
  view. So that it includes it when creating the URLs.

  $paginator-options(array('url' =array('location'=$this-
  params['location])));

  If you don't have the location added as an option, then the Router
  will not match it to your URL pattern, and you need to have the wild
  character at the end of your connect URL, because pagination generates
  many types of parameters. Such as page, sorting, and field.

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



Why is this query returning such an odd array?

2008-12-11 Thread matth

The keywords query in the view() function is returning the following
array:
Array ( [Hit] = Array ( [keyword] = banana ) [0] = Array ( [count]
= 1 ) )

I am going for: Array ( [Hit] = Array ( [keyword] = banana, [count]
= 1 ) )

class ItemsController extends AppController
{
var $name = 'Items';
var $uses = array('Item', 'Hit');
function index()
{
$this-pageTitle = 'Items';
#FIND UNIQUE!
#$this-set('items', $this-Item-findAll());
$this-set('items', $this-Item-query(SELECT * FROM items));
}

function view($item_id = null)
{
$this-pageTitle = 'Item #'. $item_id;

$this-Item-id = $item_id;
$this-set('item', $this-Item-read());

$this-set('keywords', $this-Hit-find('all', array
('conditions'='item_id='.$item_id.' AND keyword !=',
'fields'=array('DISTINCT keyword','COUNT(*) AS count'), 'group'=array
('keyword'), 'order'='count DESC')));
}

}


Table Structure:
hits

hit_id
ipa
referer
domain
date
item_id
keyword

items
-
item_id
title


Is my query incorrect? Could it be a problem with my model?

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



My blog tutorial is working for other but not working on my server ...

2008-12-11 Thread xfhxfh

Hi ...
I'm just getting started and did the blog 1.2 tutorial.

My webroot index at http://dev1.onefh.com/ is all o.k. and green.

But the blog app at http://dev1.onefh.com/posts doesn't come up ... 2
red 1 yellow

I uploaded the blog.zip + the database dump to http://www.2he.com/dev/
and two

friends on freenode.net IRC downloaded and checked it ... was working
for them

Have no Idea what else I need to teach my server ...
can you guys help me out ?

Best,
Frank


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



Re: Finding Auth'd users Username

2008-12-11 Thread gearvOsh

If your logged in its:

$this-Auth-user('username');

Or you can assign a user variable to the view:

$this-set('user', $this-Auth-user());

echo $user['username'];

Hope that helps.

On Dec 11, 11:10 am, bioselem...@gmail.com bioselem...@gmail.com
wrote:
 I've been wacking my head on the wall for the past few days on this.
 I've got a basic auth login/logout system set up but for some reason
 nothing i try gets me the username. I just want to display it as in
 Your logged in as xyz. I know it's probably something stupid and I'm
 no doubt going about it the wrong way. Any help?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Prevent redirect in Auth

2008-12-11 Thread gearvOsh

Perhaps look at this: http://book.cakephp.org/view/395/autoRedirect

If that doesnt work, you may have to edit the core files manually.

On Dec 11, 9:40 am, Dav fatsl...@gmail.com wrote:
 Hi,

 I want to use the Auth component but I don't want it to send out the
 location: header.
 (I'm not using ajax)

 I just want to be able to override and control what should happen when
 a controller with auth is accessed.

 For instance just print out a custom error message.

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



Re: $form-input() helper question

2008-12-11 Thread maytawn

Firebug did not show the formatting being applied to the elements.

!-- START MAIN BODY DIV --
div id=content
h3 style=margin-bottom:10pxChange Your Password/h3
p style=margin-bottom:10pxEnter your new password twice to change
it./p
form id=UserChangePasswordForm method=post action=/cord/app/
webroot/index.php/users/change_password
fieldset style=display:none;input type=hidden name=_method
value=POST //fieldset
fieldset class=noformat
div class=input passwordlabel for=UserPasswordNew Password:/
labelinput type=password name=data[User][password] class=input
input-long value= id=UserPassword /br //div
div class=input passwordlabel for=UserPassword2Confirm New
Password:/labelinput type=password name=data[User][password2]
style=width:150px value= id=UserPassword2 /br //div
/fieldset
div class=submitinput type=submit value=Change Password //
div/form
/div
!-- END MAIN BODY DIV --


On Dec 11, 4:02 am, Jon Bennett jmbenn...@gmail.com wrote:
 Hi maytawn,

   Thanks for the suggestion.  I tried it... but it did not seem to work.

   I added the CSS to my main css file.  And this is what I have in the
   view:

 what was the outputted html like? What did Firebug say tell you about
 the elements? What I suggested with definitely work in theory, but the
 CSS was untested, merely there to show how you can apply more than one
 class to an element.

 cheers,

 jon

 --

 jon bennett
 w:http://www.jben.net/
 iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Finding Auth'd users Username

2008-12-11 Thread Brett Wilton

In your view you can use something like :-

if ($session-check('Auth.User.id')) {
  echo $session-read('Auth.User.username');
}


Brett Wilton
http://wiltonsoftware.com

On Fri, Dec 12, 2008 at 8:10 AM, bioselem...@gmail.com
bioselem...@gmail.com wrote:

 I've been wacking my head on the wall for the past few days on this.
 I've got a basic auth login/logout system set up but for some reason
 nothing i try gets me the username. I just want to display it as in
 Your logged in as xyz. I know it's probably something stupid and I'm
 no doubt going about it the wrong way. Any help?

 


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



Re: bakery articles

2008-12-11 Thread Brett Wilton

I'd be interested in having a read when it gets published. I
bookmarked Mobilize your cake app in minutes some time back to read
when I got a chance (might be your article) but haven't been able to
access it since initially having a quick glance.

Maybe cakefest has slowed things down.


Brett Wilton
http://wiltonsoftware.com

On Thu, Dec 11, 2008 at 4:04 AM, rgu...@googlemail.com
rgu...@googlemail.com wrote:

 Hi all,

 I've recently written a bakery article with regards to mobilizing cake
 applications.

 It got published (hooray), but i made a change to add a tracking code
 to a URL and it got unpublished (booo).

 I've been waiting for 3/4 weeks for it to be re-published, is there
 anyway I can get the process sped up a bit? I'm really keen to have
 people read it as I think it'll really help with getting websites /
 web applications out to mobile handsets!

 Thanks!
 Rich G

 


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



Re: Problem with seeing files?

2008-12-11 Thread Terion Miller
Is there any answer to this I have tried every Cake and IIS trick I have
found...I installed the mod_rewrite for IIS, then had to uninstall it
because it just kept resolving all URL's to the index of the root :
http://127.0.0.1
my cake blog tutorial is installed like this: http://127.0.0.1/cakeblog/
and it works (well the index does) great says the db is config'd and
connected and all is well, until I go to browse the posts, then 404 this
seems to be a common problem encountered but I must be doing something wrong
because I can't get it resolved.

Anyone ?

On Thu, Dec 11, 2008 at 1:20 PM, webdev.ter...@gmail.com 
webdev.ter...@gmail.com wrote:


 this is my first day with Cake, so far so good I had thought, got the
 installation and db up and connected then I went to view my file I
 created but get a 404 everytime, I have found other posts on this but
 they are all lucky enough to be working on Apache servers and I am
 unfortunately on IISany clue how I can resolve this?

 Thanks
 terion

 


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



Re: $form-input() helper question

2008-12-11 Thread maytawn

gearvOsh -

Yeah, your're right.  I don't know what I was thinking... but is does
bring up a related question.  If I was using the CakePHP form
validation then I would need my input tags wrapped in the correct div
tags... correct?  Since I'm setting div=false how whold I modify your
suggestion to make sure my input tags are wrapped in the correct div
tags?  would I have to do that by hand too, using $html-div()?

On Dec 11, 4:02 am, Jon Bennett jmbenn...@gmail.com wrote:
 Hi maytawn,

   Thanks for the suggestion.  I tried it... but it did not seem to work.

   I added the CSS to my main css file.  And this is what I have in the
   view:

 what was the outputted html like? What did Firebug say tell you about
 the elements? What I suggested with definitely work in theory, but the
 CSS was untested, merely there to show how you can apply more than one
 class to an element.

 cheers,

 jon

 --

 jon bennett
 w:http://www.jben.net/
 iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: My blog tutorial is working for other but not working on my server ...

2008-12-11 Thread Marcelo Andrade
On Thu, Dec 11, 2008 at 6:01 PM, xfhxfh fh...@onefh.com wrote:

 Hi ...
 I'm just getting started and did the blog 1.2 tutorial.

 My webroot index at http://dev1.onefh.com/ is all o.k. and green.

 But the blog app at http://dev1.onefh.com/posts doesn't come up ... 2
 red 1 yellow

 I uploaded the blog.zip + the database dump to http://www.2he.com/dev/
 and two

 friends on freenode.net IRC downloaded and checked it ... was working
 for them

 Have no Idea what else I need to teach my server ...
 can you guys help me out ?

How about your httpd.conf configuration?  Have you
configured correctly (mod_rewrite, AllowOverride all,
etc)?

Best regards.

--
MARCELO DE F. ANDRADE (aka eleKtron)
Belem, PA, Amazonia, Brazil
Linux User #221105

[...@pará ~]# links http://pa.slackwarebrasil.org/

For Libby's backstory be told on Lost
http://www.petitiononline.com/libby423/petition.html

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



Re: Getting simpletest to work with test DB

2008-12-11 Thread mark_story

Should be fixed now! :)

On Dec 11, 11:10 am, Marcus rik...@gmail.com wrote:
 On Dec 11, 5:01 pm, Ed Howland ed.howl...@gmail.com wrote:

   Same problem here. The error message Database table not found
   appeared with changeset 7870 of CakePHP.

  So an earlier changeset might work for me?

 Maybe. Here it works when I downgrade CakePHP to revision 7869.

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



Re: $form-input() helper question

2008-12-11 Thread gearvOsh

Yes most likely, but in my own apps I just write the div manually and
only use $html for forms/links and images.

On Dec 11, 1:53 pm, maytawn mayt...@gmail.com wrote:
 gearvOsh -

 Yeah, your're right.  I don't know what I was thinking... but is does
 bring up a related question.  If I was using the CakePHP form
 validation then I would need my input tags wrapped in the correct div
 tags... correct?  Since I'm setting div=false how whold I modify your
 suggestion to make sure my input tags are wrapped in the correct div
 tags?  would I have to do that by hand too, using $html-div()?

 On Dec 11, 4:02 am, Jon Bennett jmbenn...@gmail.com wrote:

  Hi maytawn,

    Thanks for the suggestion.  I tried it... but it did not seem to work.

    I added the CSS to my main css file.  And this is what I have in the
    view:

  what was the outputted html like? What did Firebug say tell you about
  the elements? What I suggested with definitely work in theory, but the
  CSS was untested, merely there to show how you can apply more than one
  class to an element.

  cheers,

  jon

  --

  jon bennett
  w:http://www.jben.net/
  iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Finding Auth'd users Username

2008-12-11 Thread bioselem...@gmail.com

Amazing. Thanks for your help, both of you. I think I'm good now. ^_^
*goes off to write a snippit on it*. Thanks alot. :)

On Dec 11, 4:20 pm, Brett Wilton bdwil...@gmail.com wrote:
 In your view you can use something like :-

 if ($session-check('Auth.User.id')) {
   echo $session-read('Auth.User.username');

 }

 
 Brett Wiltonhttp://wiltonsoftware.com

 On Fri, Dec 12, 2008 at 8:10 AM, bioselem...@gmail.com

 bioselem...@gmail.com wrote:

  I've been wacking my head on the wall for the past few days on this.
  I've got a basic auth login/logout system set up but for some reason
  nothing i try gets me the username. I just want to display it as in
  Your logged in as xyz. I know it's probably something stupid and I'm
  no doubt going about it the wrong way. Any help?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Finding Auth'd users Username

2008-12-11 Thread bioselem...@gmail.com

Amazing. Thanks for your help, both of you. I think I'm good now. ^_^
*goes off to write a snippit on it*. Thanks alot. :)

On Dec 11, 4:20 pm, Brett Wilton bdwil...@gmail.com wrote:
 In your view you can use something like :-

 if ($session-check('Auth.User.id')) {
   echo $session-read('Auth.User.username');

 }

 
 Brett Wiltonhttp://wiltonsoftware.com

 On Fri, Dec 12, 2008 at 8:10 AM, bioselem...@gmail.com

 bioselem...@gmail.com wrote:

  I've been wacking my head on the wall for the past few days on this.
  I've got a basic auth login/logout system set up but for some reason
  nothing i try gets me the username. I just want to display it as in
  Your logged in as xyz. I know it's probably something stupid and I'm
  no doubt going about it the wrong way. Any help?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $form-input() helper question

2008-12-11 Thread teknoid

You can pass a CSS class specifically to your label element.

i.e. $form-input('MyModel.my_field', array('label'=array
('text'='Please enter something here', 'class'='class-for-this-
label')));


On Dec 10, 6:43 pm, maytawn mayt...@gmail.com wrote:
 I have an instance where I need to increase the width and style of the
 label tag that is automatically created with the $form-input()
 method.  Since I already have a base CSS defined for all lable tags
 I would like to add some inline CSS using the style= attribute.  I
 am able to add the style= attribute to the input tage using the
 'options' key 'style' as shown below.
 echo $form-input('password', array('label' = 'New Password:', 'type'
 = 'password', 'style' = 'width:150px', 'after' = 'br /'));

 Is there a way to pass in a parameter that would allow me to do the
 same for the lable tag?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using the PagesController

2008-12-11 Thread Rob Wilkerson

On Thu, Dec 11, 2008 at 12:18 PM, Sam Sherlock sam.sherl...@gmail.com wrote:
 I would say that element would be best but because you need to model-find
 you need to use something like requestAction
 or
 http://mark-story.com/posts/view/reducing-requestaction-use-in-your-cakephp-sites-with-fat-models

 as your doing a little and only want template echo'd in view and calls to
 helpers and elements

Haven't I been reading that requestAction() is generally considered a
bad thing these days? I think I read the word harmful somewhere.
Maybe on the Debuggable blog? Is that the case or is this the proper
use of that technique?

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



Re: Using the PagesController

2008-12-11 Thread brian

On Thu, Dec 11, 2008 at 6:26 PM, Rob Wilkerson r...@robwilkerson.org wrote:

 On Thu, Dec 11, 2008 at 12:18 PM, Sam Sherlock sam.sherl...@gmail.com wrote:
 I would say that element would be best but because you need to model-find
 you need to use something like requestAction
 or
 http://mark-story.com/posts/view/reducing-requestaction-use-in-your-cakephp-sites-with-fat-models

 as your doing a little and only want template echo'd in view and calls to
 helpers and elements

 Haven't I been reading that requestAction() is generally considered a
 bad thing these days? I think I read the word harmful somewhere.
 Maybe on the Debuggable blog? Is that the case or is this the proper
 use of that technique?

The link points to some advice for *reducing* the use of
requestAction(). In any case, I think it's really a relative thing.
One has to weigh the advantages and disadvantages for using it in each
situation. I certainly wouldn't use it in several elements on a page
but I might for just one. Especially as the output can be cached.

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



Re: Using the PagesController

2008-12-11 Thread Rob Wilkerson

On Thu, Dec 11, 2008 at 6:35 PM, brian bally.z...@gmail.com wrote:

 The link points to some advice for *reducing* the use of
 requestAction(). In any case, I think it's really a relative thing.
 One has to weigh the advantages and disadvantages for using it in each
 situation. I certainly wouldn't use it in several elements on a page
 but I might for just one. Especially as the output can be cached.

Yeah, sorry. I read the article, but was following up on a related
thought because the article, if I read it correctly, assumes the
presence of a controller to do this:

$comments = $this-Post-Comment-recent();

In my case, the PagesController is being used and it seems like I
should avoid modifying that particular controller (though I have no
real basis for thinking that). Regardless, I'd rather not drop the
code in the controller to be executed for _all_ pages I may use since
this is only needed for one particular controller.

Thoughts?

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



Re: Why is this query returning such an odd array?

2008-12-11 Thread the_woodsman

I think this is because it's nigh on impossible to determine the table
that a function, like COUNT or SUM etc, is getting its data from.

For more information and some work-arounds, see:

  
http://groups.google.com/group/cake-php/browse_thread/thread/2fa2cd69422dfcf/81e7a5ea50266a15

On Dec 11, 4:50 pm, matth matt...@gmail.com wrote:
 The keywords query in the view() function is returning the following
 array:
 Array ( [Hit] = Array ( [keyword] = banana ) [0] = Array ( [count]
 = 1 ) )

 I am going for: Array ( [Hit] = Array ( [keyword] = banana, [count]
 = 1 ) )

 class ItemsController extends AppController
 {
         var $name = 'Items';
         var $uses = array('Item', 'Hit');
         function index()
         {
                 $this-pageTitle = 'Items';
                 #FIND UNIQUE!
                 #$this-set('items', $this-Item-findAll());
                 $this-set('items', $this-Item-query(SELECT * FROM 
 items));
         }

         function view($item_id = null)
         {
                 $this-pageTitle = 'Item #'. $item_id;

                 $this-Item-id = $item_id;
                 $this-set('item', $this-Item-read());

                 $this-set('keywords', $this-Hit-find('all', array
 ('conditions'='item_id='.$item_id.' AND keyword !=',
 'fields'=array('DISTINCT keyword','COUNT(*) AS count'), 'group'=array
 ('keyword'), 'order'='count DESC')));
         }

 }

 Table Structure:
 hits
 
 hit_id
 ipa
 referer
 domain
 date
 item_id
 keyword

 items
 -
 item_id
 title

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



Re: Using the PagesController

2008-12-11 Thread Sam Sherlock
modifying files in your app directory is ok - is more code to supervise its
how I would go about your objective (from what I understand of it) - mark's
approach involves editing more files to set up - but works a treat.

requestAction can be ok - but can be problematic also can really slow down
your app

KISS - keep everything simple as possible though


2008/12/11 Rob Wilkerson r...@robwilkerson.org


 On Thu, Dec 11, 2008 at 6:35 PM, brian bally.z...@gmail.com wrote:
 
  The link points to some advice for *reducing* the use of
  requestAction(). In any case, I think it's really a relative thing.
  One has to weigh the advantages and disadvantages for using it in each
  situation. I certainly wouldn't use it in several elements on a page
  but I might for just one. Especially as the output can be cached.

 Yeah, sorry. I read the article, but was following up on a related
 thought because the article, if I read it correctly, assumes the
 presence of a controller to do this:

 $comments = $this-Post-Comment-recent();

 In my case, the PagesController is being used and it seems like I
 should avoid modifying that particular controller (though I have no
 real basis for thinking that). Regardless, I'd rather not drop the
 code in the controller to be executed for _all_ pages I may use since
 this is only needed for one particular controller.

 Thoughts?

 


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



Notice (8): unserialize() [function.unserialize]: Error at offset

2008-12-11 Thread João Aguiam
Hello,
I'm developing two sites in cake php at the same time. In each site (both
are on the same machine) the following error is occurring:

*Notice* (8) javascript:void(0);: unserialize()
[function.unserialize http://php.net/function.unserialize]: Error at
offset 6 of 730 bytes [*CORE\cake\libs\cache\file.php*, line *182*]


It's strange because it happened at the same time in each site. I've been
searching and it seams to be a problem with the cache but I've already
cleaned the cached dir but the same happens.

Anyone has a suggestion?

Thank you,
João

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



set::combine // form-helper select question

2008-12-11 Thread Gaston

I want to combine two lists of news in an select-field. Something
like:
select name='mylist'
 option value='123' class='new'latest news/option
 option value='234' class='new'latest news2/option
 option value='567' class='old'older news/option
 option value='789' class='old'older news2/option
/select

The both different lists I will get width find()-questions with
different conditions.
To make the select field in the written form, I need an array like
$mylist = array (
   0 = array('value'=123, 'name'='latest news',
'class'='new'),
   1 = array('value'=234, 'name'='latest news2',
'class'='new'),
   2 = array('value'=567, 'name'='older news',
'class'='old'),
   3 = array('value'=789, 'name'='older news2',
'class'='old')
);

Here my questions:
can I construct an array like abough with Set::combine?
(If I use find('list') orfind('all') and set::combine() I get an
array like $mylist = array('123'='latest news');
Any ideas?

Thanks for Your help!


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



Re: Cake Developers in Chennai, TamilNadu, India?

2008-12-11 Thread ravindranathbe

Hi
I am Ravindranath. Experienced in CakePHP for the past 10 months.
Able to create highly professional, high quality website on Cakephp.
You can contact me thro,
1. email - ravindranat...@gmail.com
2. mobile - 9380567762

Regards,

Ravindranath.

On Nov 5, 11:04 am, Selva revol...@gmail.com wrote:
 Hello Guys,

 I apologize in advance if this is not the appropriate forum to ask
 this question, but I am interested in finding a Cake Developer to work
 on a new project.

 Thanks,
 Selva

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



Re: Using the PagesController

2008-12-11 Thread Brett Wilton

If your model data isn't changing much using an cached element should
be quick.  You can set the cache to renew each hours, days, weeks, or
longer.  You could also clear the element cache when you save the
model.

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



Re: My blog tutorial is working for other but not working on my server ...

2008-12-11 Thread xfhxfh

Hi Marcelo,
thx for reply. Hum ... have no access to httpd.conf because not a
dedicated server. The mod_rewrite and AllowOverride should be cool in
the .htaccess for now ... or no ?

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



Re: My blog tutorial is working for other but not working on my server ...

2008-12-11 Thread Marcelo Andrade
On Thu, Dec 11, 2008 at 10:08 PM, xfhxfh fh...@onefh.com wrote:

 Hi Marcelo,
 thx for reply. Hum ... have no access to httpd.conf because not a
 dedicated server. The mod_rewrite and AllowOverride should be cool in
 the .htaccess for now ... or no ?

Not sure.  But I think in the httpd.conf you
should say what kind of configurations can be
accepted in .htaccess.  The AllowOverride must
be set to all so all the options can be
controlled inside your .htaccess.

Best regards.

--
MARCELO DE F. ANDRADE (aka eleKtron)
Belem, PA, Amazonia, Brazil
Linux User #221105

[...@pará ~]# links http://pa.slackwarebrasil.org/

For Libby's backstory be told on Lost
http://www.petitiononline.com/libby423/petition.html

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



Re: Tip: ignoring tmp dirs in Subversion

2008-12-11 Thread brian

On Thu, Dec 11, 2008 at 2:24 PM, Ed Howland ed.howl...@gmail.com wrote:

 On Thu, Dec 11, 2008 at 12:16 PM, Marcus rik...@gmail.com wrote:

 On Dec 11, 6:40 pm, Ed Howland ed.howl...@gmail.com wrote:
 This always confused me.

 cd app
 svn up
 find tmp -type d | grep -v svn| xargs -L1 svn propset svn:ignore '*'
 svn commit -m ignoring app/tmp in subversion

 This isn't a good solution: If you check out your project on another
 machine, the whole 'tmp' directory and its structure is missing.

 It worked for me I did two commit+checkout round trips, and the tmp
 structure was maintained. I did have to svn rm the old cache files,
 but now svn st reports no changes. I think that works because the
 pattern supplied was '*' and svn propset does not apply that to
 directories.

 Let me know if you have a different experience.


As Marcus said, it'll be a different experience if the repository is
checked out on a *different machine*.

Subversion has the capability to handle things like this, though one
needs to set things up for it. Here's  a Cake-specific solution posted
by Andy:

http://bakery.cakephp.org/articles/view/setting-svn-ignore-properties

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



Re: can't connect to oracle

2008-12-11 Thread baranangsi...@gmail.com

at first page :

=
 Your database configuration file is present.
Cake is NOT able to connect to the database.


i've ever developed application with cake rc2 and  oracle. Select,
insert, update, delete is work normally. Now, I want to try  cake rc3.
But, at first page, i see this connection error.


On Dec 11, 9:46 am, Rob webwe...@gmail.com wrote:
 What error are you seeing ?

 On Dec 11, 4:23 am, baranangsi...@gmail.com

 baranangsi...@gmail.com wrote:
  i try oracle driver in cake rc3..., but don't success. here is
  database.php :

  var $default = array(
                  'driver' = 'oracle',
                  'persistent' = false,
                  'host' = 'localhost',
                  'login' = 'hr',
                  'password' = 'hr',
                  'database' = 'XE',
                  'prefix' = '',
          );

  but, in RC2 and RC1, there's no problem...

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



Re: Tip: ignoring tmp dirs in Subversion

2008-12-11 Thread Ed Howland

On Thu, Dec 11, 2008 at 8:35 PM, brian bally.z...@gmail.com wrote:

 On Thu, Dec 11, 2008 at 2:24 PM, Ed Howland ed.howl...@gmail.com wrote:

 Let me know if you have a different experience.


 As Marcus said, it'll be a different experience if the repository is
 checked out on a *different machine*.

 Subversion has the capability to handle things like this, though one
 needs to set things up for it. Here's  a Cake-specific solution posted
 by Andy:

 http://bakery.cakephp.org/articles/view/setting-svn-ignore-properties


Brian, thanks for the link. It's a good idea for the core.php and
database.php files as well. BTW, I did test my command and checked it
out on another machine and it still worked. Perhaps there is a
difference wrt versions of svn?

What I didn't know about was the -R (recursive) flag for svn propset.
I wanted to make sure that the '.svn' dirs were preserved and thus
excluded. But propset must do that already.

Ed
.


 




-- 
Ed Howland
http://greenprogrammer.blogspot.com
http://twitter.com/ed_howland

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



Re: Getting simpletest to work with test DB

2008-12-11 Thread Ed Howland

On Thu, Dec 11, 2008 at 3:55 PM, mark_story mark.st...@gmail.com wrote:

 Should be fixed now! :)


On r7916:

Ok, I am getting a lot farther now. Before, no model tests were
passing. Now only two don't pass. Those two models belong_to other
models. E.g. User = Group. The error reports  that the group table is
missing, in that case.

Thanks for fixing the rest of them though.

Ed

-- 
Ed Howland
http://greenprogrammer.blogspot.com
http://twitter.com/ed_howland

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



Re: Tip: ignoring tmp dirs in Subversion

2008-12-11 Thread brian

The contents of the .svn dirs  are modified by Subversion, so it
wouldn't make sense to try to get it to ignore them. They're full of
meta-info. .svn/text-base/ contains a clean copy of everything, for
instance, and it's these files that are compared to your working copy
in order to discern what's been changed.

One can checkout an entire site without them (say, for uploading to
production or tarring up an archive) by doing svn export ... Note
that you'll want to export to somewhere other than your working
directory.

You can also copy a subversion working dir without the .svn dirs by
using rsync -C ...

On Thu, Dec 11, 2008 at 10:26 PM, Ed Howland ed.howl...@gmail.com wrote:

 On Thu, Dec 11, 2008 at 8:35 PM, brian bally.z...@gmail.com wrote:

 On Thu, Dec 11, 2008 at 2:24 PM, Ed Howland ed.howl...@gmail.com wrote:

 Let me know if you have a different experience.


 As Marcus said, it'll be a different experience if the repository is
 checked out on a *different machine*.

 Subversion has the capability to handle things like this, though one
 needs to set things up for it. Here's  a Cake-specific solution posted
 by Andy:

 http://bakery.cakephp.org/articles/view/setting-svn-ignore-properties


 Brian, thanks for the link. It's a good idea for the core.php and
 database.php files as well. BTW, I did test my command and checked it
 out on another machine and it still worked. Perhaps there is a
 difference wrt versions of svn?

 What I didn't know about was the -R (recursive) flag for svn propset.
 I wanted to make sure that the '.svn' dirs were preserved and thus
 excluded. But propset must do that already.

 Ed
 .


 




 --
 Ed Howland
 http://greenprogrammer.blogspot.com
 http://twitter.com/ed_howland

 


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



Re: Tip: ignoring tmp dirs in Subversion

2008-12-11 Thread brian

BTW, why would you not want to version-control core.php or database.php?

On Thu, Dec 11, 2008 at 11:25 PM, brian bally.z...@gmail.com wrote:
 The contents of the .svn dirs  are modified by Subversion, so it
 wouldn't make sense to try to get it to ignore them. They're full of
 meta-info. .svn/text-base/ contains a clean copy of everything, for
 instance, and it's these files that are compared to your working copy
 in order to discern what's been changed.

 One can checkout an entire site without them (say, for uploading to
 production or tarring up an archive) by doing svn export ... Note
 that you'll want to export to somewhere other than your working
 directory.

 You can also copy a subversion working dir without the .svn dirs by
 using rsync -C ...

 On Thu, Dec 11, 2008 at 10:26 PM, Ed Howland ed.howl...@gmail.com wrote:

 On Thu, Dec 11, 2008 at 8:35 PM, brian bally.z...@gmail.com wrote:

 On Thu, Dec 11, 2008 at 2:24 PM, Ed Howland ed.howl...@gmail.com wrote:

 Let me know if you have a different experience.


 As Marcus said, it'll be a different experience if the repository is
 checked out on a *different machine*.

 Subversion has the capability to handle things like this, though one
 needs to set things up for it. Here's  a Cake-specific solution posted
 by Andy:

 http://bakery.cakephp.org/articles/view/setting-svn-ignore-properties


 Brian, thanks for the link. It's a good idea for the core.php and
 database.php files as well. BTW, I did test my command and checked it
 out on another machine and it still worked. Perhaps there is a
 difference wrt versions of svn?

 What I didn't know about was the -R (recursive) flag for svn propset.
 I wanted to make sure that the '.svn' dirs were preserved and thus
 excluded. But propset must do that already.

 Ed
 .


 




 --
 Ed Howland
 http://greenprogrammer.blogspot.com
 http://twitter.com/ed_howland

 



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



Re: Tip: ignoring tmp dirs in Subversion

2008-12-11 Thread Ed Howland

On Thu, Dec 11, 2008 at 10:25 PM, brian bally.z...@gmail.com wrote:

 The contents of the .svn dirs  are modified by Subversion, so it
 wouldn't make sense to try to get it to ignore them. They're full of
 meta-info. .svn/text-base/ contains a clean copy of everything, for
 instance, and it's these files that are compared to your working copy
 in order to discern what's been changed.

 One can checkout an entire site without them (say, for uploading to
 production or tarring up an archive) by doing svn export ... Note
 that you'll want to export to somewhere other than your working
 directory.

 You can also copy a subversion working dir without the .svn dirs by
 using rsync -C ...

That last one is good for me too. I just checked out a latest HEAD and
wanted to overlay a working directory to check a bug fix in unit
tests. I did it by hand for each dir. That could have saved me some
time! (Hey universe, can I have those last 30 minutes back?)

Thanks for the tip.

Ed

-- 
Ed Howland
http://greenprogrammer.blogspot.com
http://twitter.com/ed_howland

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



Re: Tip: ignoring tmp dirs in Subversion

2008-12-11 Thread Ed Howland

On Thu, Dec 11, 2008 at 10:26 PM, brian bally.z...@gmail.com wrote:

 BTW, why would you not want to version-control core.php or database.php?

Well the site with the tip lays it out, but in my case, I am
developing on my laptop and we also have a server for all the devs to
work on. The DB's configs are quite different. Also, we keep core.php
(DEBUG=0) to be as close as possible to the final production env.

Ed
-- 
Ed Howland
http://greenprogrammer.blogspot.com
http://twitter.com/ed_howland

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



Re: My blog tutorial is working for other but not working on my server ...

2008-12-11 Thread xfhxfh

yea that's what cakephp cookbook says too at
http://book.cakephp.org/view/37/Apache-and-mod_rewrite only I think I
dont' have the access to the systems httpd.conf because I'm using a
virtual server

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



Re: Tip: ignoring tmp dirs in Subversion

2008-12-11 Thread brian

On Thu, Dec 11, 2008 at 11:33 PM, Ed Howland ed.howl...@gmail.com wrote:

 On Thu, Dec 11, 2008 at 10:26 PM, brian bally.z...@gmail.com wrote:

 BTW, why would you not want to version-control core.php or database.php?

 Well the site with the tip lays it out, but in my case, I am
 developing on my laptop and we also have a server for all the devs to
 work on. The DB's configs are quite different. Also, we keep core.php
 (DEBUG=0) to be as close as possible to the final production env.

Oh, of course. That was a dumb question.

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



Re: named params and prefix routing

2008-12-11 Thread Marcelius

Thanks for the anwser but that didn't work here.

The be more clear: If I do not use named params, the the url is
correct: It has the prefix /owner
If I do use named params, the router adds owner:1 as a named param
instead of prepending the /owner prefix.

So:
Router::url(array(controller=invoices, action=edit, 5,
owner=true, key=val));

Returns and not expected:
/invoices/edit/5/owner:1/key:val
I would expect:
/owner/invoices/edit/5/key:val

On 11 dec, 16:31, Lane laneol...@gmail.com wrote:
 What were you expecting the Router to return if not /invoices/edit/5/
 owner:1/key:val?

 On Dec 11, 4:39 am, Marcelius mraaijmak...@gmail.com wrote:

  Hello!

  I have this route like the manual says for prefix routing:

  Router::connect('/owner/:controller/:action/*', array
  ('prefix'='owner', 'owner'=true));

  This works fine until I want to create a url with some named params in
  it:

  Router::url(array(controller=invoices, action=edit, 5,
  owner=true));
  returns /owner/invoices/edit/5 as expected.

  Router::url(array(controller=invoices, action=edit, 5,
  owner=true, key=val));
  returns /invoices/edit/5/owner:1/key:val not as expected.

  Something wrong in my routes? Please note that that's the only route
  available.

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



Differences between Session types?

2008-12-11 Thread AJV

The project I'm working on is expected to get a good load of visitors,
so I need to make sure I tune my cake to work as efficiently as
possible. Are there any speed/reliability issues between php (native
php sessions) and cake (filesystem) -types of sessions?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Two tables, one form.

2008-12-11 Thread Adrian Love (aijokaiz...@gmail.com)

Hey guys, been using cake for about 5 days now.

So I have two tables. users and user_infos, using advice in another
thread I have created a model for each. I have also made sure to 'var
$uses = array('UserInfo');' in my UsersController.

My app has a form in a view. I shall paste the form here.

views/users/add_user.ctp
?php
echo $form-create(null, array('url' = '/users/addUser'));
echo $form-input('info_email');
echo $form-input('password');
echo $form-input('password_confirm', array('type' = 'password',
'label' = 'Password Confirmation'));
echo $form-input('info_firstname');
echo $form-input('info_lastname');
echo $form-end('save');
?

As you can see the form's action leads to UserController::addUser();

I shall paste it here also.

/app/controllers/user_controller.php

function addUser() {
Configure::write('debug', 2);

   //debug($this-data);
//check for data

if ($this-data) {
//check for correct passworsd
if ($this-data['UserInfo']['password'] == $this-Auth-
password($this-data['UserInfo']['password_confirm'])) {

$this-User-create();
$this-UserInfo-addUserInfo($this-data);
//if saving to database is successful, move the users 
to the
login screen.
if($this-UserInfo-save($this-data)){
$this-flash('Your User has been 
Created.', 'login');
}
}
}
}

As you can see I have attempted to go off to
UserInfosController::addUserInfo($this-data) which is simply

function addUserInfos($data){
$this-UserInfos-save($this-data);
}

I will also be as kind as to add the debug($this-data)

Array
(
[UserInfo] = Array
(
[info_email] = user1234
[password] = pass1234
[password_confirm] = pass1234
[info_firstname] = Adrian
[info_lastname] = Love
[info_phone] = 07
[info_mobile] = 04
[info_address] = candy mountain
[info_postcode] = 
[info_state] = QLD
[info_dob] = Array
(
[month] = 12
[day] = 21
[year] = 1986
)

)
)

Now, Dispite me having Configure::debug set to 2. there isn't much
output on what is happening, I click save on my form and it stays at
the form without going anywhere, the tables remain empty. as you can
see I've tried looking around for ideas on this situation but have
become alittle stuck.

Thanks for your time,  I hope my issue was well explained.


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



extra record in looped insert?

2008-12-11 Thread DRE
Hi, I'm trying to do this looped insert update.  It mostly works except that
I keep getting an extra record - the last in the rss list.  I'm thinking its
because of my hasmany and belongs to declarations but its beyond me (at
least for tonight!).  Any expert tips?

 Heres my controller function.

function admin_load($id) {
//get the feed url to read
$this-Feed-read(null, $id);
$feed_url = $this-Feed-data[Feed][feedurl];

App::import('Vendor', 'testing',
array('file'='magpie/rss_fetch.inc'));

//get the feed and save the feed to the Feed model
$f = fetch_rss($feed_url);

$this-Feed-data[Feed]['title'] = $f-channel['title'];
$this-Feed-data[Feed]['description'] =
$f-channel['description'];
$this-Feed-save();

//then loop thru each found feed. If findByLink finds something,
update it, otherwise insert.
foreach ($f-items as $item ) {
if (! $this-Feed-FeedItem-findByLink($item[link])){
$this-Feed-FeedItem-id = false;
}
if ($item[link] == ) die('found');
$this-Feed-FeedItem-data[FeedItem][link] = $item[link];
$this-Feed-FeedItem-data[FeedItem][title] =
$item[title];
$this-Feed-FeedItem-data[FeedItem][description] =
$item[description];
$this-Feed-FeedItem-data[FeedItem][feed_id] =
$this-Feed-id;
$this-Feed-FeedItem-save();
}
}

My Feed model
?php
class Feed extends AppModel {

var $name = 'Feed';
//The Associations below have been created with all possible keys, those
that are not needed can be removed
var $hasMany = array(
'FeedItem' = array('className' = 'FeedItem',
'foreignKey' = 'feed_id',
'dependent' = false,
'conditions' = '',
'fields' = '',
'order' = '',
'limit' = '',
'offset' = '',
'exclusive' = '',
'finderQuery' = '',
'counterQuery' = ''
)
);
}
?

My FeedItem model
?php
class FeedItem extends AppModel {

var $name = 'FeedItem';

//The Associations below have been created with all possible keys, those
that are not needed can be removed
var $belongsTo = array(
'Feed' = array('className' = 'Feed',
'foreignKey' = 'feed_id',
'conditions' = '',
'fields' = '',
'order' = ''
)
);

}
?
-- 
DRE
http://www.increasetheknowledge.com
http://www.theanticool.com

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



Zero values being submitted as NULL into DB.

2008-12-11 Thread andruu

Hello, I have a simple form to edit my category model. My category
model is using the Tree behavior. When trying to edit/update my
model's parent_id if the value is 0 it is being submitted as NULL into
the database. The database type is integer.

I am looking for a solution to preserve the initial value of 0 (zero).

If I do a pr($this-data) it shows the correct values but when I look
in the SQL log I can see that NULL is being submitted.

 Array
(
[Category] = Array
(
[parent_id] = 0
[name] = Apparel
[description] =
)

)

SQL LOG
UPDATE `categories` SET `parent_id` = NULL, `name` = 'Apparel',
`description` = '', `modified` = '2008-12-12 14:27:13' WHERE
`categories`.`id` = 7

Also it works fine if the value is not 0.

Thanks in advance for any help.

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



Media Temple server seems to be closing mysql connections after every query

2008-12-11 Thread Lucho Molina

Hello.

I'm having problems running an application in Media Temple: the
LAST_INSERT_ID() command always returns 0 from autoincremented id
tables, to both our application and to the phpMyAdmin console. Above,
you'll find a sample of what I've been trying to do unsuccesfully:

INSERT INTO `contacts`
(`contact_type_id`,`first_name`,`last_name`,`email`,`phone`,`website`,`message`,`created`)
VALUES (2,'Test','Test','t...@test.com','','','Lorem ipsum dolor sit
amet, consectetur adipiscing elit. ','2008-12-09 19:54:38')

= OK, 1 row inserted, checked in the table ande there is the new
value with an autogenerated id.

SELECT LAST_INSERT_ID() AS insertID

= 0 --- Wrong!

I wrote them to see if they had an idea of what was going on, and they
replied saying that I must be using separated connections and that I
should try running the queries together separated by semicolon, which,
of course, worked in phpMyAdmin, but, in cakePHP it doesn't make
sense.

I have a version of my CakePHP application running locally with MySQL
5.0 (Media Temple has 4.1, although that shouldn't matter, supposedly)
and it works fine. It seems then that, somehow, the DB is closing the
connection with the application after every single query in the same
request, which is just weird.

BTW, I'm using persistent connections and the mysql block in my php
config is just like theirs (I checked it via phpinfo()), except for
the version, but, again, it shouldn't matter.

Any ideas?

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



Re: set::combine // form-helper select question

2008-12-11 Thread andruu

I am doing something similar right now using find('list') and then
using Set::insert() and then setting the 'options' option in the input-
field to the variable assigned to the Set::insert().

On Dec 12, 6:08 am, Gaston i...@neeneenee.de wrote:
 I want to combine two lists of news in an select-field. Something
 like:
 select name='mylist'
  option value='123' class='new'latest news/option
  option value='234' class='new'latest news2/option
  option value='567' class='old'older news/option
  option value='789' class='old'older news2/option
 /select

 The both different lists I will get width find()-questions with
 different conditions.
 To make the select field in the written form, I need an array like
 $mylist = array (
                    0 = array('value'=123, 'name'='latest news',
 'class'='new'),
                    1 = array('value'=234, 'name'='latest news2',
 'class'='new'),
                    2 = array('value'=567, 'name'='older news',
 'class'='old'),
                    3 = array('value'=789, 'name'='older news2',
 'class'='old')
 );

 Here my questions:
 can I construct an array like abough with Set::combine?
 (If I use find('list') or    find('all') and set::combine() I get an
 array like $mylist = array('123'='latest news');
 Any ideas?

 Thanks for Your help!

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



Two tables, one form.

2008-12-11 Thread Adrian Love (aijokaiz...@gmail.com)

Hey guys, been using cake for about 5 days now.

So I have two tables. users and user_infos, using advice in another
thread I have created a model for each. I have also made sure to 'var
$uses = array('UserInfo');' in my UsersController.

My app has a form in a view. I shall paste the form here.

views/users/add_user.ctp
?php
echo $form-create(null, array('url' = '/users/addUser'));
echo $form-input('info_email');
echo $form-input('password');
echo $form-input('password_confirm', array('type' = 'password',
'label' = 'Password Confirmation'));
echo $form-input('info_firstname');
echo $form-input('info_lastname');
echo $form-end('save');
?

As you can see the form's action leads to UserController::addUser();

I shall paste it here also.

/app/controllers/user_controller.php

function addUser() {
Configure::write('debug', 2);

   //debug($this-data);
//check for data

if ($this-data) {
//check for correct passworsd
if ($this-data['UserInfo']['password'] == $this-Auth-
password($this-data['UserInfo']['password_confirm'])) {

$this-User-create();
$this-UserInfo-addUserInfo($this-data);
//if saving to database is successful, move the users 
to the
login screen.
if($this-UserInfo-save($this-data)){
$this-flash('Your User has been 
Created.', 'login');
}
}
}
}

As you can see I have attempted to go off to
UserInfosController::addUserInfo($this-data) which is simply

function addUserInfos($data){
$this-UserInfos-save($this-data);
}

I will also be as kind as to add the debug($this-data)

Array
(
[UserInfo] = Array
(
[info_email] = user1234
[password] = pass1234
[password_confirm] = pass1234
[info_firstname] = Adrian
[info_lastname] = Love
[info_phone] = 07
[info_mobile] = 04
[info_address] = candy mountain
[info_postcode] = 
[info_state] = QLD
[info_dob] = Array
(
[month] = 12
[day] = 21
[year] = 1986
)

)
)

Now, Dispite me having Configure::debug set to 2. there isn't much
output on what is happening, I click save on my form and it stays at
the form without going anywhere, the tables remain empty. as you can
see I've tried looking around for ideas on this situation but have
become alittle stuck.

Thanks for your time,  I hope my issue was well explained.


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