cakephp shell passing parameters

2009-09-03 Thread JamesF

Can i pass parameters to a script I execute via Cake Console?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



cakephp shell passing parameters

2009-09-03 Thread JamesF

Can i pass parameters to a script I execute via Cake Console?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



can a custom validation function return an error message or just true/false?

2009-08-26 Thread JamesF

var $validate = array(
'username' => array(
'customFunction' => array('rule'=> 
'customFunction',
'message'=>'user name error', ),
),
);

function customFunction($data) {

   if($data['username'] == $someConditions) {
return true;
   }
  else if ($data['username'] == $someOtherConditions) {

 return false;
  }
  //otherwise failed
   return false;
}

instead of return false can i return the specific reason why it failed
in the form of an error message?

--~--~-~--~~~---~--~~
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: InnoDB vs. MyISAM, does CakePHP care?

2009-08-14 Thread JamesF

well i have about 9000 customers using it right now so i think im
going to just duplicate my database and app, making some tests along
the way.

On Aug 14, 5:18 pm, anders als  wrote:
> If you aren't in "production" mode and do not have any customer who
> waits for its website, just try it ;)
>
> On 14 Aug., 23:09, JamesF  wrote:
>
> > no i just want to alter my current mysql database to use innodb
> > without affecting the model relationships. it is a trivial thing to
> > change the storage engine but I am not sure of the results.
>
> > On Aug 14, 5:07 pm, anders als  wrote:
>
> > > So, you want Cake to use MyISAM "syntax" for an InnoDB driven sql
> > > server?
> > > I think this is possible doing some configurations inside of the
> > > database related core files
>
> > > On 14 Aug., 22:26, JamesF  wrote:
>
> > > > Whnn I first set up the current app I am using, I chose InnoDB tables
> > > > for almost any Model that i thought would be related. My thinking was
> > > > that Cake wouldn't understand the foreign key relationships and it
> > > > would lead to database integrity problems.
>
> > > > I am assuming that Cake doesn't care which storage engine I use in the
> > > > case of simple model relationships. I am not using transactions or row
> > > > level locking currently, and more often then not, the CASCADE effect
> > > > of InnoDB tables has made some of my data go bye-bye.
>
> > > > I appreciate that InnoDB prevents me from inserting data with
> > > > incorrect id's and fk id's but it also deletes child data when i don't
> > > > want it to (unless i use RESTRICT or SET NULL on that fk).
>
> > > > So the crux of my question is this, can I maintain my current app
> > > > functionality while converting back to MyISAM tables, considering I do
> > > > not use any advanced InnoDB features? Will Cake still handle my table
> > > > relationships correctly when I am following proper naming conventions
> > > > for foreign keys and table names?
--~--~-~--~~~---~--~~
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: InnoDB vs. MyISAM, does CakePHP care?

2009-08-14 Thread JamesF

no i just want to alter my current mysql database to use innodb
without affecting the model relationships. it is a trivial thing to
change the storage engine but I am not sure of the results.

On Aug 14, 5:07 pm, anders als  wrote:
> So, you want Cake to use MyISAM "syntax" for an InnoDB driven sql
> server?
> I think this is possible doing some configurations inside of the
> database related core files
>
> On 14 Aug., 22:26, JamesF  wrote:
>
> > Whnn I first set up the current app I am using, I chose InnoDB tables
> > for almost any Model that i thought would be related. My thinking was
> > that Cake wouldn't understand the foreign key relationships and it
> > would lead to database integrity problems.
>
> > I am assuming that Cake doesn't care which storage engine I use in the
> > case of simple model relationships. I am not using transactions or row
> > level locking currently, and more often then not, the CASCADE effect
> > of InnoDB tables has made some of my data go bye-bye.
>
> > I appreciate that InnoDB prevents me from inserting data with
> > incorrect id's and fk id's but it also deletes child data when i don't
> > want it to (unless i use RESTRICT or SET NULL on that fk).
>
> > So the crux of my question is this, can I maintain my current app
> > functionality while converting back to MyISAM tables, considering I do
> > not use any advanced InnoDB features? Will Cake still handle my table
> > relationships correctly when I am following proper naming conventions
> > for foreign keys and table names?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Is it possible to put the vendors folder outside of cake?

2009-08-14 Thread JamesF

I would like to make my vendors folder accessible outside of the cake
core vendors folder and the app/vendors folder. Anyone have any tips
for doing this?

Reason I am doing this is to not break vendor dependant methods when I
upgrade versions. Otherwise I have to manually copy over the contents
of the curent vendors dir.
--~--~-~--~~~---~--~~
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: Is this debug?

2009-08-14 Thread JamesF

you are correct. your debug needs to be set to 0 or 1 i believe.

On Aug 14, 4:46 pm, anders als  wrote:
> Hi there,
>
> first, i love CakePHP, but i got a little problem with my 1.3 Cake
> it is no real problem because i think i just have to turn OFF the
> "debug" mode, but the following footer (code) was never written into
> the view and the header (code) (which isn't posted here) was also not
> written into the view, does Cake add some Links of itselfs
> automatically?
>
>  id="cakeSqlLog_12502824964a85cc00132a85_34572335" summary="Cake SQL
> Log" cellspacing="0" border = "0">
> (default) 2 queries took 2 ms
> 
>
> NrQueryErrorAffectedNum.
> rowsTook (ms)
> 
> 
> 1DESCRIBE `posts`55 "text-align: right">1
> 2SELECT `Post`.`id`, `Post`.`title`, `Post`.`body`,
> `Post`.`created`, `Post`.`modified` FROM `posts` AS `Post`   WHERE 1 =
> 1   3 "text-align: right">31
>
> 
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



can I redefine vendors path for use in multiple apps / cake versions?

2009-08-14 Thread JamesF

i would like to move my vendors folder outside of the main cake folder
to share amongst mutiple cake versions and shared apps. reason being
everytime i upgrade my cake core my vendor dependent methods break.


i assume putting this code in my index.php would do the trick:

 if (!defined('VENDORS')) {
 define ('VENDORS', DS . 'home' . DS. 'mypath' . DS . 'vendors');
 }

question is can i put this into another file in my app like
bootstrap.php and still make it work?
--~--~-~--~~~---~--~~
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 article publishing delay

2009-08-14 Thread JamesF

thanks I didn't know that they did that much editing/testing.

On Aug 14, 3:31 pm, Miles J  wrote:
> Well how many of those articles/code submissions do you think they
> have to go through? They must proofread them all and test any code
> that is given, and they will comment on it if it needs improvement.
> Some of mine took weeks till it was reviewed, so just be patient and
> they will get to 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
-~--~~~~--~~--~--~---



InnoDB vs. MyISAM, does CakePHP care?

2009-08-14 Thread JamesF

Whnn I first set up the current app I am using, I chose InnoDB tables
for almost any Model that i thought would be related. My thinking was
that Cake wouldn't understand the foreign key relationships and it
would lead to database integrity problems.

I am assuming that Cake doesn't care which storage engine I use in the
case of simple model relationships. I am not using transactions or row
level locking currently, and more often then not, the CASCADE effect
of InnoDB tables has made some of my data go bye-bye.

I appreciate that InnoDB prevents me from inserting data with
incorrect id's and fk id's but it also deletes child data when i don't
want it to (unless i use RESTRICT or SET NULL on that fk).

So the crux of my question is this, can I maintain my current app
functionality while converting back to MyISAM tables, considering I do
not use any advanced InnoDB features? Will Cake still handle my table
relationships correctly when I am following proper naming conventions
for foreign keys and table names?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Bakery article publishing delay

2009-08-14 Thread JamesF

i recently published an article to the bakery, but it has been a few
days now and I'm wondering if this is typical for new articles. Anyone
have any experience with this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Calling save attempts to insert instead of update

2009-08-13 Thread JamesF

to back up what robert is saying in your function definition you are
declaring $id=null. if your function is not getting an $id passed to
it
that would cause an insert not an update.

in short you should make sure you are passing an id and also put a
conditional check on $id such as:

//if we find an item with this id
//you could use read() instead of find
if($this->find('first', array('conditions'=>array('Model.id'=>$id
{
$this->Model->id = $id;

}

else {
//failed to get model id
//now this acts like an add form
//or die
}

On Aug 12, 11:37 am, Robert P  wrote:
> Model::saveField() still requires a valid primary key, which I suspect
> he is setting to NULL at the beginning of his method.
>
> On Aug 12, 9:30 pm, eusef  wrote:
>
> > If you know which field you need to update perhaps you could try
> > using :
>
> >    saveField(string $fieldName, string $fieldValue, $validate = false)
>
> > From
> >  :http://book.cakephp.org/view/75/Saving-Your-Data
>
> > GL - Phil
>
> > On Aug 11, 8:03 pm, tron  wrote:
>
> > > I have a problem with one specific controller trying to INSERT instead
> > > of UPDATE and I am getting duplicate entry errors. the "$this->data"
> > > variable contains the correct primary key of table I'm trying to
> > > update, but still tries to INSERT instead. Most notable text message
> > > is this in the debug dump: SELECT COUNT(*) AS `count` FROM `employees`
> > > AS `Employee` WHERE `Employee`.`id` IS NULL. Apparently its not
> > > getting the id at all?
>
> > > Code:
>
> > >         function        edit( $id = null )
> > >         {
> > >         pr( $id );
> > >         pr( $this->data );
> > >         $this->Employee->id = $id;
>
> > >         if( !empty( $this->data ) )
> > >         {
> > >             if( $this->Employee->save( $this->data ) )
> > >             {
> > >             }
>
> > >         } else {
> > >             $this->data = $this->Employee->read( null, $id );
> > >         }
> > >         }
>
> > > Both the pr functions display the correct data that suggests it should
> > > be doing an UPDATE instead of INSERT.
--~--~-~--~~~---~--~~
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: Calling save attempts to insert instead of update

2009-08-13 Thread JamesF

to back up what robert is saying in your function definition you are
declaring $id=null. if you function is not getting an $id passed to it
that would cause an insert not an update.

in short you should make sure you are passing an id and also out a
conditional check on $id such as:


//if we find an item with this id
//you could use read() instead of find
if($this->find('first', array('conditions'=>array('Model.id'=>$id
{
$this->Model->id = $id;
}

else {
//failed to get model id
//now this acts like an add form
//or die
}
On Aug 11, 8:03 pm, tron  wrote:
> I have a problem with one specific controller trying to INSERT instead
> of UPDATE and I am getting duplicate entry errors. the "$this->data"
> variable contains the correct primary key of table I'm trying to
> update, but still tries to INSERT instead. Most notable text message
> is this in the debug dump: SELECT COUNT(*) AS `count` FROM `employees`
> AS `Employee` WHERE `Employee`.`id` IS NULL. Apparently its not
> getting the id at all?
>
> Code:
>
>         function        edit( $id = null )
>         {
>         pr( $id );
>         pr( $this->data );
>         $this->Employee->id = $id;
>
>         if( !empty( $this->data ) )
>         {
>             if( $this->Employee->save( $this->data ) )
>             {
>             }
>
>         } else {
>             $this->data = $this->Employee->read( null, $id );
>         }
>         }
>
> Both the pr functions display the correct data that suggests it should
> be doing an UPDATE instead of INSERT.
--~--~-~--~~~---~--~~
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: HTML helper in function?

2009-08-11 Thread JamesF

if you have time would you mind posting a test case or example code? i
would love to see some more of the code in context just so I can
improve my understanding of the issue.

please let us know what works in the end for you it might help someone
in the future

On Aug 12, 1:09 am, Josh  wrote:
> It works fine outside of the function. I've run into this before;
> helper functions not working within View functions. Are you sure
> you've had that work in the past?
>
> I think the issue is that you normally (in models, controllers,
> components...) need to reference the object where the function is
> located with $this-> in order to access functions accessible to the
> whole object. However, View files don't typically have their own
> classes and objects (excluding helpers) since most of the logic is
> handled elsewhere in the app.  Therefore, you get either an unknown
> method error or non-object error.
>
> I think I will throw this all in an array -> menu helper with the Html
> helper. That way I'll be able to reference the object with the link()
> function.
>
> Thanks for your help.
>
> On Aug 11, 11:15 pm, JamesF  wrote:
>
> > hmm im not sure if this will work but you could try in your element:
>
> > App:import('Helper', Html');
>
> > $html = new html();
>
> > does html helper work in other parts of your element outside the
> > function? i usually have no problems at all using $html->link() within
> > an element function.
>
> > On Aug 11, 10:47 pm, Josh  wrote:
>
> > > The helpers are set and work fine. However, $html->link() does not
> > > work when called within a function in the view.
>
> > > As for where the logic is written: this is an element that appears in
> > > all admin tools throughout the site. requestAction() would allow me to
> > > put some of the logic in the controller, however since this is an
> > > array used only for constructing a menu, I don't really see any
> > > advantage to that.
>
> > > On Aug 11, 7:15 pm, JamesF  wrote:
>
> > > > if your controller is set up with var $helpers = array('html') ; you
> > > > should be fine..that error is just telling you that cake can't find
> > > > HtmlHelper...is there a reason you are executing that logic in your
> > > > view and not the controller?
>
> > > > On Aug 11, 7:02 pm, Josh  wrote:
>
> > > > > Hi,
>
> > > > > I have the contents of a tree menu stored in a multi-dimensional
> > > > > array. The number of dimensions is not fixed, so to turn the array
> > > > > into a menu in the View file, I have set up a recurring function. This
> > > > > works fine except that I can't call the $html->link() from the
> > > > > function.
>
> > > > > Fatal error: Call to a member function link() on a non-object in...
>
> > > > > Any ideas? Is there a way to make the link() function global as you do
> > > > > a variable? There are some obvious work-arounds such as writing the
> > > > > anchor tag without the html helper, or turning the link array into a
> > > > > simpler two dimensional array where I can then iterate the link()
> > > > > function. However, I am wonder how I might specifically address the
> > > > > question of making the html->link() function available to a function
> > > > > within a view file.
>
> > > > > I have a feeling this is either going to be a simple declaration or
> > > > > not worth the trouble. Thanks in advance.
>
> > > > > Here is my code:
>
> > > > >     //array of links
> > > > >     key: link title
> > > > >     value: link location or sub-array
> > > > >     $linkTree = array(
> > > > >         'User Management' => array(
> > > > >             'Permissions' => array(
> > > > >                 'Set Permissions' => '/tools/setPermissions',
> > > > >                 'Update ACOS' => '/tools/updateacl',
> > > > >                 'View/Edit Groups' => '/admin/groups'
> > > > >             ),
> > > > >             'User Settings' => '/tools/userSettings',
> > > > >             'Users' => array(
> > > > >                 'List' =>

Re: Search function

2009-08-11 Thread JamesF

some fancy combos 'LIKE' and 'OR' in your find conditions array should
get it done. The trick is formatting your array.

http://book.cakephp.org/view/74/Complex-Find-Conditions


On Aug 11, 8:55 pm, "Dave Maharaj :: WidePixels.com"
 wrote:
> I am building a new search function for a input single field.
>
> I have the basic set up running but as I move forward I want the user to be
> able to enter more than 1 word coma separated.
>
> How would I do this?
>
> spilt the $queryValues = $query split ','
>
> So i now have an array of values that they entered but how do I then query
> each of those values?
>
> Is there a better way to do this?
>
> thanks,
>
> Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Custom library functions

2009-08-11 Thread JamesF

@martin that's a great observation that i know will save me a few
hours in the future. thanks for sharing

On Aug 11, 11:13 am, Martin Westin  wrote:
> If you start adding more functions you may want to put them into a
> separate file.
> The top of my bootstrap.php looks like this:
>
> // This would mess things up royally--> App::import('Vendor',
> 'basics');
> require_once(APP.'vendors'.DS.'basics.php');
>
> I mention it mostly because you have to do a good old require unless
> you want Cake's internals all confused. App::import() can't be used
> because of Cake's bootstrapping order. Simply put bootstrap.php is
> loaded before the "App" is ready to run. It took me a lot of time and
> effort to track down that this was the cause for all sorts of
> strangeness.
>
> /Martin
>
> On Aug 11, 4:54 pm, Robert P  wrote:
>
> > The file /app/config/bootstrap.php is there for this exact reason.
>
> > On Aug 11, 8:56 pm, alaxos  wrote:
>
> > > Hello,
>
> > > I have tried to figure out what would be the best way to add generic
> > > functions to an app, in order to then be able to use them everywhere
> > > in a Cake application.
>
> > > I wrote some time ago (nothing to do with cake) classes with methods
> > > that I use to do different things. They are generic classes, that I
> > > use for instance to manipulate strings, or whatever.
>
> > > I could off course copy/paste them in my components or helper that
> > > need them, but I would prefer to have it written at only one place,
> > > and be able to call it from everywhere.
>
> > > I could also for instance include the files I need somewhere in the
> > > app (in 'app_controller.php' maybe).
>
> > > But I'd like to know what would be the best way to do it in order to
> > > respect the Cake guidelines ?
>
> > > Thanks !
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Encoding pluses in URL - Is my patch OK?

2009-08-11 Thread JamesF

well modifying the core in general is bad because it makes your app
harder to debug and we can't really help you when you change the core

. it's kind of like opening your ps2 and voiding the warranty, you
might be able to install the mod chip, but it's no guarantee of future
support.

On Aug 11, 8:44 pm, BeanDog  wrote:
> Due to the way Apache's mod_rewrite mismanages query string encoding,
> $_GET['url'] isn't what I'd hope it would be when there are pluses
> encoded (%2B) in the URL.
>
> It looks like replacing line 614 of dispatcher.php with the following
> works on my apache config:
>
> if(isset($_SERVER['REDIRECT_URL']))
>         $url = $_SERVER['REDIRECT_URL']; //Will have correct special-char
> encoding.
> else
>         $url = $_GET['url'];
>
> Is there some reason I'm not aware of that I should _not_ do this?
>
> Ben Dilts
--~--~-~--~~~---~--~~
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: Is there a way to select an action from a double-click?

2009-08-11 Thread JamesF

really, really trying to understand what you are attempting here.

On Aug 11, 7:47 pm, FrederickD  wrote:
> Thank you for your on-going support! There are a lot of good answers
> on this group. I've searched for this answer here and in "the book"
> but cannot find it.
>
> What is the best way to have the user select an action (RUD; read,
> update, delete) without a separate link at the end of the row, as in
> the default behavior?
>
> Is there a way to describe a 'hot spot' for one or more attributes in
> a list so that if there is a double-click an action can be executed?
>
> I'm wondering if this is the world of jQuery. I have not yet explored
> that area yet.
>
> Thanks in advance 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: Multidimensional array as named argument

2009-08-11 Thread JamesF

i would just use implode on the array to set up my seperate arguments
and turn it into a url string

On Aug 11, 10:22 am, Tushar  wrote:
> Is it possible to pass an array through named arguments and have it
> accessible via $this->passedArgs?
>
> How would you convert an array as such to a named argument
>
> Array
>         (
>             [foo] => "foo1"
>             [bar] => Array
>                 (
>                     [0] => "bar0"
>                     [1] => "bar1"
>                 )
>         )
>
> it becomes foo:foo1/bar:Array if passed to Router::url to generate the
> url
>
> Is it not possible to have arrays in named arguments? Then how can we
> handle multiple values generated by multiple selects or checkboxes?
--~--~-~--~~~---~--~~
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: HTML helper in function?

2009-08-11 Thread JamesF

hmm im not sure if this will work but you could try in your element:

App:import('Helper', Html');

$html = new html();

does html helper work in other parts of your element outside the
function? i usually have no problems at all using $html->link() within
an element function.

On Aug 11, 10:47 pm, Josh  wrote:
> The helpers are set and work fine. However, $html->link() does not
> work when called within a function in the view.
>
> As for where the logic is written: this is an element that appears in
> all admin tools throughout the site. requestAction() would allow me to
> put some of the logic in the controller, however since this is an
> array used only for constructing a menu, I don't really see any
> advantage to that.
>
> On Aug 11, 7:15 pm, JamesF  wrote:
>
> > if your controller is set up with var $helpers = array('html') ; you
> > should be fine..that error is just telling you that cake can't find
> > HtmlHelper...is there a reason you are executing that logic in your
> > view and not the controller?
>
> > On Aug 11, 7:02 pm, Josh  wrote:
>
> > > Hi,
>
> > > I have the contents of a tree menu stored in a multi-dimensional
> > > array. The number of dimensions is not fixed, so to turn the array
> > > into a menu in the View file, I have set up a recurring function. This
> > > works fine except that I can't call the $html->link() from the
> > > function.
>
> > > Fatal error: Call to a member function link() on a non-object in...
>
> > > Any ideas? Is there a way to make the link() function global as you do
> > > a variable? There are some obvious work-arounds such as writing the
> > > anchor tag without the html helper, or turning the link array into a
> > > simpler two dimensional array where I can then iterate the link()
> > > function. However, I am wonder how I might specifically address the
> > > question of making the html->link() function available to a function
> > > within a view file.
>
> > > I have a feeling this is either going to be a simple declaration or
> > > not worth the trouble. Thanks in advance.
>
> > > Here is my code:
>
> > >     //array of links
> > >     key: link title
> > >     value: link location or sub-array
> > >     $linkTree = array(
> > >         'User Management' => array(
> > >             'Permissions' => array(
> > >                 'Set Permissions' => '/tools/setPermissions',
> > >                 'Update ACOS' => '/tools/updateacl',
> > >                 'View/Edit Groups' => '/admin/groups'
> > >             ),
> > >             'User Settings' => '/tools/userSettings',
> > >             'Users' => array(
> > >                 'List' => '/admin/users',
> > >                 'Add User' => '/admin/users/add'
> > >             )
> > >         )
> > >     );
>
> > >     //output menu function
> > >     function outputMenu ($array, $level) {
> > >         global $levelMarker;
>
> > >         foreach ($array as $key => $value) {
> > >             if (is_array($value)) {
> > >                 echo $level . $key;
> > >                 echo '';
> > >                 outputMenu($value, $level . $levelMarker);
> > >             } else {
> > >                 echo $html->link("$level$key", $value);
> > >                 echo '';
> > >             }
> > >         }
> > >         echo "";
> > >     }
>
> > >     //output menu settings
> > >     $levelMarker = '-';
> > >     $level = '';
> > >     $linkTreeSimple = array();
>
> > >     //output menu
> > >     outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
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: HTML helper in function?

2009-08-11 Thread JamesF

hmm im not sure if this will work but you could try in your element:

App:import('Helper', Html');

$html = new html();

On Aug 11, 10:47 pm, Josh  wrote:
> The helpers are set and work fine. However, $html->link() does not
> work when called within a function in the view.
>
> As for where the logic is written: this is an element that appears in
> all admin tools throughout the site. requestAction() would allow me to
> put some of the logic in the controller, however since this is an
> array used only for constructing a menu, I don't really see any
> advantage to that.
>
> On Aug 11, 7:15 pm, JamesF  wrote:
>
> > if your controller is set up with var $helpers = array('html') ; you
> > should be fine..that error is just telling you that cake can't find
> > HtmlHelper...is there a reason you are executing that logic in your
> > view and not the controller?
>
> > On Aug 11, 7:02 pm, Josh  wrote:
>
> > > Hi,
>
> > > I have the contents of a tree menu stored in a multi-dimensional
> > > array. The number of dimensions is not fixed, so to turn the array
> > > into a menu in the View file, I have set up a recurring function. This
> > > works fine except that I can't call the $html->link() from the
> > > function.
>
> > > Fatal error: Call to a member function link() on a non-object in...
>
> > > Any ideas? Is there a way to make the link() function global as you do
> > > a variable? There are some obvious work-arounds such as writing the
> > > anchor tag without the html helper, or turning the link array into a
> > > simpler two dimensional array where I can then iterate the link()
> > > function. However, I am wonder how I might specifically address the
> > > question of making the html->link() function available to a function
> > > within a view file.
>
> > > I have a feeling this is either going to be a simple declaration or
> > > not worth the trouble. Thanks in advance.
>
> > > Here is my code:
>
> > >     //array of links
> > >     key: link title
> > >     value: link location or sub-array
> > >     $linkTree = array(
> > >         'User Management' => array(
> > >             'Permissions' => array(
> > >                 'Set Permissions' => '/tools/setPermissions',
> > >                 'Update ACOS' => '/tools/updateacl',
> > >                 'View/Edit Groups' => '/admin/groups'
> > >             ),
> > >             'User Settings' => '/tools/userSettings',
> > >             'Users' => array(
> > >                 'List' => '/admin/users',
> > >                 'Add User' => '/admin/users/add'
> > >             )
> > >         )
> > >     );
>
> > >     //output menu function
> > >     function outputMenu ($array, $level) {
> > >         global $levelMarker;
>
> > >         foreach ($array as $key => $value) {
> > >             if (is_array($value)) {
> > >                 echo $level . $key;
> > >                 echo '';
> > >                 outputMenu($value, $level . $levelMarker);
> > >             } else {
> > >                 echo $html->link("$level$key", $value);
> > >                 echo '';
> > >             }
> > >         }
> > >         echo "";
> > >     }
>
> > >     //output menu settings
> > >     $levelMarker = '-';
> > >     $level = '';
> > >     $linkTreeSimple = array();
>
> > >     //output menu
> > >     outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
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: server transfer problem

2009-08-11 Thread JamesF

@brian would you mind pasting your index.php

On Aug 11, 4:25 pm, brian  wrote:
> I'm having some trouble getting a site working on another server. The
> people the client hired are using cPanel, PHP is installed as CGI, and
> mod_rewrite is not available. Additionally, I have to access their
> version of the site through an IP address plus a home subdirectory,
> eg:
>
> http://xxx.xxx.xxx.xxx./~foo/
>
> The directory structure:
>
> /home/foo/public_html/index.php
> /home/foo/public_html/app/
> /home/foo/public_html/app/webroot/
> /home/foo/public_html/cake/
>
> However, I'm just getting 404s (Apache's, not Cake's). Even a regular
> file in public_html is not found.
>
> I had this working (almost) with the contents of webroot in
> public_html and app & cake outside that. But I ran into trouble with
> the lack of mod_rewrite and gave up on that. Now, I can't seem to get
> anything to show up. Anyone have an idea?
--~--~-~--~~~---~--~~
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: HTML helper in function?

2009-08-11 Thread JamesF

if your controller is set up with var $helpers = array('html') ; you
should be fine..that error is just telling you that cake can't find
HtmlHelper...is there a reason you are executing that logic in your
view and not the controller?

On Aug 11, 7:02 pm, Josh  wrote:
> Hi,
>
> I have the contents of a tree menu stored in a multi-dimensional
> array. The number of dimensions is not fixed, so to turn the array
> into a menu in the View file, I have set up a recurring function. This
> works fine except that I can't call the $html->link() from the
> function.
>
> Fatal error: Call to a member function link() on a non-object in...
>
> Any ideas? Is there a way to make the link() function global as you do
> a variable? There are some obvious work-arounds such as writing the
> anchor tag without the html helper, or turning the link array into a
> simpler two dimensional array where I can then iterate the link()
> function. However, I am wonder how I might specifically address the
> question of making the html->link() function available to a function
> within a view file.
>
> I have a feeling this is either going to be a simple declaration or
> not worth the trouble. Thanks in advance.
>
> Here is my code:
>
>     //array of links
>     key: link title
>     value: link location or sub-array
>     $linkTree = array(
>         'User Management' => array(
>             'Permissions' => array(
>                 'Set Permissions' => '/tools/setPermissions',
>                 'Update ACOS' => '/tools/updateacl',
>                 'View/Edit Groups' => '/admin/groups'
>             ),
>             'User Settings' => '/tools/userSettings',
>             'Users' => array(
>                 'List' => '/admin/users',
>                 'Add User' => '/admin/users/add'
>             )
>         )
>     );
>
>     //output menu function
>     function outputMenu ($array, $level) {
>         global $levelMarker;
>
>         foreach ($array as $key => $value) {
>             if (is_array($value)) {
>                 echo $level . $key;
>                 echo '';
>                 outputMenu($value, $level . $levelMarker);
>             } else {
>                 echo $html->link("$level$key", $value);
>                 echo '';
>             }
>         }
>         echo "";
>     }
>
>     //output menu settings
>     $levelMarker = '-';
>     $level = '';
>     $linkTreeSimple = array();
>
>     //output menu
>     outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
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: URL some page .../id disappeared ?

2009-08-11 Thread JamesF

i found that any time i didn't verbosely link i ended up having to
change all sorts of functions whenever my boss wanted a different url

On Aug 11, 2:29 am, brian  wrote:
> @James
>
> I thought at first that looked like a real pain but verbose array
> linking (finding, routing, containing, etc.) is definitely the way to
> go, I agree. It's often self-documenting, for one thing. And it goes
> to the heart of what Cake is, I think. Big kudos to the devs for
> pulling this together so coherently.
>
> On Mon, Aug 10, 2009 at 9:53 PM, JamesF wrote:
>
> > @euromark
>
> > your code is certainly more to the point, but i can't break the habit
> > of verbosely linking all my actions.
>
> > On Aug 8, 9:53 pm, "euromark (munich)" 
> > wrote:
> >> as i said, i would go with JUST "url"=>"/".$this->params['url]['url']
> >> in this case there is no need to use "action" or the manually built
> >> url like james suggested
>
> >> be aware of the "/" in front of it though (otherwise the url is not
> >> built correctly)
>
> >> On 9 Aug., 02:06, JamesF  wrote:
>
> >> > make sure you $form->create is submitting to the id as a parameter as
> >> > well
>
> >> > echo $form->create('FormName', array('url'=>array
> >> > ('controller'=>'myController', 'action'=>'myAction', $id,
> >> > 'admin'=>true)));
>
> >> > On Aug 7, 7:13 pm, leafchild  wrote:
>
> >> > > URL some page  .../id disappeared ?
>
> >> > > I have site there are different form pages to organize products.
>
> >> > > Some form page such as admin_edit page - URL:  ... admin/product/edit/
> >> > > 1
> >> > > After I submit URL still same either there is an error or not.
>
> >> > > However, some form page lose id from URL after submit,
> >> > > and showing index error.
>
> >> > > for example, URL: ...admin/category/customer/edit/1 -> ...admin/
> >> > > category/customer/edit
> >> > > ==
> >> > > if (!empty($this->data)) {
> >> > >    // empty}
>
> >> > > ==
> >> > > I deleted all the code inside of if statement for taking care of
> >> > > submitting data.
> >> > > The one keep same URL doesn't show error but other does.
>
> >> > > Not sure difference between these two has.
> >> > > I don't know why? Does anyone know what's the issue?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cakephp accessing files

2009-08-10 Thread JamesF

The way I handle PayPal in my app is to store the shopping cart as an
entry in a table called transactions.
i use serialize to store all my transaction details, and from the it
generates the button code unencrypted. When the PayPal transaction
finishes it sends an Instant Payment Notification to my app and I have
a script to porocess that in the background, comparing the PayPal
results to the stored transaction. If everything matches up we process
the order otherwise it gets flagged.

I don't like encypted buttons with PayPal because they are a pain in
the ass to edit (logging in to PayPal). I would rather generate my
code on the fly.

PayPal is also coming out with a new API which should be interesting,
if not a bit off the subject.


On Aug 7, 10:56 am, adrian  wrote:
> I'm setting up paypal and have everything running fine except for one
> last thing which is encrypting the form that is sent to PayPal. I have
> this setup with no problems on a server not running cakephp, but when
> I try to set it up while running Cakephp it just wont access the files
> it needs.  It uses 3 .pem files that are used to encrypt the form but
> I have no Idea where to place them so Cakephp has access to them. I'm
> sure people must have had similar problems but couldn't find anything
> on Google.
>
> Any help would be great :)
>
> Cheers,
> Adrian
--~--~-~--~~~---~--~~
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: Log Errors when debug = 0?

2009-08-10 Thread JamesF

i sometimes set a global constant in my bootstrap.php

define('LIVE_SITE', true);

and any error handling has to check and see if('LIVE_SITE') is true
before
it decides what to do with an error.

http://book.cakephp.org/view/154/Error-Handling

On Aug 10, 5:22 pm, David  wrote:
> Hi guys,
>
> I would like to silently write errors to error.log when in production
> mode. It would be useful to catch anything going wrong that I hadn't
> previously noticed.
>
> Any ideas for a way to do this?
>
> Thanks!
>
> David
--~--~-~--~~~---~--~~
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: Log Errors when debug = 0?

2009-08-10 Thread JamesF

i sometimes set a global flag in my bootstrap.php

$live = true;

and any error handling has to check and see if($live) is true before
it decides what to do with an error.

http://book.cakephp.org/view/154/Error-Handling


On Aug 10, 5:22 pm, David  wrote:
> Hi guys,
>
> I would like to silently write errors to error.log when in production
> mode. It would be useful to catch anything going wrong that I hadn't
> previously noticed.
>
> Any ideas for a way to do this?
>
> Thanks!
>
> David
--~--~-~--~~~---~--~~
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: Recursive directory iterator and sorting

2009-08-10 Thread JamesF

http://us3.php.net/manual/en/function.asort.php


On Aug 10, 3:07 am, Alan C  wrote:
> Does anyone know how to sort the results produced by
> recursivedirectoryiterator
>
> the results I'm getting show all the directory tree for a given
> folder, but they are not sorted in any way, what I would like is an
> alphabetic sort of each level.
--~--~-~--~~~---~--~~
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: belongsTo select pulldown is named for Model, not for the applicable foreign key...

2009-08-10 Thread JamesF

i notice you didn't use hasMany or hasOne in your family model.

var $hasMany= array(
'Widget' => array(
'className' => 'Widget',
'foreignKey' => 'family_id',
)
);

i assume you have family_id set up as a foreign key in your widget
table. of course your set up may vary.

just to clarify are you trying to save a Family, a widget or both?

On Aug 10, 9:49 pm, azkid  wrote:
> I have a model named Widget, and another named Family.  Widget
> belongsTo Family, and the table associated with Widget has a foreign
> key in it, called id.  This foreign key is non-standard, I know, but
> it is a legacy application with cake spliced in--so I manually set the
> foreign key in the association.  Furthermore, the Family table using
> familyid for its primary key (non-standard again).  I have a select
> pulldown in the add() view for Widget, where all available Familes are
> displayed.  In order to get the select pulldown to display all the
> available families, my controller uses $this->set and find('list') to
> create the appropriate view variables.  I've put the applicable code
> snippets athttp://bin.cakephp.org/view/1167953986
>
> The problem is, that when I save, the data from the select field named
> "Family" doesn't save, since the database is expecting something named
> "id", but $this->data contains something named "Family".  I had
> assumed that defining the foreign key in my belongsTo association
> would have made this all work correctly, but obviously not.  I now do
> not believe that things would work even if the conventions were being
> followed.  Instead, I believe that I am making some kind of
> fundamental mis-assumption about how belongsTo associations are
> handled both when rendering a view and at save time.  Is there
> something obvious that jumps out here to anyone?  Being fairly new to
> cake, I've been scouring the cake google group as well as the cookbook
> for guidance, but am still coming up short.
--~--~-~--~~~---~--~~
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: URL some page .../id disappeared ?

2009-08-10 Thread JamesF

@euromark

your code is certainly more to the point, but i can't break the habit
of verbosely linking all my actions.

On Aug 8, 9:53 pm, "euromark (munich)" 
wrote:
> as i said, i would go with JUST "url"=>"/".$this->params['url]['url']
> in this case there is no need to use "action" or the manually built
> url like james suggested
>
> be aware of the "/" in front of it though (otherwise the url is not
> built correctly)
>
> On 9 Aug., 02:06, JamesF  wrote:
>
> > make sure you $form->create is submitting to the id as a parameter as
> > well
>
> > echo $form->create('FormName', array('url'=>array
> > ('controller'=>'myController', 'action'=>'myAction', $id,
> > 'admin'=>true)));
>
> > On Aug 7, 7:13 pm, leafchild  wrote:
>
> > > URL some page  .../id disappeared ?
>
> > > I have site there are different form pages to organize products.
>
> > > Some form page such as admin_edit page - URL:  ... admin/product/edit/
> > > 1
> > > After I submit URL still same either there is an error or not.
>
> > > However, some form page lose id from URL after submit,
> > > and showing index error.
>
> > > for example, URL: ...admin/category/customer/edit/1 -> ...admin/
> > > category/customer/edit
> > > ==
> > > if (!empty($this->data)) {
> > >    // empty}
>
> > > ==
> > > I deleted all the code inside of if statement for taking care of
> > > submitting data.
> > > The one keep same URL doesn't show error but other does.
>
> > > Not sure difference between these two has.
> > > I don't know why? Does anyone know what's the issue?
--~--~-~--~~~---~--~~
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: cPanel shared hosting

2009-08-10 Thread JamesF

my cpanel setup is as follows

/home/jamesf/

is my cpanel accounts directory on the server

/home/jamesf/public_html
is where apache serves the webroot stuff

i set my cakephp lib stuff into a dir above public_html

/home/jamesf/usr/cakedev/cakeversion/cake/

and my app stuff in a seperate folder for my different versions

/home/jamesf/usr/myapp/versionx123/

that way when i pop in a new version i just create a new directory.

all the webroot stuff img/css/js is in public_html root with the
default htaccess that ships with cake.

you have to edit index.php in /public_html/ and point it to those
absolute paths you are using.

i personally wouldn't keep my /app and /cake folders in the /
public_html directory as a matter of security.

On Aug 10, 7:31 pm, thatsgreat2345  wrote:
> I usually have the app still inside the cakephp directory, and then
> depending if I have multiple apps on the host depends if I put webroot
> in subfolders, or just in public_html. Then just have to modify the
> index.php in the webroot to direct it to the location of cakephp for
> the root, and then the name of the app folder. Then all you have to
> worry about is mod_rewrite and you are good to go.
> /public_html
> ../webroot stuff here
> /cakephp
> ../app
>
> On Aug 10, 3:44 pm, Alexandru Ciobanu  wrote:
>
> > On 8/10/2009 6:03 AM, brian wrote:
>
> > > To complicate things, I need to access this other site through an IP,
> > > not a domain. If anyone has done this, could you please post some
> > > hints?
>
> > Hi Brian,
>
> > I've deployed several cake apps on cPanel shared hosting. Nothing to be
> > customized, just drop the entire application in public_html or www ( in
> > most cases a symlink to public_html).
>
> > Resulting tree:
>
> > $ ls public_html/
> > app/
> > cake/
> > .htaccess
> > index.php
--~--~-~--~~~---~--~~
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 part 2

2009-08-10 Thread JamesF

you didn't set posts to your view.

in your controller

$posts = $this->paginate('Post', $conditions);
$this->set('posts', $posts);

On Aug 9, 7:46 pm, valuba  wrote:
> sorry this is part 2,
>
> and my index.ctp looks like this:
>
> ...// html/php to show the posts
> echo $paginator->prev('« Previous ', null, null, array('class' =>
> 'disabled'));6.    echo $paginator->next(' Next »', null, null, array
> ('class' => 'disabled'));
>
> (exactly like the tut)
>  I'm receiving an error:
>
> Notice (8): Undefined variable: posts [APP\views\posts\index.ctp, line
> 1]
> Warning (2): Invalid argument supplied for foreach() [APP\views\posts
> \index.ctp, line 1]
>
> thank you
--~--~-~--~~~---~--~~
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: 1 Controller, 2 Actions, how to paginate differently?

2009-08-10 Thread JamesF

set your data to your view like so

$data = $this->paginate('MyModel', $conditions);

$this->set('data', $data');

$conditions is an array of conditions.

On Aug 10, 3:36 pm, DigitalDude  wrote:
> Hey,
>
> I have an app where I need to do the following:
>
> In action 1, I want to paginate the result-data with, let's say, a
> condition 1.
> In action 2, I want to paginate my results with other conditions.
>
> How can I do that?
>
> At the moment, I only have the "public $paginate = array()" in my
> controller, but how can I use different pagination-conditions (and
> maybe contains...) in two different actions?
>
> I think there is a way to do this, but I don't remember how and I
> can't find a solution anywhere...
--~--~-~--~~~---~--~~
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: what's the best, most current book available in English?

2009-08-08 Thread JamesF

http://www.amazon.com/CakePHP-Application-Development-Step-step/dp/1847193897/ref=pd_bxgy_b_img_c

was a good read when i first started.i find the docs to be good
but too verbose for a quick start sometimes.

On Aug 7, 10:41 am, vtbludgeon  wrote:
> Hello
>
> Cake noob here, but I have no fear of PHP/MySQL and some experience
> with Zend Framework. I want to do a project with typical stuff: CRUD
> with relational db data, authentication and simple user-group-based
> access control, ajax. What book do you like? (Yes the online docs and
> toots are fine but I like those nice weighty dead tree things that I
> can carry and hold).
>
> Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: need a cms plugin for tutorwebsite

2009-08-08 Thread JamesF

why not just make your own crud CMS, it's fun and easy. if you want a
CMS that doesn't require programming switch to Joomla.

there are a few on cakeForge if you want something out of the box.

http://cakeforge.org/

On Aug 6, 11:50 pm, "adilraufk...@gmail.com" 
wrote:
> I need a opensource simple cms plugin to use in my tutor application,
> is there any one who has used cms as plugin to cake.
--~--~-~--~~~---~--~~
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: URL some page .../id disappeared ?

2009-08-08 Thread JamesF

make sure you $form->create is submitting to the id as a parameter as
well

echo $form->create('FormName', array('url'=>array
('controller'=>'myController', 'action'=>'myAction', $id,
'admin'=>true)));

On Aug 7, 7:13 pm, leafchild  wrote:
> URL some page  .../id disappeared ?
>
> I have site there are different form pages to organize products.
>
> Some form page such as admin_edit page - URL:  ... admin/product/edit/
> 1
> After I submit URL still same either there is an error or not.
>
> However, some form page lose id from URL after submit,
> and showing index error.
>
> for example, URL: ...admin/category/customer/edit/1 -> ...admin/
> category/customer/edit
> ==
> if (!empty($this->data)) {
>    // empty}
>
> ==
> I deleted all the code inside of if statement for taking care of
> submitting data.
> The one keep same URL doesn't show error but other does.
>
> Not sure difference between these two has.
> I don't know why? Does anyone know what's the issue?
--~--~-~--~~~---~--~~
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: Silent errors when model's table is not found??

2009-08-08 Thread JamesF

why not just add some check while loading your models to see if they
exist

if(ClassRegistry::init($modelName)){

}
as an example (im sure there are better methods, check the api)


On Aug 8, 3:09 pm, Abhimanyu Grover  wrote:
> Right now, If a table for a specific model is not found, CakePHP
> execution stops with big "Missing database table" error - however
> sometimes you may run into scenario where you need not following code
> to run.. We ran into a similar scenario in a project which has like 30
> models, out of which some are not always required on different client
> setups. The problem occurred when we made a shell script which
> performs some stuff on every model of system. So, whenever it tries to
> load a model, say:
>
> foreach($models as $modelName) {
> $model = ClassRegistry::init($modelName);
>
> }
>
> So when a model whose db table doesn't exists, is being loaded - it
> exits saying "Missing database table" and doesnt go beyond. I went
> a step ahead a tried overwriting Object::_stop() but that'll just
> produce more warnings, and it just didnt worked.
>
> Anyone faced this issue before? or Any ideas on getting ahead of the
> problem?
>
> Thanks guys.
> Abhimanyu
--~--~-~--~~~---~--~~
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: Routing problem with underscores and named arguments

2009-08-07 Thread JamesF

well i didn't want to do it this way but
in my bootstrap:

define('SEO_SEPERATOR', '_');

now in my links:

$html->link('mylink', array('controller'=>'mycontroler',
'action'=>'myaction', 'sid'=>$sid, 'slug'=>$slug . SEO_SEPERATOR));

in my router
connect('/:slug:sid/*, etc etc')

this works for right now but it definatley has potential to break if i
start moving urls around.

On Aug 7, 12:47 pm, JamesF  wrote:
> ok this is driving me nuts now. basically if i put an underscore after
> the parameter e.x :slug_
> cake is expecting to find a match on 'slug_' not 'slug' as i want. if
> i put an underscore before slug ex _:slug it works fine.
> it appears underscore doesn't work as a variable delimiter.
>
> On Aug 6, 2:03 pm, JamesF  wrote:
>
> > @brian
>
> > yes in that attempt i was trying to see how the router was parsing
> > underscores, in the first example slug was 'slug' and the route
> > was /:slug_:sid/
> > in the last example i was curious to try slug as 'slug_', with the
> > route as /:slug__:sid/ to see how theregexparsed.
>
> > basically whenever i put another character like ) or - before the
> > underscore of the next parameter, (or after the first, im not sure of
> > how its parsing)
> > like this:
> > /:slug-_:sid/
>
> > i get what i want. /my-slug-is-so-great-except-for-the-last-dash-_sid/
>
> > trust me if it were up to me i would ditch the underscore altogether
> > for : like /slug:sid
>
> > On Aug 6, 12:28 pm, brian  wrote:
>
> > > You've got 2 underscores here:
> > >  '/:slug__:sid/*'
>
> > > If it was up to me, I'd just drop the underscores altogether. Just
> > > append sid to slug.
>
> > > On Thu, Aug 6, 2009 at 11:36 AM, JamesF wrote:
>
> > > > i even tried this thinking i was clever
>
> > > > Router::connect(
> > > >    '/:slug__:sid/*',
> > > >    array('controller' => mycontroller, 'action' => 'index'),
> > > >    array(
> > > >        'pass'=>array('sid', 'slug_'),
> > > >        'sid'=>'[0-9]+',
> > > >        'slug_'=>'[0-9a-z-]+',
> > > >    )
> > > > );
>
> > > > which gave me mysite.com/mycontroller/index/sid:12345/slug_:this-is-my-
> > > > slug
>
> > > > On Aug 6, 5:13 am, "Dr. Loboto"  wrote:
> > > >> Router::connect(
> > > >>     '/:slug_:sid/*',
> > > >>     array('controller' => mycontroller, 'action' => 'index'),
> > > >>     array(
> > > >>         'pass'=>array('sid', 'slug'),
> > > >>         'sid'=>'[0-9]+',
> > > >>         'slug'=>'[0-9a-z-]+',
> > > >>     )
> > > >> );
>
> > > >> On Aug 6, 2:29 am, JamesF  wrote:
>
> > > >> > for some reason when i am putting an underscore directly after a 
> > > >> > named
> > > >> > argument in my route, it breaks.
>
> > > >> > doesn't work:
> > > >> > Router::connect('/:slug_:sid/*', array('controller' => mycontroller,
> > > >> > 'action' => 'index'), array('pass'=>array('sid', 'slug'),
> > > >> > 'sid'=>'[0-9]+'));
>
> > > >> > if i put a dash or any other character right after my first argument
> > > >> > it works ok but that is not my desired url.
> > > >> > i would like /slug_sid/*
>
> > > >> > (my slug is something like my-article-title)
>
> > > >> > works:
> > > >> > Router::connect('/:slug-_:sid/*', array('controller' => mycontroller,
> > > >> > 'action' => 'index'), array('pass'=>array('sid', 'slug'),
> > > >> > 'sid'=>'[0-9]+'));
>
> > > >> > i saw a bug report about this but nate closed it saying that theregex
> > > >> > wasn't specific enough. i have admittley weakregexskills does anyone
> > > >> > kow a possible solution?
>
> > > >> > thanks- Hide quoted text -
>
> > > - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing problem with underscores and named arguments

2009-08-07 Thread JamesF

ok this is driving me nuts now. basically if i put an underscore after
the parameter e.x :slug_
cake is expecting to find a match on 'slug_' not 'slug' as i want. if
i put an underscore before slug ex _:slug it works fine.
it appears underscore doesn't work as a variable delimiter.

On Aug 6, 2:03 pm, JamesF  wrote:
> @brian
>
> yes in that attempt i was trying to see how the router was parsing
> underscores, in the first example slug was 'slug' and the route
> was /:slug_:sid/
> in the last example i was curious to try slug as 'slug_', with the
> route as /:slug__:sid/ to see how theregexparsed.
>
> basically whenever i put another character like ) or - before the
> underscore of the next parameter, (or after the first, im not sure of
> how its parsing)
> like this:
> /:slug-_:sid/
>
> i get what i want. /my-slug-is-so-great-except-for-the-last-dash-_sid/
>
> trust me if it were up to me i would ditch the underscore altogether
> for : like /slug:sid
>
> On Aug 6, 12:28 pm, brian  wrote:
>
> > You've got 2 underscores here:
> >  '/:slug__:sid/*'
>
> > If it was up to me, I'd just drop the underscores altogether. Just
> > append sid to slug.
>
> > On Thu, Aug 6, 2009 at 11:36 AM, JamesF wrote:
>
> > > i even tried this thinking i was clever
>
> > > Router::connect(
> > >    '/:slug__:sid/*',
> > >    array('controller' => mycontroller, 'action' => 'index'),
> > >    array(
> > >        'pass'=>array('sid', 'slug_'),
> > >        'sid'=>'[0-9]+',
> > >        'slug_'=>'[0-9a-z-]+',
> > >    )
> > > );
>
> > > which gave me mysite.com/mycontroller/index/sid:12345/slug_:this-is-my-
> > > slug
>
> > > On Aug 6, 5:13 am, "Dr. Loboto"  wrote:
> > >> Router::connect(
> > >>     '/:slug_:sid/*',
> > >>     array('controller' => mycontroller, 'action' => 'index'),
> > >>     array(
> > >>         'pass'=>array('sid', 'slug'),
> > >>         'sid'=>'[0-9]+',
> > >>         'slug'=>'[0-9a-z-]+',
> > >>     )
> > >> );
>
> > >> On Aug 6, 2:29 am, JamesF  wrote:
>
> > >> > for some reason when i am putting an underscore directly after a named
> > >> > argument in my route, it breaks.
>
> > >> > doesn't work:
> > >> > Router::connect('/:slug_:sid/*', array('controller' => mycontroller,
> > >> > 'action' => 'index'), array('pass'=>array('sid', 'slug'),
> > >> > 'sid'=>'[0-9]+'));
>
> > >> > if i put a dash or any other character right after my first argument
> > >> > it works ok but that is not my desired url.
> > >> > i would like /slug_sid/*
>
> > >> > (my slug is something like my-article-title)
>
> > >> > works:
> > >> > Router::connect('/:slug-_:sid/*', array('controller' => mycontroller,
> > >> > 'action' => 'index'), array('pass'=>array('sid', 'slug'),
> > >> > 'sid'=>'[0-9]+'));
>
> > >> > i saw a bug report about this but nate closed it saying that theregex
> > >> > wasn't specific enough. i have admittley weakregexskills does anyone
> > >> > kow a possible solution?
>
> > >> > thanks- Hide quoted text -
>
> > - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Notice (8): Undefined variable: title [APP/views/titles/view.ctp, line 6]

2009-08-06 Thread JamesF

looking at your controller i can tell you that $title is not getting
assigned because the read call isn't returning any data. check you sql
log at the bootom of the screen and make sure the query is correct.

On Aug 6, 12:22 pm, jburns  wrote:
> Hi - I am new to CakePHP and finding my way around.
>
> I have used bake to create model/view/controllers for a simple table.
> Index works fine, displaying all records in the table, and so does
> edit. But when I click the 'view' link, I get this error:
>
> Notice (8): Undefined variable: title [APP/views/titles/view.ctp, line
> 6]
>
> I have added the code (straight out of bake) below. I can't see
> anything obviously wrong. Is this a known issue? Where is the error
> likely to be?
>
> CODE:
>
> The model:
> class Title extends AppModel {
>
>         var $name = 'Title';
>         var $validate = array(
>                 'title' => array('notempty'),
>                 'display_order' => array('numeric')
>         );
>
>         //The Associations below have been created with all possible keys,
> those that are not needed can be removed
>         var $hasMany = array(
>                 'User' => array(
>                         'className' => 'User',
>                         'foreignKey' => 'title_id',
>                         'dependent' => false,
>                         'conditions' => '',
>                         'fields' => '',
>                         'order' => '',
>                         'limit' => '',
>                         'offset' => '',
>                         'exclusive' => '',
>                         'finderQuery' => '',
>                         'counterQuery' => ''
>                 )
>         );
>
> }
>
> The controller (truncated)
>
> class TitlesController extends AppController {
>
>         var $name = 'Titles';
>         var $helpers = array('Html', 'Form');
>
>         function index() {
>                 $this->Title->recursive = 0;
>                 $this->set('titles', $this->paginate());
>         }
>
>         function view($id = null) {
>                 if (!$id) {
>                         $this->flash(__('Invalid Title', true), 
> array('action'=>'index'));
>                 }
>                 $this->set('title', $this->Title->read(null, $id));
>         }
>
> The view (truncated as it breaks on line 6 and subsequent rows):
> 
> 
>         
>                 > ?>
>                 >
>                         
--~--~-~--~~~---~--~~
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: Running shells as cron jobs on Godaddy

2009-08-06 Thread JamesF

check -path in your arguments because it seems from what you typed
that the php cli can't find cake.bat

On Aug 6, 3:56 pm, Josh  wrote:
> Hi,
>
> I have been trying to get a shell script to run as a cron job on
> Godaddy for quite a while. Here is what I have entered as a command
> based on the Cookbook (http://book.cakephp.org/view/846/Running-Shells-
> as-cronjobs):
>
> /home/content/.../html/vendors/cakeshell report -cli /web/cgi-bin/php5
> -console /home/content/.../html/cake/console/cake -app /home/
> content/.../html/app
>
> Error: /home/content/.../html/vendors/cakeshell: line 12: cake:
> command not found
>
> What can I try to get this working? Will it work with godaddy?
>
> Any ideas would be much appreciated. Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing problem with underscores and named arguments

2009-08-06 Thread JamesF

@brian

yes in that attempt i was trying to see how the router was parsing
underscores, in the first example slug was 'slug' and the route
was /:slug_:sid/
in the last example i was curious to try slug as 'slug_', with the
route as /:slug__:sid/ to see how the regex parsed.

basically whenever i put another character like ) or - before the
underscore of the next parameter, (or after the first, im not sure of
how its parsing)
like this:
/:slug-_:sid/

i get what i want. /my-slug-is-so-great-except-for-the-last-dash-_sid/

trust me if it were up to me i would ditch the underscore altogether
for : like /slug:sid



On Aug 6, 12:28 pm, brian  wrote:
> You've got 2 underscores here:
>  '/:slug__:sid/*'
>
> If it was up to me, I'd just drop the underscores altogether. Just
> append sid to slug.
>
>
>
> On Thu, Aug 6, 2009 at 11:36 AM, JamesF wrote:
>
> > i even tried this thinking i was clever
>
> > Router::connect(
> >    '/:slug__:sid/*',
> >    array('controller' => mycontroller, 'action' => 'index'),
> >    array(
> >        'pass'=>array('sid', 'slug_'),
> >        'sid'=>'[0-9]+',
> >        'slug_'=>'[0-9a-z-]+',
> >    )
> > );
>
> > which gave me mysite.com/mycontroller/index/sid:12345/slug_:this-is-my-
> > slug
>
> > On Aug 6, 5:13 am, "Dr. Loboto"  wrote:
> >> Router::connect(
> >>     '/:slug_:sid/*',
> >>     array('controller' => mycontroller, 'action' => 'index'),
> >>     array(
> >>         'pass'=>array('sid', 'slug'),
> >>         'sid'=>'[0-9]+',
> >>         'slug'=>'[0-9a-z-]+',
> >>     )
> >> );
>
> >> On Aug 6, 2:29 am, JamesF  wrote:
>
> >> > for some reason when i am putting an underscore directly after a named
> >> > argument in my route, it breaks.
>
> >> > doesn't work:
> >> > Router::connect('/:slug_:sid/*', array('controller' => mycontroller,
> >> > 'action' => 'index'), array('pass'=>array('sid', 'slug'),
> >> > 'sid'=>'[0-9]+'));
>
> >> > if i put a dash or any other character right after my first argument
> >> > it works ok but that is not my desired url.
> >> > i would like /slug_sid/*
>
> >> > (my slug is something like my-article-title)
>
> >> > works:
> >> > Router::connect('/:slug-_:sid/*', array('controller' => mycontroller,
> >> > 'action' => 'index'), array('pass'=>array('sid', 'slug'),
> >> > 'sid'=>'[0-9]+'));
>
> >> > i saw a bug report about this but nate closed it saying that the regex
> >> > wasn't specific enough. i have admittley weak regex skills does anyone
> >> > kow a possible solution?
>
> >> > thanks- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing problem with underscores and named arguments

2009-08-06 Thread JamesF

i even tried this thinking i was clever

Router::connect(
'/:slug__:sid/*',
array('controller' => mycontroller, 'action' => 'index'),
array(
'pass'=>array('sid', 'slug_'),
'sid'=>'[0-9]+',
'slug_'=>'[0-9a-z-]+',
)
);

which gave me mysite.com/mycontroller/index/sid:12345/slug_:this-is-my-
slug


On Aug 6, 5:13 am, "Dr. Loboto"  wrote:
> Router::connect(
>     '/:slug_:sid/*',
>     array('controller' => mycontroller, 'action' => 'index'),
>     array(
>         'pass'=>array('sid', 'slug'),
>         'sid'=>'[0-9]+',
>         'slug'=>'[0-9a-z-]+',
>     )
> );
>
> On Aug 6, 2:29 am, JamesF  wrote:
>
> > for some reason when i am putting an underscore directly after a named
> > argument in my route, it breaks.
>
> > doesn't work:
> > Router::connect('/:slug_:sid/*', array('controller' => mycontroller,
> > 'action' => 'index'), array('pass'=>array('sid', 'slug'),
> > 'sid'=>'[0-9]+'));
>
> > if i put a dash or any other character right after my first argument
> > it works ok but that is not my desired url.
> > i would like /slug_sid/*
>
> > (my slug is something like my-article-title)
>
> > works:
> > Router::connect('/:slug-_:sid/*', array('controller' => mycontroller,
> > 'action' => 'index'), array('pass'=>array('sid', 'slug'),
> > 'sid'=>'[0-9]+'));
>
> > i saw a bug report about this but nate closed it saying that the regex
> > wasn't specific enough. i have admittley weak regex skills does anyone
> > kow a possible solution?
>
> > thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing problem with underscores and named arguments

2009-08-06 Thread JamesF

thanks for your help. i tested your regex for 'slug' and i still ran
in to the same problem. i actually tried that same matching pattern
before i posted this.


very similar issue
https://trac.cakephp.org/ticket/5737


On Aug 6, 5:13 am, "Dr. Loboto"  wrote:
> Router::connect(
>     '/:slug_:sid/*',
>     array('controller' => mycontroller, 'action' => 'index'),
>     array(
>         'pass'=>array('sid', 'slug'),
>         'sid'=>'[0-9]+',
>         'slug'=>'[0-9a-z-]+',
>     )
> );
>
> On Aug 6, 2:29 am, JamesF  wrote:
>
> > for some reason when i am putting an underscore directly after a named
> > argument in my route, it breaks.
>
> > doesn't work:
> > Router::connect('/:slug_:sid/*', array('controller' => mycontroller,
> > 'action' => 'index'), array('pass'=>array('sid', 'slug'),
> > 'sid'=>'[0-9]+'));
>
> > if i put a dash or any other character right after my first argument
> > it works ok but that is not my desired url.
> > i would like /slug_sid/*
>
> > (my slug is something like my-article-title)
>
> > works:
> > Router::connect('/:slug-_:sid/*', array('controller' => mycontroller,
> > 'action' => 'index'), array('pass'=>array('sid', 'slug'),
> > 'sid'=>'[0-9]+'));
>
> > i saw a bug report about this but nate closed it saying that the regex
> > wasn't specific enough. i have admittley weak regex skills does anyone
> > kow a possible solution?
>
> > thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Nested Arrays

2009-08-05 Thread JamesF

use a foreach loop or two to get at the data you need. if you don't
want to do there there are some nice array handling methods in the
Core Set utility.
http://book.cakephp.org/view/640/Set

On Aug 5, 1:52 pm, Sami  wrote:
> So I'm building a new site for an existing site and one of the things
> I can't change is the database tables (because that would make my life
> easier).
>
> The user table is set up how cakephp likes its. The user_meta table is
> set up as such:
>
> meta_id, user_id, key, value
>
> So I have some users with 40-50 entries in the meta table while others
> only have 3 or 4.
>
> Then I do pr($user) I get this:
>
> Array
> (
>     [User] => Array
>         (
>             [ID] => 5
>             [user_login] => testwriter
>             [user_pass] => $P$Bq.
>             [user_nicename] => testwriter
>             [user_email] => te...@test1.com
>             [user_url] =>
>             [user_registered] => 2009-07-14 19:34:39
>             [user_activation_key] =>
>             [user_status] => 0
>             [display_name] => testwriter
>         )
>
>     [Metax] => Array
>         (
>             [0] => Array
>                 (
>                     [umeta_id] => 48
>                     [user_id] => 5
>                     [meta_key] => comment_shortcuts
>                     [meta_value] => false
>                 )
>
>             [1] => Array
>                 (
>                     [umeta_id] => 49
>                     [user_id] => 5
>                     [meta_key] => admin_color
>                     [meta_value] => fresh
>                 )
>
>             [2] => Array
>                 (
>                     [umeta_id] => 50
>                     [user_id] => 5
>                     [meta_key] => wp_capabilities
>                     [meta_value] => a:1:{s:6:"author";b:1;}
>                 )
>         )
> )
>
> I omited a lot of the metas just cause they would take forever to
> list. My question is what is a good way to access this data in a view?
> I can see user ID's by doing:
>
> echo $user['User']['ID']
>
> but how would I get a specific metadata? (the order is not the same
> for each user so I can't just use an array index)
--~--~-~--~~~---~--~~
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: forms in a element

2009-08-05 Thread JamesF

Your form has no name.

On Aug 5, 3:15 pm, cakephp_rocks  wrote:
> hey i created a form in a element and add the to my home page for some
> reason when  i submit it it say Invalid form submission and redirect
> me to this  '/users/register/' i give to the form any idea
> here is what i did
>
>  echo $form->create(null, array('url' => '/users/register/' . $this-
>
> >params['url']['url']));
>
> $out = $form->input('username', array('label' => __('Email *',
> true)));
> $out .= $form->input('email',array('label' => __('confirm Email*',
> true)));
> $firstName = $form->input('first_name', array('label' => __('First
> Name *', true)), array('fieldset' => false));
> echo sprintf($html->tags['fieldset'], '', sprintf($html->tags
> ['legend'], __('Sign Up', true)) . $out);
>
> echo $form->end('submit');
> ?>
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Routing problem with underscores and named arguments

2009-08-05 Thread JamesF

for some reason when i am putting an underscore directly after a named
argument in my route, it breaks.

doesn't work:
Router::connect('/:slug_:sid/*', array('controller' => mycontroller,
'action' => 'index'), array('pass'=>array('sid', 'slug'),
'sid'=>'[0-9]+'));

if i put a dash or any other character right after my first argument
it works ok but that is not my desired url.
i would like /slug_sid/*

(my slug is something like my-article-title)

works:
Router::connect('/:slug-_:sid/*', array('controller' => mycontroller,
'action' => 'index'), array('pass'=>array('sid', 'slug'),
'sid'=>'[0-9]+'));

i saw a bug report about this but nate closed it saying that the regex
wasn't specific enough. i have admittley weak regex skills does anyone
kow a possible solution?

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



Re: Big SELECT. Help me please!

2009-08-05 Thread JamesF

http://book.cakephp.org/view/474/Containable

should be able to help you

On Aug 4, 5:21 am, Long  wrote:
> Greetings!
>
> Help me please.
>
> I have 3 models:
>
> Job hasMany EquipSet
> Equip hasMany EquipSet
>
> Job ---> EquipSet <--- Equip
>
> I need to make normal FIND() with associations, automagic, e.t.c.
>
> $query =
> SELECT e.img
>    FROM equips e
>       WHERE e.id IN ( SELECT e.parent_id
>                                    FROM jobs j, equip_sets es, equips
> e
>                                        WHERE j.id=es.job_id AND
> e.id=es.equip_id AND j.id=1
>                                            GROUP BY e.parent_id );
>
> $this->Job->EquipSet->Equip->query($query)  - it works good
>
> p.s. I am sorry for my English =/

--~--~-~--~~~---~--~~
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: Custom Helper not loaded

2009-08-05 Thread JamesF

needs to be a component. setting it up is very similar to a helper.
please see the link robert supplied.

On Aug 4, 8:55 pm, Robert P  wrote:
> Where you're going wrong: Helpers are related to and accessed from
> within the View, not the Controller like you're trying to 
> do.http://book.cakephp.org/view/98/Helpers
>
> In /app/views/about/index.ctp replace
>     
> with
>     get('about_team'); ?>
> and you can get rid of the contents of your AboutController::index()
> function.
>
> Perhaps the functionality you're after is more suited to a 
> Component?http://book.cakephp.org/view/63/Introduction
>
> On Aug 5, 1:24 am, Kai  wrote:
>
> > Hi there,
>
> > I just wrote my first helper and, sure enough, ran into some problems.
> > For some reason my helper is not being loaded. As I could not find
> > anything similar I just expect something to be done wrong in my code.
>
> > My Helper (/app/views/helpers/content.php):
> >  > class ContentHelper extends AppHelper{
> >         function get($id){
> >                 $t = $this->requestAction('texts/get/'.$id);
> >                 return $this->output($t);
> >         }}
>
> > ?>
>
> > I placed it like this into $helpers in my app_controller (/app/
> > app_controller.php):
> >         var $helpers = array('Content');
>
> > And finally in my Controller (/app/controllers/about_controller.php) I
> > use it like this:
> >         function index(){
> >                 $this->set("text", $content->get('about_team'));
> >         }
>
> > However, no matter how I twist and turn it (putting it into the
> > Controllers $helper, writing it differently) I always get the same
> > error-message:
> > Undefined variable: content [APP/controllers/about_controller.php,
> > line 7]
>
> > During this process I learned that I do not get any error-messages
> > about my Helper-File at all. I've put an PHP-Error (deleting the
> > last }) into it without complaints. Heck, I can write whatever I want
> > into $helper and do not get any errors. It seems like to me that my
> > Helper is never loaded, $helper never parsed for any custom helpers.
>
> > Does anybody have a clue what I might be doing wrong?
>
> > My Cake-Version is 1.2.3.8166.

--~--~-~--~~~---~--~~
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: 500.shtml error? What is this? Help!?

2009-08-04 Thread JamesF

i got those 500 errors when my webroot directory permissions were
incorrectly set up. but in your case it seems that the error appears
when you submit a form. is it submitting the the right controller?

On Aug 4, 7:37 am, foldiman  wrote:
> I've deployed my project to a client's server and am getting a strange
> error when submitting text via a simple form. This does not happen on
> my staging server. The full error looks like this:
>
> NOT FOUND
>
> Error: The requested address '/500.shtml' was not found on this
> server.
>
> Obviously I'm not looking for a file 500.shtml...just submitting to a
> controller action. I've read somewhere about Zend Optimizer causing
> problems with CakePHP. But Zend is disabled on this sever? Any ideas?
>
> Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Slug name limitations

2009-08-04 Thread JamesF

im not sure i understand why a slug should conflict with you
functions. /posts/index/id-slug should be ok.
can you explain a little more?

On Aug 4, 8:49 am, "Dave Maharaj :: WidePixels.com"
 wrote:
> How would you validate a user created slug so that it is not a name used as
> a function in the app? (in my app they choose the slug they want...not
> created by first + lastname)
>
> I obviuosly do not want a user choosing a slug "admin" or any controller
> name || function?
> Since all of these are stored in the ACOS table is it best to query the
> table against what the user submits?
>
> Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Release: 1.2.4 and 1.3-dev

2009-08-04 Thread JamesF

i just created an exception for the domain in firefox and it went
through

On Aug 4, 12:18 pm, dogmatic  wrote:
> im also getting that
>
> On Aug 4, 4:39 am, JamesF  wrote:
>
>
>
> >https://trac.cakephp.org/wiki/changelog/1.2.x.x
>
> > getting a error trying to load this page
>
> > Secure Connection Failed
>
> > trac.cakephp.org uses an invalid security certificate.
>
> > The certificate expired on 8/3/2009 12:05.
>
> > (Error code: sec_error_expired_certificate)
>
> > On Aug 3, 6:58 pm, Gwoo  wrote:
>
> > > The CakePHP development team is happy to announce the release of two
> > > new versions. Firstly, CakePHP 1.2.4[1] is a bug fix release of the
> > > latest stable branch. Check the changelog[2] for all the changes.
> > > Also, we have made CakePHP 1.3.0-dev[3] available for download.
>
> > > CakePHP 1.2 includes more than 100 commits along with over 70 bug
> > > fixes.
>
> > > CakePHP 1.3 dev includes many new enhancements and some optimizations.
> > > The most notable changes include
> > >         - compatibility changes have been added for PHP 5.3.
> > >         - new Javascript Helper including support for multiple js 
> > > libraries
> > >         - improved bake code generation with better support for plugins 
> > > and
> > > templates
>
> > > Checkout the 1.3 changelog[4], 1.3 migration guide[5] and 1.3 hit list
> > > for some more ideas.
>
> > > As well as these changes to the code, we have some other changes to
> > > the project.
>
> > > - We completed our move to git and opened uphttp://code.cakephp.org,
> > > which uses the latest version of 1.3, as the new home for all
> > > developments related to CakePHP. The old development site at
> > > trac.cakephp.org will continue to exist for legacy purposes, however,
> > > you will not be able to create new tickets. If you have any new issues
> > > on 1.2 or find problems with 1.3, please 
> > > gotohttp://code.cakephp.org/tickets.
>
> > > - With the move to git, you will see lots of branches and might wonder
> > > which ones to use.
> > >  - master: latest stable, 1.2.4.8284
> > >  - 1.2: development branch for bug fixes
> > >  - 1.3: development branch for new features
>
> > > There are several other branches, but those are for specific feature
> > > development and may not be stable. Feel free to fork the project and
> > > work on code as you need it. We can pull changes in from your fork and
> > > we have actually already done this a few times.
>
> > > - We have some changes to the CakePHP job board, located 
> > > athttp://cakephp.org/jobs. We received this message from
> > > EliteOpenSourceJobs.
>
> > > "We'd like to thank everyone who has posted jobs on or visited our job
> > > board.  After many months of having our boards up on several
> > > communities (including Cake) and with a great a deal of feedback from
> > > communities, we have decided to make the job board free to post.  We
> > > think this will be much better for everyone, as there will be more
> > > postings for developers, and will make it even more apparent that
> > > there are real opportunities for those who know Cake.
>
> > > We hope everyone will visit cakephp.org/jobs frequently in the near
> > > future, as there are more opportunities than ever on the board.  We
> > > also hope that if you are looking for developers, you will consider
> > > the Cake board first.
>
> > > You can also support the community by posting a job widget on your
> > > site.  This will help companies who want to find use Cake find great
> > > developers fast.  Just sign up 
> > > at:http://eliteopensourcejobs.com/affiliates/register
> > > and we'll get you a snippet right away.  It takes less than a minute
> > > to sign up."
>
> > > [1]http://cakeforge.org/frs/?group_id=23&release_id=447
> > > [2]https://trac.cakephp.org/wiki/changelog/1.2.x.x
> > > [3]http://cakeforge.org/frs/?group_id=23&release_id=448
> > > [4]http://code.cakephp.org/wiki/1.3/changelog
> > > [5]http://code.cakephp.org/wiki/1.3/migration-guide
> > > [6]http://code.cakephp.org/wiki/1.3/Hit_List- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Fatal error: Maximum execution time of 30 seconds exceeded

2009-08-03 Thread JamesF

set execution time in php ini. i wouldnt use max execution at -1
(infinite) and your host might have some hard limits. mine is 1
seconds because i would like scripts to eventually terminate.

On Aug 2, 5:20 am, arif hossen  wrote:
> --
> Dear All,
> Please help me ,
> How i can solve below this problem in cakephp ,I want to unlimited execution
> time.
>
> *Fatal error*: Maximum execution time of 30 seconds exceeded in *
> D:\wamp\www\auctionsite\cake\libs\folder.php* on line *445*
>
> Regards,
> Mohammad Arif Hossen
> Web Developer
> United Group International(UGIBD)www.ugibd.net
> Mobile no:  +88 01714355911
> Mobile no:  +88 01922110308
--~--~-~--~~~---~--~~
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: Urgent help needed

2009-08-03 Thread JamesF
> var $validate = array(
>   'fldCompanyName' => VALID_NOT_EMPTY,
>   'fldContactPerson' => VALID_EMAIL,
>   'fldAddress' => VALID_NUMBER
>);

the validate array in your model looks suspect.

try using the validation rules on this page:
http://book.cakephp.org/view/134/Core-Validation-Rules


On Aug 2, 1:18 pm, Rahul  wrote:
> Hello Guys,
>
> I am new with cake php and I am building a Invpoice Manager for one of
> my cleint . I am stuck with data valdation an need your help to figure
> out the error , data validation is not working . Plerase find all the
> code below:
>
> Controller
>  class AdminsController extends AppController {
>
>         var $name = 'Admins';
>         var $uses = array('Admin','User_role');
>
>         function index() {
>
>                 $this->set('admins', $this->Admin->find('all'));
>
>         }
>
>         function user_register() {
>
>                 if($this->Session->check('USER') == false)
>                 {
>                         $this->flash('Your session has been expired, please 
> login to
> continue.','/');
>                         return;
>                 }
>
>                 if (!empty($this->data)) {
>                          if ($this->Admin->save($this->data))
>                                 {
>                                         $this->Session->setFlash('Your post 
> has been saved.');
>                                         $this->redirect(array('action' => 
> 'success'));
>                                 }
>
>                         else
>                         {
>                                         $this->set('data', $this->data);
>                                         $this->validateErrors($this->data);
>                                         $this->render();
>
>                         }
>                 }
>         }
>
>         function user_role()
>         {
>
>                 if($this->Session->check('USER') == false)
>                 {
>                         $this->flash('Your session has been expired, please 
> login to
> continue.','/');
>                         return;
>                 }
>
>                 // get the list of all users for which there is no role data 
> in db
>                 $user_id = $_SESSION['USER'];
>                 $allNewCompanies = $this->Admin->__get_users_norole($user_id);
>                 $this->set('user_norole_list' , $allNewCompanies);
>         }
>
>         function assign_role($id)
>         {
>
>                 $this->set("company_id",$id);
>
>                 // form posted now handle data and save to db
>
>                 if( isset($_POST['submit']) || isset($this->data) )
>                 {
>
>                         /*
>                         if($this->User_role->validate())
>                         {
>                                 
> $this->Admin->__assign_user_role($this->data->rdAssignRole,$this->data->company_id);
>
>                         }
>                         else
>                         {
>                                 $errors = $this->User_role->invalidFields();
>                                 $this->Session->setFlash(implode('', 
> $errors));
>
>                         }
>                         */
>                         if(!empty($_POST['role_id']))
>                         {
>                                 
> $this->Admin->__assign_user_role($_POST['company_id'],$_POST
> ['role_id']);
>                                 $this->Session->setFlash('Role has been 
> successfully assigned.');
>                                 $this->redirect(array('action' => 'success'));
>                         }
>                 }
>
>         }
>
>         function success()
>         {
>                 if($this->Session->check('USER') == false)
>                 {
>                         $this->flash('Your session has been expired, please 
> login to
> continue.','/');
>                         return;
>                 }
>         }
>
> }
>
> ?>
>
> model
> 
> class Admin extends AppModel {
>
>     var $name = 'Admin';
>         var $useTable = false;
>
>         var $validate = array(
>       'fldCompanyName' => VALID_NOT_EMPTY,
>       'fldContactPerson' => VALID_EMAIL,
>       'fldAddress' => VALID_NUMBER
>    );
>
>         // This is where the magic happens
>         function schema() {
>                 return array (
>                         'fldCompanyName' => array('type' => 'string', 
> 'length' => 60),
>                         'fldContactPerson' => array('type' => 'string', 
> 'length' => 60),
>                         'fldAddress' => array('type' => 'text', 'length' => 
> 100),
>                         'fldPhone' => array('type' => 'string', 'length' => 
> 8),
>                         'fldMobile' => array('type' => 'string', 'length' => 
> 10),
>                         'fldFax' => array('type' => 'string', 'length' => 8),
>                         'fldCSTNo' => array('type' => 'string', 'length'

Re: shuffle(), rand(), etc always returning same number

2009-08-03 Thread JamesF

you could always curl http://www.random.org/ and extract the results
from their random number generator.

all kidding aside, what are you feeding to srand()?

what does 3x echo rand() give you if you dont seed it?

whats does it give you after you seed it?

just trying to name off a few things to get yer mind kicking. good
luck and report back


On Aug 3, 7:10 pm, Miles J  wrote:
> Also ive tried setting srand() manually, and my /dev/random and /dev/
> urandom folders exist.
>
> On Aug 3, 3:25 pm, Miles J  wrote:
>
> > I found this very weird bug today, and I am extremely stumped on the
> > problem.
>
> > I was working on a static ad system. The ads are listed in an array
> > and I would shuffle() the array and then output the first index as the
> > current ad for that request. It works fine locally but online it does
> > not. So then I tried using rand(), same problem.
>
> > I also noticed on the homepagehttp://www.gamesync.com/theAction,
> > RPG, etc tabs are always on the same tab, but should also be
> > randomizing with rand(), yet are not. But they work locally.
>
> > I really have no idea why the randomizing functions work locally but
> > not online. Is there some sort of setting or hidden cache function I
> > don't know about, can anyone enlighten me?
--~--~-~--~~~---~--~~
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: Containable - Deep Associations - Sort resulting array

2009-08-03 Thread JamesF


On Aug 3, 4:42 pm, pomares  wrote:
> I would like a select menu filled with clients sorted by advancement
> category. Here are the models
> Client belongsTo Family
add an order field to your find array, not in any of the contain sub-
arrays.

ie

'order'=>'AdvancementCategory.id ASC'

you also add order fields within your 'contain' sub arrays to sort
that subset within your larger dataset

> Family belongsTo Advancement (i.e. status)
> Advancement belongsTo AdvancementCategory.
>
> My code:
>
> function clientList() {
>         return $this->Client->find('all', array(
>                                                         'fields' => array(
>                                                                         'id',
>                                                                         
> 'firstname',
>                                                                         
> 'lastname',
>                                                                         
> 'family_id'),
>                                                         'contain' => array(
>                                                                         
> 'Family' => array(
>                                                                               
>           'fields' =>array(
>                                                                               
>                           'id',
>                                                                               
>                           'advancement_id'),
>                                                                               
>           'Advancement' => array(
>                                                                               
>                           'fields' =>array(
>                                                                               
>                                           'id',
>                                                                               
>                                           'advancement_category_id'),
>                                                                               
>                           'AdvancementCategory' => array(
>                                                                               
>                                           'fields' => array(
>                                                                               
>                                                           'id',
>                                                                               
>                                                           'name')
>                                                         ));
>         }
>
> Again, I would like the resulting array to be sorted by
> AdvancementCategory.id.
>
> How do I do that?
--~--~-~--~~~---~--~~
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: Containable - Deep Associations - Sort resulting array

2009-08-03 Thread JamesF
function clientList() {
return $this->Client->find('all', array(
'fields' =>
array(
 
'id',
 
'firstname',
 
'lastname',
 
'family_id'),
'contain' =>
array(
 
'Family' => array(
 
'fields' =>array(
 
'id',
 
'advancement_id'),
 
'Advancement' => array(
 
'fields' =>array(
 
'id',
 
'advancement_category_id'),
 
'AdvancementCategory' => array(
 
'fields' => array(
 
'id',
 
'name')
 
'order'=>array('AdvancementCategory.id ASC'),
));
}

On Aug 3, 4:42 pm, pomares  wrote:
> I would like a select menu filled with clients sorted by advancement
> category. Here are the models
> Client belongsTo Family
> Family belongsTo Advancement (i.e. status)
> Advancement belongsTo AdvancementCategory.
>
> My code:
>
> function clientList() {
>         return $this->Client->find('all', array(
>                                                         'fields' => array(
>                                                                         'id',
>                                                                         
> 'firstname',
>                                                                         
> 'lastname',
>                                                                         
> 'family_id'),
>                                                         'contain' => array(
>                                                                         
> 'Family' => array(
>                                                                               
>           'fields' =>array(
>                                                                               
>                           'id',
>                                                                               
>                           'advancement_id'),
>                                                                               
>           'Advancement' => array(
>                                                                               
>                           'fields' =>array(
>                                                                               
>                                           'id',
>                                                                               
>                                           'advancement_category_id'),
>                                                                               
>                           'AdvancementCategory' => array(
>                                                                               
>                                           'fields' => array(
>                                                                               
>                                                           'id',
>                                                                               
>                                                           'name')
>                                                         ));
>         }
>
> Again, I would like the resulting array to be sorted by
> AdvancementCategory.id.
>
> How do I do that?
--~--~-~--~~~---~--~~
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: Release: 1.2.4 and 1.3-dev

2009-08-03 Thread JamesF

https://trac.cakephp.org/wiki/changelog/1.2.x.x

getting a error trying to load this page

Secure Connection Failed

trac.cakephp.org uses an invalid security certificate.

The certificate expired on 8/3/2009 12:05.

(Error code: sec_error_expired_certificate)

On Aug 3, 6:58 pm, Gwoo  wrote:
> The CakePHP development team is happy to announce the release of two
> new versions. Firstly, CakePHP 1.2.4[1] is a bug fix release of the
> latest stable branch. Check the changelog[2] for all the changes.
> Also, we have made CakePHP 1.3.0-dev[3] available for download.
>
> CakePHP 1.2 includes more than 100 commits along with over 70 bug
> fixes.
>
> CakePHP 1.3 dev includes many new enhancements and some optimizations.
> The most notable changes include
>         - compatibility changes have been added for PHP 5.3.
>         - new Javascript Helper including support for multiple js libraries
>         - improved bake code generation with better support for plugins and
> templates
>
> Checkout the 1.3 changelog[4], 1.3 migration guide[5] and 1.3 hit list
> for some more ideas.
>
> As well as these changes to the code, we have some other changes to
> the project.
>
> - We completed our move to git and opened uphttp://code.cakephp.org,
> which uses the latest version of 1.3, as the new home for all
> developments related to CakePHP. The old development site at
> trac.cakephp.org will continue to exist for legacy purposes, however,
> you will not be able to create new tickets. If you have any new issues
> on 1.2 or find problems with 1.3, please gotohttp://code.cakephp.org/tickets.
>
> - With the move to git, you will see lots of branches and might wonder
> which ones to use.
>  - master: latest stable, 1.2.4.8284
>  - 1.2: development branch for bug fixes
>  - 1.3: development branch for new features
>
> There are several other branches, but those are for specific feature
> development and may not be stable. Feel free to fork the project and
> work on code as you need it. We can pull changes in from your fork and
> we have actually already done this a few times.
>
> - We have some changes to the CakePHP job board, located 
> athttp://cakephp.org/jobs. We received this message from
> EliteOpenSourceJobs.
>
> "We'd like to thank everyone who has posted jobs on or visited our job
> board.  After many months of having our boards up on several
> communities (including Cake) and with a great a deal of feedback from
> communities, we have decided to make the job board free to post.  We
> think this will be much better for everyone, as there will be more
> postings for developers, and will make it even more apparent that
> there are real opportunities for those who know Cake.
>
> We hope everyone will visit cakephp.org/jobs frequently in the near
> future, as there are more opportunities than ever on the board.  We
> also hope that if you are looking for developers, you will consider
> the Cake board first.
>
> You can also support the community by posting a job widget on your
> site.  This will help companies who want to find use Cake find great
> developers fast.  Just sign up 
> at:http://eliteopensourcejobs.com/affiliates/register
> and we'll get you a snippet right away.  It takes less than a minute
> to sign up."
>
> [1]http://cakeforge.org/frs/?group_id=23&release_id=447
> [2]https://trac.cakephp.org/wiki/changelog/1.2.x.x
> [3]http://cakeforge.org/frs/?group_id=23&release_id=448
> [4]http://code.cakephp.org/wiki/1.3/changelog
> [5]http://code.cakephp.org/wiki/1.3/migration-guide
> [6]http://code.cakephp.org/wiki/1.3/Hit_List
--~--~-~--~~~---~--~~
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: Free Cake Ebook : How to build your own blog from scratch

2009-07-31 Thread JamesF

how is wikipedia a source? did wikipedia do any research? any
statistics gained from wikipedia were cited from some other source.
the source is the original cited study/article/whatever.
wikipedia is great for general infomation but i can tell you that i
personally see innaccuracies, biases, and otherwise unprovable/non-
factual claims mentioned in many articles.

please take wikipedia for what it is, an aggregator of "sources",
subject to editorialization.

On Jul 30, 9:50 pm, "j0n4s.h4rtm...@googlemail.com"
 wrote:
> Can't you all be a little nicer towards each other? :/
>
> Its great to have non-English tutorials around. There is not non-
> English group. It would make sense to prefix your initial posting with
> [lang] or [lang-LANG] - that way it won't disturb others.
> I mostly disagree with euromark. One thing he mentions is very
> important though: You can contribute to the cake manual right here in
> the language of your choice.http://book.cakephp.org/view/527/Translations
> be aware that you should add to the English version what misses
> completely and then translate that to your mother language as well.
>
> Plus: Wikipedia is a source.
--~--~-~--~~~---~--~~
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: Need advice/tips for sending mass emails with CakePHP

2009-07-31 Thread JamesF

well if you are sending 1 milllion emails a month, it will cost you
$5000. we are willing to do some extra work to at least try and do it
ourselves.
domain keys are pretty easy to set up as long as you send with SMTP
and the same thing goes with SPF records. Unsubscribe functions can be
as simple as the person clicking a link that roues to a controller
action with their email in a hash as a parameter. just like
activation.

White lists with ISPs, Distributed delivery, SSC and feedback loops
are things i honestly could use more info about.

On Jul 31, 8:25 am, Lucas Costa  wrote:
> Hi, I've been researching a bit with the same pupose but teknoid in
> the IRC channel tipped me that unless I was building a complete mass
> mailing solution and all the "stuff" that comes with it, it would be
> better to hire an existing service.
>
> Then I said what would "stuff" be and here is his response:
>
> "handling of bounces/unsubsribes DKIM/Domain-keys, white lists
> with ISP's, SPF records, distributed email delivery, SSC, feedback
> loops, ehh.. what elese?"
>
> If you have thoughts about it let us know.
>
> On Jul 30, 12:45 pm, JamesF  wrote:
>
>
>
> > for anyone following this topic...i found a post with a bit more
> > information:
>
> >http://forums.devnetwork.net/viewtopic.php?f=52&t=68497
>
> > basically discussed send bulk emails with swiftmailer via CRON
>
> > On Jul 30, 11:23 am, JamesF  wrote:
>
> > > i would love to use cakes native email component and whip something up
> > > from the shell but it might be like treading water to get it to work
> > > for 5000 emails a day.
>
> > > On Jul 30, 8:46 am, brian  wrote:
>
> > > > On Thu, Jul 30, 2009 at 4:36 AM, Grzegorz
>
> > > > Pawlik wrote:
>
> > > > > Why using vendor when cake (1.2) have native email component?
>
> > > > Unlike Cake's EmailComponent, the SwiftMailer package includes a
> > > > couple of plugins, AntiFlood & Throttler, that are meant for use in
> > > > situations where there are *many* emails to be sent. Without it, one's
> > > > PHP app would simply dump [many] emails at once on the MTA, which
> > > > isn't a great idea if one doesn't want to stress one's MTA more than
> > > > it is already. And, for people using hosted accounts, that's not
> > > > likely to be an option.- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HABTM search custom query

2009-07-30 Thread JamesF

you need to set the conditions for your query in the $paginate
variable.

$this->paginate = array('whatever models and conditions array')

http://book.cakephp.org/view/249/Custom-Query-Pagination


On Jul 30, 4:48 pm, cookiebaker  wrote:
> Hi,
>  This is my first post and please forgive me if this question is
> already answered. I building a business directory and I encounter a
> problem when searching using paginate.
> This is my simplified database design
> sections ( id, name)
> categories_sections(category_id, section_id)
> categories (id, name, keywords)
> businesses_categories (business_id, category_id);
> businesses (id, name, phone, ..., keywords)
> I want to do a keyword search, it should search the following fields
> businesses.name, businesses.keywords, categories.name and
> categories.keywords for match
> e.g: Business.name LIKE '%$searchTerm%' OR Business.keywords LIKE '%
> $searchTerm%' OR Category.name LIKE '%$searchTerm%' Category.keywords
> LIKE '%$searchTerm%'
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



EmailComponent & DomainKeys - SPF Records - Not Working -Solution-

2009-07-30 Thread JamesF

Hey all I just wanted to share how i got DomainKeys and SPF records to
work with CakePHP's EmailComponent.

The first prerequisite was to obviously enable SPF record and
DomainKeys from cpanel.
(actually i used /usr/local/cpanel/bin/install_domain_keys_installer
myusername (from bash shell))

that was actually a no brainer. the problem was my email headers from
EmailComponent were not authenticating properly, missing DomainKeys
entirely and SPF record returned neutral.

i sent a few test messages from Horde and the DomainKeys and SPF
records were there (after a restart of the exim mail service on my
server).

So why wasn't EmailComponent playing nice?

you need to set the delivery variable in $Email object to:

$this->Email->delivery = 'smtp';

lo and behold everything worked after that. after looking at
EmailComponent more deeply i realized that by default it uses PHP's
mail() function which does not support Domain Keys (or so i believe).

I truly hope this saves someone of few hours.

--~--~-~--~~~---~--~~
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: executing no realtionship tables

2009-07-30 Thread JamesF

you still should set up a Model for your table. there are a number of
methods for working with your data, like var $uses, bindModel, etc

this should get you started:

http://book.cakephp.org/view/86/Creating-and-Destroying-Associations-on-the-Fly

On Jul 30, 4:22 pm, abhishekh  wrote:
> Hi, I have some static tables in my database. they have no relationship with
> any other tables. That table store read only data. How do I fetch data from
> that table, without writing any custom query, from any model.?
> --
> View this message in 
> context:http://www.nabble.com/executing-no-realtionship-tables-tp24746659p247...
> Sent from the CakePHP mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Free Cake Ebook : How to build your own blog from scratch

2009-07-30 Thread JamesF

(source: Wikipedia)

not a source

On Jul 30, 4:43 am, leop  wrote:
> > i dont think a lot of people are able to read that - or know the
> > language at all
> > i wonder... why not using ENGLISH in the first place?
>
> I can only assume you made this comment to raise some hackles. While
> we're at it why don't we just abolish German (I assume that's your
> first language)?
>
> Malay is the official language in Brunei, Malaysia, Singapore and is
> native to Malaysia, Indonesia, Thailand. There are also significant
> communities in Australia & Bahrain (source: Wikipedia).
>
> There are plenty of tutorials in English and tutorials in other
> languages are always welcome.
--~--~-~--~~~---~--~~
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: Vendors handling with js/css script packages without breaking their file structure

2009-07-30 Thread JamesF

use the .htaccess in your webroot to create the alias then

On Jul 30, 1:16 pm, Christian  wrote:
> yes, that Apache alias should work,
>
> but I wanted to modify in cakephp only. Maybe for the next project I
> can use this.
>
> Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Efficient ways to retrieve data from models with high association depth

2009-07-30 Thread JamesF

have you tried using Containable behavior?

On Jul 30, 12:16 pm, Roel  wrote:
> Hi,
>
> I'm using CakePHP for quite some time now and I really love it, but I
> hadn't come around to make use of the complex association
> possibilities for models. So I started to play around with them for a
> personal project I just started. Although the advantages Cake offers
> are numerous, I stumbled across an issue I'm not happy about. It's not
> a bug but an effciency issue.
>
> Let's say we have three models: Article, Comment, and User. The
> relationships are as follows: Article hasMany Comment, Comment hasOne
> User. Now when the data for Article is retrieved, a nice JOIN query is
> used to fetch the Comment data together with the Article data, but a
> seperate query is made for each User instead of using a nice JOIN
> statement.
>
> Now I know this is a known issue (https://trac.cakephp.org/ticket/
> 2931) and I understand why the resolution is set to 'wont fix', but I
> wondered how other people worked around this or maybe didn't even
> bother. Truth is, in this specific case of my personal project it
> doesn't even matter that much. It doesn't need to serve thousands
> users. But it bothers me that Cake, which first enabled me to
> elegantly develop applications fast, now kinda shows it's dirty side.
>
> So what are your thoughts about retrieving data efficiently with Cake?
--~--~-~--~~~---~--~~
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: Need advice/tips for sending mass emails with CakePHP

2009-07-30 Thread JamesF

for anyone following this topic...i found a post with a bit more
information:

http://forums.devnetwork.net/viewtopic.php?f=52&t=68497

basically discussed send bulk emails with swiftmailer via CRON

On Jul 30, 11:23 am, JamesF  wrote:
> i would love to use cakes native email component and whip something up
> from the shell but it might be like treading water to get it to work
> for 5000 emails a day.
>
> On Jul 30, 8:46 am, brian  wrote:
>
>
>
> > On Thu, Jul 30, 2009 at 4:36 AM, Grzegorz
>
> > Pawlik wrote:
>
> > > Why using vendor when cake (1.2) have native email component?
>
> > Unlike Cake's EmailComponent, the SwiftMailer package includes a
> > couple of plugins, AntiFlood & Throttler, that are meant for use in
> > situations where there are *many* emails to be sent. Without it, one's
> > PHP app would simply dump [many] emails at once on the MTA, which
> > isn't a great idea if one doesn't want to stress one's MTA more than
> > it is already. And, for people using hosted accounts, that's not
> > likely to be an option.- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to modify the URLs of $paginator->numbers

2009-07-30 Thread JamesF

doh!

On Jul 30, 4:52 am, jordicakephp  wrote:
> Thanks a lot for your reply, JamesF. :-D
>
> I had written this in my routes.php:
>
> Router::connect('/countries/france/list', array('controller' =>
> 'france', 'action' => 'list'));
>
> Insted of:
>
> Router::connect('/countries/france/list/*', array('controller' =>
> 'france', 'action' => 'list'));
>
> Regards.
>
> I forgot to write the "*" in:
>
> On 30 jul, 07:24, JamesF  wrote:
>
> > in your routes config
>
> > //put this after your defined routes so the router knows you are
> > passing page numbers like /url/page:2 /url/page:3 etc
> > Router::connectNamed(array('page'));
>
> > if you do not specify this your paginated urls will default to /
> > controller/action
> > instead of your fancy route.
>
> > might want to very your fancy route works normally by testing it in
> > the view
>
> > echo $html->link('test link', array('controller' =>'france', 'action'
> > => 'list'));
>
> > should outputwww.myCakePHPApp.com/countries/europe/france/list
> > if your route is set up right in the first place
>
> > best of luck
>
> > On Jul 29, 4:38 am, jordicakephp  wrote:
>
> > > Good morning everybody,
>
> > > I've organized my controllers in a manner similar to the following:
>
> > > /countries
> > >         /africa
> > >         /america
> > >         /europe
> > >                 /france
> > >                 /italy
> > >                 /spain
>
> > > And I've created them in their respective folders. Consequently, I've
> > > also configured my routes.php file, writing many lines. Like these:
>
> > > Router::connect('/countries/europe/france/list', array('controller' =>
> > > 'france', 'action' => 'list'));
>
> > > However, when I use $paginator->numbers and paginate France, the
> > > numbers that the application displays lead to URLs of this type:
>
> > >www.myCakePHPApp.com/france/list
>
> > > But I would like the numbers to lead to URLs 
> > > likewww.myCakePHPApp.com/countries/europe/france/list, as I've configured
> > > in routes.php.
>
> > > What must I do to change the way Cake associates the URLs to the
> > > numbers displayed by $paginator->numbers?
>
> > > Thanks a lot in advance!, my dear baker friends.- Ocultar texto de la 
> > > cita -
>
> > - Mostrar texto de la cita -
--~--~-~--~~~---~--~~
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: Vendors handling with js/css script packages without breaking their file structure

2009-07-30 Thread JamesF

or ../../vendors/
not sure myself but the point is you could do it this way

On Jul 30, 11:25 am, JamesF  wrote:
> you could set up an apache alias to your app/vendors directory at
> mysite.com/vendors
> and link to css like this
> echo $html->css('/vendors/mystyle.css', NULL, NULL, false);
>
> same would work for javascript
>
> On Jul 30, 4:24 am, Christian  wrote:
>
> > Okay. Understood. Thanks!
>
> > It works like all of you suggested to put all files in one directory
> > under webroot (e.g. webroot/js/syntaxhighlighter/) and then use
>
> > $html->css('../js/syntaxhighlighter/styles/shCore', null, null,
> > false);
> > $javascript->link('syntaxhighlighter/scripts/shCore', false);
>
> > I started and hoped that I can reuse such complete packages better by
> > locating it in vendors ... but that seems to be impossible. What if I
> > have a package which consists of a PHP class, JS and CSS plus images.
> > Do I have to move JS, CSS and images to webroot and keep the php class
> > in a vendor directory? According to your answers I assume yes ... not
> > really perfect in my eyes .. but I understand that it can get very
> > complex if vendors is not available for the webserver to show as
> > webroot is the only public area ...
>
> > Thank you so far.
> > Christian
--~--~-~--~~~---~--~~
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: Vendors handling with js/css script packages without breaking their file structure

2009-07-30 Thread JamesF

you could set up an apache alias to your app/vendors directory at
mysite.com/vendors
and link to css like this
echo $html->css('/vendors/mystyle.css', NULL, NULL, false);

same would work for javascript

On Jul 30, 4:24 am, Christian  wrote:
> Okay. Understood. Thanks!
>
> It works like all of you suggested to put all files in one directory
> under webroot (e.g. webroot/js/syntaxhighlighter/) and then use
>
> $html->css('../js/syntaxhighlighter/styles/shCore', null, null,
> false);
> $javascript->link('syntaxhighlighter/scripts/shCore', false);
>
> I started and hoped that I can reuse such complete packages better by
> locating it in vendors ... but that seems to be impossible. What if I
> have a package which consists of a PHP class, JS and CSS plus images.
> Do I have to move JS, CSS and images to webroot and keep the php class
> in a vendor directory? According to your answers I assume yes ... not
> really perfect in my eyes .. but I understand that it can get very
> complex if vendors is not available for the webserver to show as
> webroot is the only public area ...
>
> Thank you so far.
> Christian
--~--~-~--~~~---~--~~
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: Need advice/tips for sending mass emails with CakePHP

2009-07-30 Thread JamesF

i would love to use cakes native email component and whip something up
from the shell but it might be like treading water to get it to work
for 5000 emails a day.

On Jul 30, 8:46 am, brian  wrote:
> On Thu, Jul 30, 2009 at 4:36 AM, Grzegorz
>
> Pawlik wrote:
>
> > Why using vendor when cake (1.2) have native email component?
>
> Unlike Cake's EmailComponent, the SwiftMailer package includes a
> couple of plugins, AntiFlood & Throttler, that are meant for use in
> situations where there are *many* emails to be sent. Without it, one's
> PHP app would simply dump [many] emails at once on the MTA, which
> isn't a great idea if one doesn't want to stress one's MTA more than
> it is already. And, for people using hosted accounts, that's not
> likely to be an option.
--~--~-~--~~~---~--~~
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: retrieving data from hasMany configuration

2009-07-30 Thread JamesF

seconded

On Jul 30, 8:16 am, brian  wrote:
> In addition to what James suggested, you should modify the Comment class:
>
> class Comment extends AppModel {
>    var $name = 'Comment';
>
>    var $belongsTo = array('User');
>
> }
>
> And give the comments table a user_id column (to match the type of users.id).
>
> On Thu, Jul 30, 2009 at 1:02 AM, Veoempleo wrote:
>
> > Hello,
>
> > I have a question after reading model developing.
>
> > I have two models, user that has many comments. I define:
>
> > 
> > class User extends AppModel {
> >    var $name = 'User';
> >    var $hasMany = 'Comment';
> > }
> > ?>
>
> > 
> > class Comment extends AppModel {
> >    var $name = 'Comment';
> > }
> > ?>
>
> > From Comment controller, How I could retrieve User information from
> > Comment row?
--~--~-~--~~~---~--~~
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: AJAX implementation with cakePHP (jquery preferred)

2009-07-30 Thread JamesF

i just use jquery's .load and and other ajax functions

all i do is include jquery in my layout. i personally don't use the
ajax helper.  it comes down to rendering your ajax data views without
a layout, using jquery to load the results.

ex. i need to get a list of users. in my view i call .load(http://
mysite.com/users/getList/) . the users controller has a
function called get list that takes $id as a parameter and runs a find
call on the users table. it then passes that data off to the view for
users/getList. in the controller i specify to use ajax layout (which
basically means plaintext).

there are several examples of using jquery with cakephp but until
version 1.3 comes out with it's jquery friendly javascript/ajax helper
i stick to doing it like this.

On Jul 30, 9:25 am, matalina  wrote:
> I have a basic application created.  I have a list of categories, a
> list of items that can be part of only one category, and a list of
> these items.  Currently the application requires that you create the
> list, and then you would add each item to the list through a separate
> interface. (at least that's how the base seems to have been baked).
>
> I want to create my list, add the items to the list before ever
> sending and storing any information in the database.  I have done this
> particular application outside of cake and to make a list as long as I
> want I used jQuery to help me with my ajax calls.
>
> While I could easily do this the way I had originally but I'm pretty
> sure this breaks the MVC model of cakephp so I'm hoping someone can
> tell me how ajax works with cakephp? Where are the files kept that the
> ajax call would run with out a page refresh? How do I access these
> files?
>
> The basic function I want is.
>
> Fill in the basic list information - namely the name and then click a
> button that brings up a drop down menu for the list of items.  Choose
> an item, add the quantity required and then click the button again to
> add another item, until you are finished creating your list.  Then
> when all your items are added click the submit button and send, verify
> and store the data in the database.
>
> I don't want to break the model so I'm hoping I can do what I want
> with in cakephp but I need some assistance as to how to implement this
> type of ajax feature with in the model.
>
> Thanks for your help in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using mod_rewrite without .htaccess overhead (quick solution)

2009-07-29 Thread JamesF

i would be interested in seeing the gains for this too. only problem
is you need access to http.conf which might destroy the portability of
your app if you plan to distribute it. still if you are talking about
a server the serves 2 visitors a day maybe the gains are worth it.
i actually might try this myself for fun.

On Jul 19, 7:32 pm, brian  wrote:
> If Apache sees an .htaccess file, it will then look for one in every
> subdirectory, so there's *some* overhead. For this reason, if you
> control the server, you're *somewhat* better off putting the rewrite
> stuff in your httpd.conf (or vhost.conf, etc.) and doing without any
> .htaccess files at all.
>
> On Sun, Jul 19, 2009 at 4:21 PM, Carlos Lavin wrote:
> > Does anyone know how much this "overhead" really represents?
>
> > 2009/7/19 Enrique 
>
> >> Hi Cake Fans,
>
> >> just a quick note on how to use CakePHP with mod_rewrite but without
> >> the unnecessary .htaccess overhead:
>
> >>http://www.creative-outsourcing.com/cakephp-using-mod_rewrite-without...
>
> >> - Enrique
--~--~-~--~~~---~--~~
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 a 404 with Media View

2009-07-29 Thread JamesF

well let us know what you come up with it may help someone in the
future

On Jul 29, 9:49 am, Stinkbug  wrote:
> Thanks for the tips guys.  I'll have to do these tests late at night
> since it's on a production box.  Since I'm using CakePHP I haven't
> messed with the .htaccess files.  They are what comes with Cake.  The
> permissions on the directory is chmod 777.  the owner and groups are
> root.data, the same as our test box and it works fine there.  The
> files in the directory are wwwrun.www, which is the apache user I
> guess.
>
> My files directory is actually outside of the app directory.  I wanted
> to set it up this way for deployment reasons.  So with the debug
> information on my local windows box, I get something like this:
>
> C:\wamp\www\intranet\app\../files\filename.pdf
>
> which I thought was a bit odd, but it still works.
>
> On our test linux box I got something like this.
>
> /srv/www/vhosts/intranet/app/../files/filename.pdf
>
> and it works fine.  I'm leaning towards some sort of config problem,
> whether it's permissions or something in apache.  It's just odd to me
> that it would work fine on my local box and the test server, but not
> on production.  I'll check the debug stuff on production tonight
> probably.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to modify the URLs of $paginator->numbers

2009-07-29 Thread JamesF

in your routes config

//put this after your defined routes so the router knows you are
passing page numbers like /url/page:2 /url/page:3 etc
Router::connectNamed(array('page'));

if you do not specify this your paginated urls will default to /
controller/action
instead of your fancy route.

might want to very your fancy route works normally by testing it in
the view

echo $html->link('test link', array('controller' =>'france', 'action'
=> 'list'));

should output www.myCakePHPApp.com/countries/europe/france/list
if your route is set up right in the first place

best of luck




On Jul 29, 4:38 am, jordicakephp  wrote:
> Good morning everybody,
>
> I've organized my controllers in a manner similar to the following:
>
> /countries
>         /africa
>         /america
>         /europe
>                 /france
>                 /italy
>                 /spain
>
> And I've created them in their respective folders. Consequently, I've
> also configured my routes.php file, writing many lines. Like these:
>
> Router::connect('/countries/europe/france/list', array('controller' =>
> 'france', 'action' => 'list'));
>
> However, when I use $paginator->numbers and paginate France, the
> numbers that the application displays lead to URLs of this type:
>
> www.myCakePHPApp.com/france/list
>
> But I would like the numbers to lead to URLs 
> likewww.myCakePHPApp.com/countries/europe/france/list, as I've configured
> in routes.php.
>
> What must I do to change the way Cake associates the URLs to the
> numbers displayed by $paginator->numbers?
>
> Thanks a lot in advance!, my dear baker friends.
--~--~-~--~~~---~--~~
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: Cannot find controllers

2009-07-29 Thread JamesF

please post the contents of your index.php file from your webroot

my guess is your paths are not correctly set up


On Jul 29, 11:19 pm, Sarah  wrote:
> Missing Controller
>
> Error: UsersController could not be found.
>
> Error: Create the class UsersController below in file: oldcake/
> controllers/users_controller.php
>
>  class UsersController extends AppController {
>
>         var $name = 'Users';}
>
> ?>
>
> On Jul 29, 7:55 pm, JamesF  wrote:
>
> > what is the exact error message you are getting?
>
> > On Jul 29, 9:43 pm, Sarah  wrote:
>
> > > I noticed that cakephp is looking for controllers in the cake folder
> > > (instead of the app folder), I think this is the problem, but I don't
> > > know how to fix it.  :(
>
> > > On Jul 29, 5:41 pm, Sarah  wrote:
>
> > > > I was trying to add Acl to my application (following with the Sample
> > > > in the Cookbook Manual).
>
> > > > Now when I try to visit my views, they say that their respective
> > > > controller cannot be found, and it suggests that I make a controller.
> > > > However, I know my controllers exist (and are in the correct
> > > > location).
>
> > > > Any suggestions as to what I may have done incorrectly?
>
> > > > Thanks,
> > > > ~Sarah

--~--~-~--~~~---~--~~
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: retrieving data from hasMany configuration

2009-07-29 Thread JamesF

you might have to specify fields like User.first_name etc in your find
() call.

On Jul 30, 1:16 am, JamesF  wrote:
> //find users from comments controller
> $this->Comment->Behaviors->attach('Containable');
> $this->Comment->contain('User');
> $comment = $this->Comment->find('first', array('conditions'=>array
> ('Comment.id'=>$comment_id)));
>
> this will find a $comment and return the comment and user data
> associated with the comment
>
> On Jul 30, 1:02 am, Veoempleo  wrote:
>
> > Hello,
>
> > I have a question after reading model developing.
>
> > I have two models, user that has many comments. I define:
>
> > 
> > class User extends AppModel {
> >     var $name = 'User';
> >     var $hasMany = 'Comment';}
>
> > ?>
>
> > 
> > class Comment extends AppModel {
> >     var $name = 'Comment';}
>
> > ?>
>
> > From Comment controller, How I could retrieve User information from
> > Comment row?
--~--~-~--~~~---~--~~
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: retrieving data from hasMany configuration

2009-07-29 Thread JamesF

//find users from comments controller
$this->Comment->Behaviors->attach('Containable');
$this->Comment->contain('User');
$comment = $this->Comment->find('first', array('conditions'=>array
('Comment.id'=>$comment_id)));

this will find a $comment and return the comment and user data
associated with the comment

On Jul 30, 1:02 am, Veoempleo  wrote:
> Hello,
>
> I have a question after reading model developing.
>
> I have two models, user that has many comments. I define:
>
> 
> class User extends AppModel {
>     var $name = 'User';
>     var $hasMany = 'Comment';}
>
> ?>
>
> 
> class Comment extends AppModel {
>     var $name = 'Comment';}
>
> ?>
>
> From Comment controller, How I could retrieve User information from
> Comment row?
--~--~-~--~~~---~--~~
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: Need advice/tips for sending mass emails with CakePHP

2009-07-29 Thread JamesF

that's a good start, i am still trying to get a picture of how it will
work together. thanks


On Jul 29, 11:46 pm, brian  wrote:
> On Wed, Jul 29, 2009 at 11:46 PM, brian wrote:
> > Have a look at SwiftMailer. Specifically, the AntiFlood plugin.
>
> >http://swiftmailer.org/
>
> > I've posted my component for it here (update of Wouter Verweirder's
> > update of othman's version):
>
> >http://bin.cakephp.org/view/591921675
>
> I should have mentioned that you'd install SwiftMailer in the vendors dir.
--~--~-~--~~~---~--~~
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: Sortable using jQuery help

2009-07-29 Thread JamesF

you might need to use the full base path in your ajax request

.post('http://mysite.com/entries/order/')

i ran into a similar problem using .load()

you can break into your code like this:

 $("#sortable").sortable({
 update: function() {
 $.post('/entries/order/
0/', $('.li').sortable("serialize", {key:
 'li[]'}))
 }

});

On Jul 29, 7:50 pm, "Dave Maharaj :: WidePixels.com"
 wrote:
> Has anyone implemented the sortable feature using jQuery UI?
>
> I found this 
> onlinehttp://stackoverflow.com/questions/955438/jquery-sortable-in-cakephp-...
> t-ajax-part
>
> I  have the sorting part working but its not firing the ajax request to
> update the order.
>
> $("#sortable").sortable({
>     update: function() {
>         $.post('/entries/order/0/', $('.li').sortable("serialize", {key:
> 'li[]'}))
>     }
>
> });
>
> Ideas?
>
> Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cannot find controllers

2009-07-29 Thread JamesF

what is the exact error message you are getting?

On Jul 29, 9:43 pm, Sarah  wrote:
> I noticed that cakephp is looking for controllers in the cake folder
> (instead of the app folder), I think this is the problem, but I don't
> know how to fix it.  :(
>
> On Jul 29, 5:41 pm, Sarah  wrote:
>
> > I was trying to add Acl to my application (following with the Sample
> > in the Cookbook Manual).
>
> > Now when I try to visit my views, they say that their respective
> > controller cannot be found, and it suggests that I make a controller.
> > However, I know my controllers exist (and are in the correct
> > location).
>
> > Any suggestions as to what I may have done incorrectly?
>
> > Thanks,
> > ~Sarah
--~--~-~--~~~---~--~~
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: Vendors handling with js/css script packages without breaking their file structure

2009-07-29 Thread JamesF

you don't need to use vendors unless you are including php files.

put the js in your /public_html/js
the the css in your /public_html/css

in your layout:
if your css was located in /public_html/css/mycss/mycss-file.css
you would use
css('mycss/mycss-file'); //no extension ?>

if you wanted to include jquery and it was in
/public_html/js/jquery/jquery-1.3.2.min.js

link('jquery/jquery-1.3.2.min.js', false); //
no extension ?>


the way i showed you assumes js in the public_html/js folder and css
in the public_html/css folder

but you can point to any subdirectory in your webroot by using /path/
filename/ or even ../../path/filename or whatever path works for you.

On Jul 29, 4:45 pm, Christian  wrote:
> Addon: I am using mod_rewrite ...
--~--~-~--~~~---~--~~
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: $html->image()

2009-07-29 Thread JamesF

ahem...

helpers are for use in views. $html->image() is calling the image()
function of the html helper.

http://book.cakephp.org/view/205/HTML
The HtmlHelper is available in all views by default. If you're getting
an error informing you that it isn't there, it's usually due to its
name being missing from a manually configured $helpers controller
variable.

but why are you trying to output an image from your controller?

On Jul 29, 12:20 pm, Vijay Kumbhar  wrote:
> Hello Brian,
>
> You are right,but if you are facing this problem every time then better  way
> to put this code in the app_controller.php.
>
>
>
> On Wed, Jul 29, 2009 at 9:29 PM, brian  wrote:
>
> > in your controller:
>
> > public $helpers = array('Html');
>
> > On Wed, Jul 29, 2009 at 2:51 AM, Jogi Silalahi wrote:
>
> > > Hai,
>
> > > i try to display image in my controller :
> > >  echo $html->image("header.jpg");
>
> > > but the image cannot display, it's like my $html undefined.
> > > here the error :
> > > Notice (8): Undefined variable: html
> > > [APP\controllers\articles_controller.php, line 12]
> > > Fatal error: Call to a member function image() on a non-object in
> > > C:\AppServ\www\bv\app\controllers\articles_controller.php on line 12
>
> > > anyone can help me?
>
> > > thanks before.
>
> > > regards,
>
> > > --
> > > - Jogi Henra Ersa Silalahi -
>
> --
> Thanks & Regards,
> Vijayk.
> Co-founder (www.weboniselab.com)
>
> "You Bring the Dreams, We'll Bring the Means"
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP array structure on a HABTM

2009-07-29 Thread JamesF

$this->Country->Behaviors->attach('Containable');

$this->Country->find('all', array('contain' => array(
'CountriesNetwork' => array(
'fields' => array('CountriesNetwork.id',
'CountriesNetwork.network_id'),
'conditions'=>array
('MySpecialCountriesNetworkConditionsExample'=>true),
),
'conditions'=>array(''Country.id'=>123456),
)));

http://book.cakephp.org/view/474/Containable

On Jul 29, 7:32 am, Chris  wrote:
> I have two tables: countries and networks, linked via a HABTM using
> countriesNetwork lookup table.
>
> I want to perform a query ob the countries table to get all
> Country.countryName rows, but each country needs to  have an array of
> CountriesNetwork.network_id too. Something like this:
>
> I have two tables linked via a HABTM. countries & networks. They are
> linked together by the countries_networks lookup table.
>
> I need to get all of the countries and all of the associated network
> ids for each corresponding country. I don't need to go as far as
> getting the network names, simply getting the ids from the lookup
> table will suffice.
>
> If I do a find(all) it gives me an array of countries but not in the
> structure that I need. I need to return something link this, but I
> only need Country.countryName and CountriesNetwork.network_id:
>
> Array
> (
>     [0] => Array
>         (
>             [Country] => Array
>                 (
>                     [countryName] => France
>                 )
>             [CountriesNetwork] => Array
>                 (
>                     [0] => Array
>                                (
>                                     [id] => 1
>                                     [network_id] => 1
>                                 )
>                     [1] => Array
>                                (
>                                     [id] => 2
>                                     [network_id] => 7
>                                 )
>                  )
>          )
> )
>
> I've been struggling with find all and I've tried a custom query using
> a join, but it results in lots of duplicate countries. I just want the
> country name along with an array of network_id's. ( I could go as far
> as getting the network name from the network table if its easier.)
>
> I've even tried using unbind and bind to change my associations, but I
> haven't had much look there:http://pastebin.com/m1cca9e77
>
> Can someone possibly help me on this? I know it will be one of those
> 'aah i see' moments. 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP array structure on a HABTM

2009-07-29 Thread JamesF

$this->Country->Behaviors->attach('Containable');

$this->Country->find('all', array('contain' => array(
'CountriesNetwork' => array(
'fields' => array('CountriesNetwork.id',
'CountriesNetwork.network_id'),
)
)));

http://book.cakephp.org/view/474/Containable

On Jul 29, 7:32 am, Chris  wrote:
> I have two tables: countries and networks, linked via a HABTM using
> countriesNetwork lookup table.
>
> I want to perform a query ob the countries table to get all
> Country.countryName rows, but each country needs to  have an array of
> CountriesNetwork.network_id too. Something like this:
>
> I have two tables linked via a HABTM. countries & networks. They are
> linked together by the countries_networks lookup table.
>
> I need to get all of the countries and all of the associated network
> ids for each corresponding country. I don't need to go as far as
> getting the network names, simply getting the ids from the lookup
> table will suffice.
>
> If I do a find(all) it gives me an array of countries but not in the
> structure that I need. I need to return something link this, but I
> only need Country.countryName and CountriesNetwork.network_id:
>
> Array
> (
>     [0] => Array
>         (
>             [Country] => Array
>                 (
>                     [countryName] => France
>                 )
>             [CountriesNetwork] => Array
>                 (
>                     [0] => Array
>                                (
>                                     [id] => 1
>                                     [network_id] => 1
>                                 )
>                     [1] => Array
>                                (
>                                     [id] => 2
>                                     [network_id] => 7
>                                 )
>                  )
>          )
> )
>
> I've been struggling with find all and I've tried a custom query using
> a join, but it results in lots of duplicate countries. I just want the
> country name along with an array of network_id's. ( I could go as far
> as getting the network name from the network table if its easier.)
>
> I've even tried using unbind and bind to change my associations, but I
> haven't had much look there:http://pastebin.com/m1cca9e77
>
> Can someone possibly help me on this? I know it will be one of those
> 'aah i see' moments. 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing /group/person/post instead of /post/id

2009-07-29 Thread JamesF

http://book.cakephp.org/view/46/Routes-Configuration

lots of possibilities

On Jul 29, 2:39 pm, Orson  wrote:
> If you have a few models: Groups hasMany People hasMany Posts, can you
> have routes like /Group/Person/Post instead of /post/id
> I'd also want /group to go /groups/group, /group/person go to /people/
> person etc.
>
> 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: Solution?

2009-07-29 Thread JamesF

solution to what?

On Jul 29, 6:13 am, Robert  wrote:
> Hey Guys,
>
> I think I figured out a solution for this! Try changing the last line
> in your core.php:
>
> FROM
> Cache::config('default', array('engine' => 'File');
>
> TO
> Cache::config('default', array('engine' => 'File', 'path' => ROOT.'/
> app/tmp'));
--~--~-~--~~~---~--~~
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: Saving both habtm and hasmany data

2009-07-29 Thread JamesF

make sure that your array of data in $this->data is formatted
properly.

do a pr($this->data) in your save conditional to make sure its
formatted the right way
array(

   [Model1]=>array([Model1.field1], [Model1.field2]),
   [Model2]=>array([Model2.field1], [Model2.field1]),

)

saveAll should be able to interpret all that data if you set up your
associations correctly.

what does it say in your sql log?

On Jul 29, 3:38 pm, Site Reference  wrote:
> After quite a bit of back and forth, I decided to forge ahead with
> CakePHP for the first time.  I am running into troubles right now
> trying to get certain data to save properly.
>
> The form I am using is attempting to save data to several different
> models:
>
> phones
> emails
> profiles
> businesses
>
> The relationship of these models is as follows:
>
> profiles hasMany phones and emails
> businesses HABTM profiles
>
> Now my form allows people to fill out information about themselves
> (and thus add a profile) and submit it on behalf of their business.  I
> need cake to enter in profile, save the phone and email, then enter in
> the business, and make the habtm relationship.
>
> I was hoping cake could do all of this 'automagically', but it doesn't
> seem to be working.What I currently have is:
>
>             $this->Business->Profile->saveAll($this->data);
>             $this->Business->saveAll($this->data);
>
> Can cake do this automatically, or will I have to step cake through
> the saves?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Need advice/tips for sending mass emails with CakePHP

2009-07-29 Thread JamesF

hello,

I am looking to send bulk emails from my cakephp app. Does anyone have
any experience in this? My approach is probably going to be to set up
some sort of cron and stagger the emails. I was just curious to see if
anyone had implemented this before and what tips one could offer.


--~--~-~--~~~---~--~~
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: "approved" field for a model

2009-07-29 Thread JamesF

well to answer your question about paginate and containable, you can
set 'contain' paramaters on $paginate along with conditional
containment. as far as global model operations like you describe it
might be easier to do that but i'm not sure of the best way. let us
know what you come up with.

On Jul 29, 2:33 am, park  wrote:
> Hi James,
>
> You're absolutely right. I can't agree more on the fat model idea.
>
> Your approach should definitely work, but I still need to dive into
> controllers and make changes to find calls. And what's more, what
> about the paginate things? What about containable queries that concern
> this model...
>
> I assume there should be a way to globally set this condition in the
> scope of this particular model? Like setting conditions to
> Model.approved = 1, which affects all queries, paginations as well as
> containable.
>
> Something like this one, but much 
> simpler:http://bakery.cakephp.org/articles/view/soft-delete-behavior
>
> As for the admin part, maybe I can disable this condition on the fly
> before whenever a query is made.
>
> On Jul 29, 2:13 pm, JamesF  wrote:
>
> > "It's an existing site, so I don't want to rewrite conditions for all
> > find queries. "
>
> > ahh thats why we should be using fat models instead of fat
> > controllers.
>
> > the most direct way to achieve this would be to put it in each find
> > call.
>
> > the best way would be to set up a function in your model, lets call it
> > findApproved()
>
> > so in you model you put
>
> > function findApproved(){
>
> >      $data = $this->find('all', array('conditions'=>array
> > ('Model.approved'=>1,
> > more conditions etc etc)));
>
> >       return $data;
>
> > }
>
> > in your controller just put
> > $this->Model->findApproved() in place of those old rusty controller
> > find calls.
>
> > On Jul 29, 1:38 am, park  wrote:
>
> > > Hi,
>
> > > Would like to add an "approved" field for a model. Users can only see
> > > entries whose Model.approved = 1. Only in admin section can unapproved
> > > entries be retrieved.
>
> > > It's an existing site, so I don't want to rewrite conditions for all
> > > find queries.
>
> > > Is there a centralized method (presumably in Model) of achieving this?
>
> > > 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Calling component from helpers

2009-07-29 Thread JamesF

call component logic from controllers and pass it to views.

On Jul 29, 4:38 am, Shadab Shaikh  wrote:
> Can you please give me more thoughts on my first question
>
> 1)Can i call components methods from helpers? Is it possible/
> feasible ?
>
> Thanks!
> Shadab
>
> On Wed, Jul 29, 2009 at 1:07 PM, Miles J  wrote:
>
> > Well what exactly do you need to do? Why cant you just place the
> > component method in a helper?
>
> > Use ClassRegistry::init() to call models within helpers.
--~--~-~--~~~---~--~~
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 a 404 with Media View

2009-07-28 Thread JamesF

sounds like a permissions problem. who owns that directory? if you are
in a shell type "chown accountnameHere /htmldirectory/"
and check read/execute permissions. also a stray or
misconfigured .htaccess can cause these problems.

On Jul 28, 10:37 am, Stinkbug  wrote:
> I'm assuming this is an apache config problem, but I'm not sure what
> could be causing it.  Thought I'd just ask the community to see if
> anyone knew what the problem might be.
>
> I'm using the Media view to download files and have the files
> directory outside the webroot.  I'm getting a 404 Page cannot be found
> error when tring to download the file.  It works in out test
> envirnoment just fine, but when I move into production, I get this
> error.  Could it be an apache config problem, or an app problem?
--~--~-~--~~~---~--~~
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: Cannot modify header information - headers already sent by

2009-07-28 Thread JamesF

don't use ?> to end a php file. just leave it out and you will solve
90% of these errors.

On Jul 28, 12:36 pm, Delberto  wrote:
> Problem solved. Seems there was a space in the webroot/index.php Quite
> frustrating.
>
> On Jul 28, 12:44 pm, Delberto  wrote:
>
> > Hello,
>
> > I am having a problem with my application. I have it running fine on
> > my local development machine. Yet when I put it on the server I get
> > this error "Cannot modify header information -headersalreadysent
> > by". I have checked the controllers and models for spaces before  > and after ?> but I cannot find any.
>
> > I am using Wamp on my local machine and the remote server is Linux
> > with PHP5 on it.
>
> > Any ideas would be appreciated as I have been nearly a day trying to
> > figure this out.
>
> > Cheers,
> >   Derek
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Router URLs: hyphens instead of underscores

2009-07-28 Thread JamesF

congrats now you get to run str_replace on every url parsed by your
app. even worse when the codebase is upgraded your hack will be
difficult to maintain. basically you will have to recode it every time
you upgrade. best to leave the core ALONE.

you should really just be defining these routes in the router in the
first place with dashes

Router::connect('/my-links/*', array('controller' => 'my_controller',
'action' => 'my_links'));
);

you should be using verbose linking(reverse routing) in your views
echo $html->link('my link text', array('controller' =>
'my_controller', 'action' => 'my_links'));

more information about your "links" would be helpful in solving your
problem.

On Jul 27, 2:15 pm, Jamie  wrote:
> Alright, so what I just ended up doing was adding a bit of a hack to
> cake/libs/router.php and app/config/bootstrap.php.
>
> In the Router::url(), I changed the last line:
>
> return $output . $extension . $_this->queryString($q, array(),
> $escape) . $frag;
>
> To this:
>
> $url = str_replace('_', '-', $output . $extension . $_this->queryString
> ($q, array(), $escape) . $frag);
> return $url;
>
> Then I added this to the top of my bootstrap:
>
> $_GET['url'] = str_replace('-', '_', $_GET['url']);
>
> Total hack? You betcha. But it works for now.
>
> On Jul 27, 10:56 am, Jamie  wrote:
>
> > Yes, I know this issue has been raised in the past (a long while ago),
> > but there's been no satisfying answer yet.
>
> > Basically, best SEO practices say that we should be using hyphens
> > instead of underscores in our URLs, since search engines such as
> > Google have an easier time parsing "my-page", rather than "my_page",
> > as two separate words (and thus a distinct search term). Is it time
> > for Cake to look at allowing hyphens instead of underscores in URLs?
>
> > Before anyone says "OMG you can just do this" (as Nate suggested 
> > athttp://trac.cakephp.org/ticket/1727):
>
> > $_GET['url'] = str_replace("-", "_", $_GET['url']);
>
> > that's fine for parsing incoming URLs, but it doesn't even come close
> > to providing a solution since links generated by the Cake router (i.e.
> > via the HtmlHelper etc.) use underscores instead of hyphens, and
> > that's that. So for those of us who want to use hyphens instead of
> > dashes, we need to enter manual URLs instead of using Cake's routing
> > capabilities. So, sure, we can translate incoming links, but we can't
> > generate the proper links in the first place.
>
> > Has anyone thought of a solution? Is the Cake team contemplating
> > adding support for multiple URL separators? Any home brew hacks out
> > there?
>
> > - Jamie
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Router URLs: hyphens instead of underscores

2009-07-28 Thread JamesF

congrats now you get to run str_replace on every url parsed by your
app.

you should really just be defining these routes in the router in the
first place with dashes

Router::connect('/my-links/*', array('controller' => 'my_controller',
'action' => 'my_links'));
);

you should be using verbose linking(reverse routing) in your views
echo $html->link('my link text', array('controller' =>
'my_controller', 'action' => 'my_links'));

more information about your "links" would be helpful in solving your
problem.

On Jul 27, 2:15 pm, Jamie  wrote:
> Alright, so what I just ended up doing was adding a bit of a hack to
> cake/libs/router.php and app/config/bootstrap.php.
>
> In the Router::url(), I changed the last line:
>
> return $output . $extension . $_this->queryString($q, array(),
> $escape) . $frag;
>
> To this:
>
> $url = str_replace('_', '-', $output . $extension . $_this->queryString
> ($q, array(), $escape) . $frag);
> return $url;
>
> Then I added this to the top of my bootstrap:
>
> $_GET['url'] = str_replace('-', '_', $_GET['url']);
>
> Total hack? You betcha. But it works for now.
>
> On Jul 27, 10:56 am, Jamie  wrote:
>
> > Yes, I know this issue has been raised in the past (a long while ago),
> > but there's been no satisfying answer yet.
>
> > Basically, best SEO practices say that we should be using hyphens
> > instead of underscores in our URLs, since search engines such as
> > Google have an easier time parsing "my-page", rather than "my_page",
> > as two separate words (and thus a distinct search term). Is it time
> > for Cake to look at allowing hyphens instead of underscores in URLs?
>
> > Before anyone says "OMG you can just do this" (as Nate suggested 
> > athttp://trac.cakephp.org/ticket/1727):
>
> > $_GET['url'] = str_replace("-", "_", $_GET['url']);
>
> > that's fine for parsing incoming URLs, but it doesn't even come close
> > to providing a solution since links generated by the Cake router (i.e.
> > via the HtmlHelper etc.) use underscores instead of hyphens, and
> > that's that. So for those of us who want to use hyphens instead of
> > dashes, we need to enter manual URLs instead of using Cake's routing
> > capabilities. So, sure, we can translate incoming links, but we can't
> > generate the proper links in the first place.
>
> > Has anyone thought of a solution? Is the Cake team contemplating
> > adding support for multiple URL separators? Any home brew hacks out
> > there?
>
> > - Jamie
--~--~-~--~~~---~--~~
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: Moving nested if statements out of the view.

2009-07-28 Thread JamesF

create a helper for you form error logic
lets call it ErrorsHelper

http://book.cakephp.org/view/98/Helpers

you can move all you logic in the helper and call it like so:
echo $errors->getErrors($this->ModelName->invalidFields())

you might have to play with it but helpers are the mothod of choice
for moving bulky logic out of the view


On Jul 28, 10:39 am, Shaun  wrote:
> I prefer to display form validation errors at the top of the form
> rather than under each form field.  I would also like to display only
> one error at a time.  I have the following code at the top of my form:
>
>  if ($form->isFieldError('user_username')){
>         echo $form->error('user_username');} elseif 
> ($form->isFieldError('user_password')) {
>
>         echo $form->error('user_password');} elseif 
> ($form->isFieldError('user_given_name')) {
>
>         echo $form->error('user_given_name');} elseif 
> ($form->isFieldError('user_surname')) {
>
>         echo $form->error('user_surname');} elseif 
> ($form->isFieldError('user_email')) {
>
>         echo $form->error('user_email');}
>
> ?>
>
> How can I move the nested if statements out of my view?  Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Set user variables

2009-07-28 Thread JamesF

is $this->Auth->user('id') really that difficult to call?

--~--~-~--~~~---~--~~
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: "approved" field for a model

2009-07-28 Thread JamesF

"It's an existing site, so I don't want to rewrite conditions for all
find queries. "

ahh thats why we should be using fat models instead of fat
controllers.

the most direct way to achieve this would be to put it in each find
call.

the best way would be to set up a function in your model, lets call it
findApproved()

so in you model you put

function findApproved(){

 $data = $this->find('all', array('conditions'=>array
('Model.approved'=>1,
more conditions etc etc)));

  return $data;

}

in your controller just put
$this->Model->findApproved() in place of those old rusty controller
find calls.

On Jul 29, 1:38 am, park  wrote:
> Hi,
>
> Would like to add an "approved" field for a model. Users can only see
> entries whose Model.approved = 1. Only in admin section can unapproved
> entries be retrieved.
>
> It's an existing site, so I don't want to rewrite conditions for all
> find queries.
>
> Is there a centralized method (presumably in Model) of achieving this?
>
> 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: "approved" field for a model

2009-07-28 Thread JamesF

"It's an existing site, so I don't want to rewrite conditions for all
find queries. "

ahh thats why we should be using fat models instead of fat
controllers.

the most direct way to achieve this would be to put it in each find
call.

the best way would be to set up a function in your model, lets call it
findApproved()

so in you model you put

function findApproved(){

 $this->find('all', array('conditions'=>array('Model.approved'=>1,
more conditions etc etc)));


}

On Jul 29, 1:38 am, park  wrote:
> Hi,
>
> Would like to add an "approved" field for a model. Users can only see
> entries whose Model.approved = 1. Only in admin section can unapproved
> entries be retrieved.
>
> It's an existing site, so I don't want to rewrite conditions for all
> find queries.
>
> Is there a centralized method (presumably in Model) of achieving this?
>
> 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



  1   2   >