Re: View Caching with AuthComponent

2008-07-16 Thread bingo

Another solution is instead of caching view (data along with
presentation), cache only data.
Caching of data can be done in controller
and to retrieve cache for a specific user, you can append user id in
the cache file name.

On Jul 14, 6:46 pm, the_woodsman <[EMAIL PROTECTED]> wrote:
> I know that in the cookbook there's some info on marking particular
> sections of a view as  " similarly you coud just set the action as not cached in the Users
> controller.
> Could those be helpful?
>
> On Jul 14, 9:32 pm, tdyer <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
>
> > I am trying to use CakePHP 1.2rc2 with the Auth Component and View
> > caching. I have noticed that if i do not have the view cached
> > everything works as normal and a user that is not logged in will get
> > redirected to /users/login but if there is a view cached then the
> > cached view gets presented and authorization is not performed.
>
> > Any ideas on whether this is a feature or if I have broken something?
>
> > Thanks
>
> > Tristan- 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: The First CakePHP Book is out!

2008-07-16 Thread jenson

Hi friends,
  Good morning where i can get cakephp new book release from online .

with regards,
Jenson Rajan.A

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


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



CakePHP User Management/Auth Plugin - Define functions for AppController with code OUTSIDE the file.

2008-07-16 Thread Baz L

I'll cut to the chase:
http://code.google.com/p/cakeusermanagement/

I couldn't get CakePHP's built in ACL to work in a simple to
understand manner. Actually, I couldn't get it to work at all. So I
built upon this:
http://www.studiocanaria.com/articles/cakephp_auth_component_users_groups_permissions_revisited
And tried to stick it in a plugin so that anyone can drop in and use
(and also importantly, update to a later revision).

Features: User Management, User Profile Editing, Changing Passwords
(confirms duplicate passwords), User Registration, Forget/Reset
Password, User Groups (HABTM), User Permissions (handled through
Groups), and some other stuff.

Here's where I'm stuck:
I need to define some functions in the main AppController class. Since
this is a "plug in" I'm trying to maintain as much of the code in the
actual plugin folder that I can.

So my question is, how do I define functions in /app/
app_controller.php with code from /app/plugins/user/somefile.php.

Currently, I've been reduced to something like this:

function beforeRender() {

require(APP.'plugins'.DS.'user'.DS.'app_controller'.DS.'before_render.php');
}

function isAuthorized(){
return
require(APP.'plugins'.DS.'user'.DS.'app_controller'.DS.'is_authorized.php');;
}

function __permitted($controllerName,$actionName){
return
require(APP.'plugins'.DS.'user'.DS.'app_controller'.DS.'__permitted.php');;
}

Any brighter 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth + Custom Login + isAuthorized = Infinite Redirect Loop

2008-07-16 Thread Baz L

Nevermind everyone. I was being an idiot. My loginRedirect was to a
place that required authorization. As soon as I changed it some a
general controller and action that ALL loggged in users had access to,
I was fine.


On Jun 18, 8:46 am, Baz L <[EMAIL PROTECTED]> wrote:
> I believe I'm having a similar problem as 
> :http://groups.google.com/group/cake-php/browse_thread/thread/6d672c98...
>
> I'm using controller authorization, so there is a isAuthorized() in my
> app_controller.php which goes off of a simple $this->Auth-
>
> >user('role').
>
> I'm pretty much working off of the examples in the Cook 
> Book:http://book.cakephp.org/view/172/authentication
>
> I have the same login() function.
>
> This is what I've noticed.
> After isAuthorized returns false (user logs in, but is not authorized)
> I get redirected to:
> $controller->redirect($this->noaccessRedirect, null, true);  (from
> Auth::isAuthorized() )
> This sends me back to my login page (which is fine), however (and I'm
> assuming here) Auth::startup gets called again, thus
> Auth::isAuthorized() gets called again, and the whole thing starts
> over and over again.
>
> If I clear out the UsersController::login(), then every thing works
> fine.
>
> Can someone with more experiece help me out, or do I submit a ticket.
>
> Any help would be appreciated.
> --
> Baz L
> Web Development 2.0http://WebDevelopment2.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $this->Auth->user not refreshing after edit

2008-07-16 Thread Baz L

I would avoid writing directly to the Auth's session.

Again, this is generally how Authentication systems work. User
information used by the application is stored in memory (session in
this case). You could force a logout, but I think that you're users
will find this more annoying to be logged out when they change their
profile.

BTW, what 'critical' data could you possibly need in the User session?
If you're displaying stuff on the website, why don't you read the
user_id from Auth and then the rest of the data from the actual table,
if it's critical? If it's critical, read it yourself.

Also, the solutions above will only help you with a user editing their
own profile. This won't help with you scenario of changing user roles.
How is the application expected to log everyone off? You only
possibility is if you use database sessions, then I assume you'd be
able to clear those out in an afterSave() or something like that.

So here's my question to you, what happens when you change your
permissions?
You change the locks when someone is in the house, your change will
only take effect after they leave.

On Jul 14, 11:02 am, RichardAtHome <[EMAIL PROTECTED]> wrote:
> Back again...
>
> Added the following to the save block of my edit function:
>
> $this->Session->write("Auth", $this->data);
>
> ($this->data is provided by the User edit form)
>
> Which fixed the problem but with a minor issue (which I can live with
> for now).
>
> On Jul 14, 2:57 pm, RichardAtHome <[EMAIL PROTECTED]> wrote:
>
> > Thanks for the feedback everyone. I'll give it a try today and post
> > back my results :-)
>
> > On Jul 14, 1:33 pm, "Jonathan Snook" <[EMAIL PROTECTED]> wrote:
>
> > > >  Anyone know how to refresh the user record? Is it simply a case of
> > > >  setting the Auth Session User var?
>
> > > Looking at the Auth source, it populates the key 'Auth.' .
> > > $this->userModel, or Auth.User by default. You may want to try just
> > > doing $this->Auth->login() again from the edit page (be sure to pass
> > > it the username and (hashed?) password).
>
> > > -js
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: View Caching with AuthComponent

2008-07-16 Thread Baz L

Simplest solution is to not cache pages that need authentication.

On Jul 14, 5:46 pm, the_woodsman <[EMAIL PROTECTED]> wrote:
> I know that in the cookbook there's some info on marking particular
> sections of a view as  " similarly you coud just set the action as not cached in the Users
> controller.
> Could those be helpful?
>
> On Jul 14, 9:32 pm, tdyer <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I am trying to use CakePHP 1.2rc2 with the Auth Component and View
> > caching. I have noticed that if i do not have the view cached
> > everything works as normal and a user that is not logged in will get
> > redirected to /users/login but if there is a view cached then the
> > cached view gets presented and authorization is not performed.
>
> > Any ideas on whether this is a feature or if I have broken something?
>
> > Thanks
>
> > Tristan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: another transaction question

2008-07-16 Thread James K

Ah yes, don't forget the begin! Thanks for the follow-up - my bad

On Jul 15, 9:58 am, Flávio_GO_BRZ <[EMAIL PROTECTED]> wrote:
> English version:
> We don't must forget to code before or in begin of 'try' this:
>
>  $this->modelA->begin()    // This code will start the transaction
>
> Versão em Português:
> Não devemos esquecer de codificar antes ou no começo do 'try' o
> seguinte:
>
>  $this->modelA->begin()    // Inicia a transação
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: The First CakePHP Book is out!

2008-07-16 Thread Grant Cox

I'd also be very interested in knowing which revision it is current to
- for example the change in r7075 about condition operators moving
from the value to the key, is quite an important one.  I guess that's
the difficulty with writing any book for a non-stable release - the
API can change...


On Jul 17, 3:51 am, mbavio <[EMAIL PROTECTED]> wrote:
> WTF! No books before and now we have two in a row! I´m talking about
> the one that I thought it was going to be the 
> first:http://apress.com/book/view/9781430209775
>
> Seems like I need to buy two books now. Damn.
>
> Cheers,
> mbavio
>
> On Jul 16, 1:00 pm, neugi <[EMAIL PROTECTED]> wrote:
>
> > which version(s) are covered with this book? 1.2 or 1.1 ?
>
> > 2008/7/16 leo <[EMAIL PROTECTED]>:
>
> > > Congratulations. I'm not sure about the photo of chopped liver and
> > > brains on the cover, but I'm sure the contents are topper.
>
> > > On 16 Jul, 17:32, "Julio Protzek" <[EMAIL PROTECTED]> wrote:
> > > > That's awesome Ahsan!
> > > > Congratulations for the release :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Filemaker and CakePHP

2008-07-16 Thread Grant Cox

A few years ago I had to work with Cake and Filemaker - but thankfully
I convinced them that the website could use it's own database, and
their internal Filemaker database would just synchronise from this
live site with a Filemaker script (one way synch only).  There was
just a cake action that output appropriate data as an XML file
suitable for Filemaker, and the Filemaker script updated from this
(with a recorded macro, as I recall).

But the final solution is quite limited (one way, not automatic), and
it was a pain to work with - I really didn't like FileMaker after
that.

Admittedly, this was back when Filemaker was not relational either (FM
6 or 7 as I recall), so maybe things have improved.  But if it still
doesn't support SQL, maybe not.


On Jul 17, 5:24 am, Eric <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Has anyone had success using Filemaker as a repository for Cake? There
> have been a few posts here on the issue, but nothing for quite some
> time.
>
> I realize it is quite a task since Filemaker does not really handle
> SQL. Filemaker does have a PHP API and there is something called
> FX.php which is another way of accessing the data.
>
> The problem that I am facing is that a customer has an internal
> Filemaker database which they would like users of their website to
> have access to some of the data. They are moving their site's hosting
> internally to facilitate this change. If anyone has any other ideas of
> how to get the filemaker data into Cake, I am all ears. I was thinking
> some sort of database synchronization, but I think that will be more
> trouble then it is worth, if it is even possible.
>
> Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: highslide

2008-07-16 Thread Mark (Germany)

oh my gosh
i got it to work.. there was just one trailing slash missing...
took me hours to get it done..

anyway.. did anybody ever used it - and created some helper class for
it.
i will try setting up on my own. but with all these conf.
possiblities, maybe somebody
already put something up.



On 17 Jul., 01:45, "Mark (Germany)" <[EMAIL PROTECTED]>
wrote:
> hi!
> did anybody try to use "highslide" along with CakePHP 1.2?
>
> i tried to get it to run (as usually in all the non-cake apps before)
> but besides the fact, that direct links (without the starting / slash)
> like "highslide/.."  don't work and have to be set relativly to the
> root, there might me still other things needed to get it to work.
> i failed in the end.
> hope somebody has made better experiences with highslide integration
>
> i just like it (and i dont know what would be the best alternative)
> because of the many functions it provide.
> as is said, in former projects i used it successfully
>
> thx, mark
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



highslide

2008-07-16 Thread Mark (Germany)

hi!
did anybody try to use "highslide" along with CakePHP 1.2?

i tried to get it to run (as usually in all the non-cake apps before)
but besides the fact, that direct links (without the starting / slash)
like "highslide/.."  don't work and have to be set relativly to the
root, there might me still other things needed to get it to work.
i failed in the end.
hope somebody has made better experiences with highslide integration

i just like it (and i dont know what would be the best alternative)
because of the many functions it provide.
as is said, in former projects i used it successfully

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



Modeling a friends network

2008-07-16 Thread hellfish

I've been searching a lot and I'm still having a hard time to model
something that I want to include on my bands website
[shamelessPlug]http://www.karbonsoul.com[/shamelessPlug].

What would be the cake (v1.2) way of modeling a small users network
where a registered user has the possibility to add other registered
users as friends.

I have a table "users", I know I need a table to have the HABTM
associations between users (and a few extra attributes that I want to
add later) but what should be the naming here? and the model code?

In theory I would have a table called "users", the associations table
"users_users" and so on, but this doesn't have any logic in this case.

I've been trying around with no success, every solution I try seems
like a hack on cakephp.

If you have any hints on the path I should follow, I would appreciate
very much
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using CakePHP with WebORB for PHP?

2008-07-16 Thread thomas

Yeah, I know about this possibility - unfortunately using WebORB is a
requirement in this project :(.


Regards,

thomas

On 16 Jul., 15:36, John David Anderson <[EMAIL PROTECTED]>
wrote:
> I'd use this instead:
>
> https://trac.cakefoundation.org/amf/
>
> -- John
>
> On Jul 16, 2008, at 3:15 AM, thomas wrote:
>
>
>
> > Hey Guys,
>
> > anyone ever used CakePHP together with WebORB for PHP?
> > To me it looks like I need a different object structure in weborb and
> > can't reuse my cakephp stuff, am I right?
> > Anyone tried it?
>
> > Thanks,
>
> > Thomas
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Best way to integrate a factory pattern?

2008-07-16 Thread keymaster

I need a factory pattern at the component/controller level, but am not
sure of the best way to integrate it.

I could create a file containing the abstract class with
it’s different implementation subclasses, and brute force include() it
via bootstrap, then do all the instantiation/initialization  myself in
my controller.

But that’s so raw php’ish.

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



Best way to integrate factory pattern?

2008-07-16 Thread keymaster

I need a factory pattern at the component/controller level, but am not
sure of the best way to integrate it into my cake app.

I suppose I could create a file containing the abstract class with
it’s different implementation subclasses, and brute force include() it
via bootstrap, then do all the instantiation/initialization  myself in
my controller.

But that’s so raw php’ish.

Is there a better “cake” way of integrating polymorphism?

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



Best way to integrate a factory pattern into a cake app?

2008-07-16 Thread keymaster

I have this component, Price, with way too much redundant, conditional
branching (based on $productType) in just about all it’s functions.

I suppose I could create different price components,  one for each
$product type, and just do one switch() in my main controller to
decide which component to call, but that requires a switch() in my
main controller, which I’m not crazy about.

The OO approach would be to define an abstract class with different
implementation subclasses. I suppose I could brute force include() it
via bootstrap, then do all the instantiation myself. That's so raw
php'ish though.

Basically I need a factory pattern, but am not sure of the best way to
integrate it into a cake app.

Any suggestions?

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



Filemaker and CakePHP

2008-07-16 Thread Eric

Hi,

Has anyone had success using Filemaker as a repository for Cake? There
have been a few posts here on the issue, but nothing for quite some
time.

I realize it is quite a task since Filemaker does not really handle
SQL. Filemaker does have a PHP API and there is something called
FX.php which is another way of accessing the data.

The problem that I am facing is that a customer has an internal
Filemaker database which they would like users of their website to
have access to some of the data. They are moving their site's hosting
internally to facilitate this change. If anyone has any other ideas of
how to get the filemaker data into Cake, I am all ears. I was thinking
some sort of database synchronization, but I think that will be more
trouble then it is worth, if it is even possible.

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



Re: Updating multiple rows

2008-07-16 Thread Mr K

Hey there

Thanks for that ... It certainly looks right - I'll give it a shot :)

Thank you


On Jul 17, 3:21 am, schneimi <[EMAIL PROTECTED]> wrote:
> Not sure if I understood your problem, but in case you want to add
> some data to the profiles inside the foreach and save it to the DB,
> this could look like:
>
> $profiles = $this->Profile->find('all');
>
> foreach($profiles as $nr => $profile) {
>   ..
>   $profiles[$nr]['Profile']['new_attribute'] = some_value;
>   ..
>
> }
>
> $this->Profile->saveAll($profiles);
>
> Hope this helps.
>
> Mr K schrieb:
>
> > Help ... :)
>
> > Okay .. so I have a problem & I need some help.
>
> > I have a users table & a profile table. A user can have multiple
> > profiles.
> > Okay simple enough - I've got that bit working (user rego/login etc &
> > creating base profiles)
>
> > So once I have their base profile info I run some scripts (will later
> > be cron run) to fill in more detail.
> > So, I look up their profiles (lets pretend they have 3) and foreach I
> > run through and fetch information.
>
> > My Profiles Controller of course has the functions Add, Edit etc, also
> > have a function called FetchProfile, which then I have a specific
> > function for each profile I need to fetch (at this stage 3 functions)
>
> > What I'm really struggling with is, I can use
>
> > foreach($this->Profile as $profile) {
> >  ... code here
> > }
>
> > to get and cycle through ...
> > how the heck to I put it back into the database?
>
> > I of course no longer have a profile object to simply save() ... I
> > can't find anything on the cakePHP sites about how to do something
> > like
>
> > UPDATE table WHERE id='id' SET ...
>
> > grrr .. I love the CakePHP framework ... but this is frustrating ..
> > I'm sure it's a simple thing!! Help!
>
> > Thanks all

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



Re: Updating multiple rows

2008-07-16 Thread Mr K

YES!!

Thank you ... that worked perfectly!!

On Jul 16, 8:17 pm, Mr K <[EMAIL PROTECTED]> wrote:
> Help ... :)
>
> Okay .. so I have a problem & I need some help.
>
> I have a users table & a profile table. A user can have multiple
> profiles.
> Okay simple enough - I've got that bit working (user rego/login etc &
> creating base profiles)
>
> So once I have their base profile info I run some scripts (will later
> be cron run) to fill in more detail.
> So, I look up their profiles (lets pretend they have 3) and foreach I
> run through and fetch information.
>
> My Profiles Controller of course has the functions Add, Edit etc, also
> have a function called FetchProfile, which then I have a specific
> function for each profile I need to fetch (at this stage 3 functions)
>
> What I'm really struggling with is, I can use
>
> foreach($this->Profile as $profile) {
>  ... code here
>
> }
>
> to get and cycle through ...
> how the heck to I put it back into the database?
>
> I of course no longer have a profile object to simply save() ... I
> can't find anything on the cakePHP sites about how to do something
> like
>
> UPDATE table WHERE id='id' SET ...
>
> grrr .. I love the CakePHP framework ... but this is frustrating ..
> I'm sure it's a simple thing!! Help!
>
> Thanks all

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



Re: $this->Auth->user not refreshing after edit

2008-07-16 Thread [EMAIL PROTECTED]

Richard,

I have a patch which will allow you to do $this->Auth->reload() which
will pull user details in there.

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

Good luck.

--
Sincerely,
~Andrew Allen

On Jul 13, 5:01 pm, RichardAtHome <[EMAIL PROTECTED]> wrote:
> Hi all :-)
>
> I'm using Cake 1.2 and the Auth component.
>
> Everything is working fine (after a bit of fiddling and manual
> reading), but...
>
> It looks like the Users model is only being read once at login and the
> details stored in a session (not checked the cake code, but that would
> match the behaviour I am experiencing).
>
> Basically, the edit is working (ie, database gets updated), but the
> $this->Auth->user() isn't.
>
> This means, that if the user edits his profile (users table) the
> changes are not reflected on the site until the user logs out and logs
> back in again.
>
> For security reasons (changes to role etc.) shouldn't the user model
> be re-read on every page view and only the user id stored in the
> session?
>
> In the meantime, how do I get the Auth component to re-read the users
> table after an edit?
>
> Thanks in advance

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



Re: File uploading in cake

2008-07-16 Thread Sam Sherlock
You could use the image behavior
http://bakery.cakephp.org/articles/view/actas-image-column-behavior

2008/7/16 kaushik <[EMAIL PROTECTED]>:

>
> I am new in CakePHP. I want to store the products and product details
> with image (image will be store in folder, not in table).
>
> Here is my code details:
> categories Table:
>
> `categoryId` int(10) NOT NULL auto_increment,
>  `categoryName` varchar(100) NOT NULL,
>  `isActive` enum('Y','N') NOT NULL default 'Y',
>  PRIMARY KEY  (`categoryId`)
>
> products Table:
>
> `productId` int(10) NOT NULL auto_increment,
>  `productName` varchar(20) NOT NULL,
>  `categoryId` int(10) NOT NULL,
>  `productImage` varchar(40) NOT NULL,
>  `isActive` enum('Y','N') NOT NULL default 'Y',
>  PRIMARY KEY  (`productId`)
>
> It is my product Model
>
> class product extends AppModel
> {
>  var $name = 'Product';
>  var $primaryKey = 'productId';
>  var $validate = array(
>   'productName'  => VALID_NOT_EMPTY,
>   );
>
>  var $belongsTo = array(
>'Category' => array(
>'className'  => 'category',
>'foreignKey' => 'categoryId',
>)
>);
>
> }
>
> and it is my category model:
>
> class category extends AppModel
> {
>  var $name = 'Category';
>  var $primaryKey = 'categoryId';
>  var $validate = array(
>   'categoryName'  => VALID_NOT_EMPTY,
>   );
>
> }
>
> Product Controller:
>
> function admin_add()
> {
>  if (!empty($this->data['Product']))
>  {
>if ($this->Product->save($this->data))
>  $this->flash('Your Product has been added.','../products/',
> 5);
>  }
>
> }
>
> I want to introduce the image upload functionality with it. I have
> gone thu a few articles on cakephp upload file, become more confused.
> Is there any easy way to do it? Is there any in-built helper for this
> type of functionality? Please help 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: validating non-model form fields

2008-07-16 Thread Siebren Bakker
Yes, you can validate *any* field in a model, even if it is not a part of
the model, just make sure that the rules in the model match the names of the
input fields. I use this functionality for both password and email
verification, as the user must enter them twice, my model validates and
makes sure that they match.

Instead of allowEmpty, try a minLength rule instead. Here's an example.
'password_new' => array(
'rule' => array('minLength', '8'),
'message' => 'Minimum 8 characters')

Also, for your question on matching fields, you can add a function to the
end of your model(or your App_Model if you want it available to every model)

Here's mine:

 /*function to make sure that 2 entered fields are identical*/
function identicalFields( $field=array(), $compare_field=null )
{
foreach( $field as $key => $value )
{
$vi = $value;
$v2 = $this->data[$this->name][$compare_field];
if ($vi !== $v2)
{
return false;
}
else
{
continue;
}
}
return true;
}

and you can call this function like so:

'confirm_email' => array(
'rule' => array('identicalFields', 'email'),
'message' => 'E-Mail addresses must match')

Hope this helps!



In the name of Life, Liberty, and the pursuit of my sanity.
Siebren Bakker(Aevum Decessus)

On Wed, Jul 16, 2008 at 12:19, august.gresens <[EMAIL PROTECTED]> wrote:

>
> Hello
>
> I'm setting up a user registration form with a 'password_new' and
> 'password_confirm' fields.
>
> These fields are not in my database (and not official fields in my
> User model).
>
> Can I validate these fields using the validation rules in my User
> model? (I was under the impression from some other posts that this was
> possible).
>
> Here are the form calls in my view (register.ctp):
>
> password('password_new', array('label' => false)); ?
> >
> password('password_confirm', array('label' =>
> false)); ?>
>
> The authentication is set up like so in my User model:
>
>
>var $validate = array(
>
>'password_new' => array(
>'rule' => VALID_NOT_EMPTY,
>'required' => true,
>'allowEmpty' => false,
>'message' => 'Passwords need to be a mimimum 8
> characters long'
> ),
>
>
>'password_confirm' => array(
>'rule' => VALID_NOT_EMPTY,
>'required' => true,
>'allowEmpty' => false,
>'message' => 'Passwords need to be a mimimum 8
> characters long'
> ),
> )
>
>
> Yet, if I submit a form with both of these fields blank, no error
> message is generated.
>
> I also need to compare the values of these fields. Is there a way to
> do this in the controller or can it also be done through the model
> validation?
>
> Thanks,
>
> August
> >
>

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



File uploading in cake

2008-07-16 Thread kaushik

I am new in CakePHP. I want to store the products and product details
with image (image will be store in folder, not in table).

Here is my code details:
categories Table:

`categoryId` int(10) NOT NULL auto_increment,
  `categoryName` varchar(100) NOT NULL,
  `isActive` enum('Y','N') NOT NULL default 'Y',
  PRIMARY KEY  (`categoryId`)

products Table:

`productId` int(10) NOT NULL auto_increment,
  `productName` varchar(20) NOT NULL,
  `categoryId` int(10) NOT NULL,
  `productImage` varchar(40) NOT NULL,
  `isActive` enum('Y','N') NOT NULL default 'Y',
  PRIMARY KEY  (`productId`)

It is my product Model

class product extends AppModel
{
 var $name = 'Product';
 var $primaryKey = 'productId';
 var $validate = array(
   'productName'  => VALID_NOT_EMPTY,
   );

 var $belongsTo = array(
'Category' => array(
'className'  => 'category',
'foreignKey' => 'categoryId',
)
);

}

and it is my category model:

class category extends AppModel
{
 var $name = 'Category';
 var $primaryKey = 'categoryId';
 var $validate = array(
   'categoryName'  => VALID_NOT_EMPTY,
   );

}

Product Controller:

function admin_add()
{
  if (!empty($this->data['Product']))
  {
if ($this->Product->save($this->data))
  $this->flash('Your Product has been added.','../products/',
5);
  }

}

I want to introduce the image upload functionality with it. I have
gone thu a few articles on cakephp upload file, become more confused.
Is there any easy way to do it? Is there any in-built helper for this
type of functionality? Please help 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: The First CakePHP Book is out!

2008-07-16 Thread mbavio

WTF! No books before and now we have two in a row! I´m talking about
the one that I thought it was going to be the first:
http://apress.com/book/view/9781430209775

Seems like I need to buy two books now. Damn.

Cheers,
mbavio

On Jul 16, 1:00 pm, neugi <[EMAIL PROTECTED]> wrote:
> which version(s) are covered with this book? 1.2 or 1.1 ?
>
> 2008/7/16 leo <[EMAIL PROTECTED]>:
>
>
>
> > Congratulations. I'm not sure about the photo of chopped liver and
> > brains on the cover, but I'm sure the contents are topper.
>
> > On 16 Jul, 17:32, "Julio Protzek" <[EMAIL PROTECTED]> wrote:
> > > That's awesome Ahsan!
> > > Congratulations for the release :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: About the findById method and it's returns

2008-07-16 Thread mark_story

Try setting $this->Order->recursive = 2 before doing the find.  Since
order doesn't directly relate to Shop it doesn't come up in the find
results with default settings.

-Mark

On Jul 16, 5:42 am, iWorm <[EMAIL PROTECTED]> wrote:

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



Re: Configure::write

2008-07-16 Thread mark_story

On Jul 16, 4:20 am, kik <[EMAIL PROTECTED]> wrote:
> Thanks I tried Configure::store and it's working great. However I
> noticed something that's a little confusing. When I use
> Configure::store it creates a php file in app/tmp/cache/persistent and
> the php file does not have any closing tag such as "?>". Is this
> normal and reliable way to store a variable or I have made a mistake
> somewhere. Basically the php file in the cache folder looks like this:
>
> //START
>
>  $config = array();
> $config['ApplicationSettings']['app_title'] = 'My Title Goes Here';
>
> //END
>
> As you can see there is no closing "?>" tag. My other question is does
> Configure::store saves the file in another location except the tmp/
> cache folder? If not isn't this an unreliable way to save data that I
> want to use later?

Ending ?> are optional and not necessary if you are not switching out
of 'code' mode.  For example no drupal files have ending ?>

As for the this use.  I think sessions would be a much better
solution. As soon as more than one user starts to use this
application, the Configure value will start to get clobbered.  And
behavior dependant on the state of your configure value will become
unpredictable at best.

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



Re: Form Helper - Date Problem

2008-07-16 Thread liammc87


Thanks for the reply.

I have now fixed the problem. My model was called Date and I have a feeling
this was causing the problem. I have since changed it to Booking and
everything works. :)
-- 
View this message in context: 
http://www.nabble.com/Form-Helper---Date-Problem-tp18485260p18492256.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Re: The First CakePHP Book is out!

2008-07-16 Thread neugi
which version(s) are covered with this book? 1.2 or 1.1 ?

2008/7/16 leo <[EMAIL PROTECTED]>:

>
> Congratulations. I'm not sure about the photo of chopped liver and
> brains on the cover, but I'm sure the contents are topper.
>
> On 16 Jul, 17:32, "Julio Protzek" <[EMAIL PROTECTED]> wrote:
> > That's awesome Ahsan!
> > Congratulations for the release :)
> >
>

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



validating non-model form fields

2008-07-16 Thread august.gresens

Hello

I'm setting up a user registration form with a 'password_new' and
'password_confirm' fields.

These fields are not in my database (and not official fields in my
User model).

Can I validate these fields using the validation rules in my User
model? (I was under the impression from some other posts that this was
possible).

Here are the form calls in my view (register.ctp):

password('password_new', array('label' => false)); ?
>
password('password_confirm', array('label' =>
false)); ?>

The authentication is set up like so in my User model:


var $validate = array(

'password_new' => array(
'rule' => VALID_NOT_EMPTY,
'required' => true,
'allowEmpty' => false,
'message' => 'Passwords need to be a mimimum 8 
characters long'
 ),


'password_confirm' => array(
'rule' => VALID_NOT_EMPTY,
'required' => true,
'allowEmpty' => false,
'message' => 'Passwords need to be a mimimum 8 
characters long'
 ),
 )


Yet, if I submit a form with both of these fields blank, no error
message is generated.

I also need to compare the values of these fields. Is there a way to
do this in the controller or can it also be done through the model
validation?

Thanks,

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



Re: The First CakePHP Book is out!

2008-07-16 Thread BrendonKoz

Out of curiosity, since publishing a book takes time (and can't
theoretically keep up with the fast paced update process of the
languages they cover), what was the last version in the 1.2 branch
that the book is up-to-date on?  I'm mostly curious what small
differences it will have with Cake right from the start, just to be
aware of (i.e.: element vs renderElement).


On Jul 16, 5:47 am, Ahsan <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> its not much that I write in this group lately, but couldn't stop myself
> from sharing a good news. Packt Pub has published a book named "CakePHP
> Application Development". It has been co-authored by Anupom and me.
>
> http://www.packtpub.com/cakephp-application-development/book
>
> Basically, its a good book for beginners in CakePHP. I am eager to know what
> you guys think about it.
>
> I would like to thank the whole CakePHP community for helping us (both
> directly and indirectly) in writing this book.
>
> Thanks
>
> --
> Ahsanul Bari
> Web Programmer
> Trippert Labs, Inc.
> Blog: [http://ahsanity.com]
> LinkedIn Profile: [http://www.linkedin.com/in/ahsanulbari]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: redirect and header error but no white space

2008-07-16 Thread Stinkbug

Excuse my stupidity on this topic, but I don't really understand
encoding at all.  So how exactly do I save a a file without the BOM?

Does it require special software, or what?  I'm on windows.

On Jul 14, 11:39 pm, haj <[EMAIL PROTECTED]> wrote:
> So, I basically saved all UTF-8 files without BOM and now things works
> beautifully.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: curl_exec and auth component (one for the brainiacs)

2008-07-16 Thread Chris Hartjes

On Wed, Jul 16, 2008 at 12:51 PM, michaelmcandrew (aka Milky Joe)
<[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I've got so far with debugging this but can't get any further.
> Appreciate that this post might not have the info you need, but it
> would be great for some pointers on how I could go about solving this
> - I've hit a wall.
>
> I'm using cURL to make a call to a paypal server.  It works fine until
> I start using the Auth component in the controller that makes the
> call.
>
> Then (even when I have $this->Auth->allow('*'); in the beforeFilter)
> curl_exec fails.
>
> My curl_init and curl_setopt functions are all working fine.
>
> Cheers if you can help.
> Michael
>
> Here is the relevant code:  Anything else you would like to know?

In the future, I suggest you use http://bin.cakephp.org to paste those
code samples into, instead of putting it in the body of the message.

Just a little mailing list etiquette, that's all.

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

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



Re: Cake bake does not recognize relationships?

2008-07-16 Thread Mech7

Mmmm when i changed the db engine to MyIsam.. and tried again it still
does not work :( even when i enter data in the table.. it does not put
the relation in the model..

On Jul 16, 10:39 am, RichardAtHome <[EMAIL PROTECTED]> wrote:
> Try putting some data in your groups table.Cakewill change the
> textbox to a drop down select list.
>
> On Jul 15, 10:35 pm, "Renan Gonçalves" <[EMAIL PROTECTED]> wrote:
>
> > Recognize relationships based on InnoDB relationships is planned to CakePHP
> > 2.0.https://trac.cakephp.org/wiki/Proposals/2.0ToDoList
>
> > []'s
>
> > On Tue, Jul 15, 2008 at 4:07 PM, Mech7 <[EMAIL PROTECTED]> wrote:
>
> > > Does anybody know what could be wrong.. if I wouldbakemy model /
> > > controllers / views for users
> > > it will just put a input text box for usergroup_id and in the model it
> > > just says:
>
> > >  > > class Users extends AppModel {
> > >        var $name = 'Users';
> > > }
> > > ?>
>
> > > Here is the table setup..
>
> > > ---
> > > CREATE TABLE `usergroups` (
> > >  `id` int(11) NOT NULL auto_increment,
> > >  `name` varchar(120) NOT NULL,
> > >  `created` datetime NOT NULL,
> > >  `modified` datetime NOT NULL,
> > >  PRIMARY KEY  (`id`)
> > > ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
>
> > > CREATE TABLE `users` (
> > >  `id` int(11) NOT NULL auto_increment,
> > >  `username` varchar(120) NOT NULL,
> > >  `password` varchar(120) NOT NULL,
> > >  `usergroup_id` int(11) NOT NULL,
> > >  `created` datetime NOT NULL,
> > >  `modified` datetime NOT NULL,
> > >  PRIMARY KEY  (`id`),
> > >  KEY `fk_usergroup_id` (`usergroup_id`)
> > > ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
> > > ---
>
> > > Does anybody know why it would not recognize the other table?
>
> > --
> > Renan Gonçalves - Software Engineer
> > Cell Phone: +55 11 8633 6018
> > MSN: [EMAIL PROTECTED]
> > São Paulo - SP/Brazil
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



curl_exec and auth component (one for the brainiacs)

2008-07-16 Thread michaelmcandrew (aka Milky Joe)

Hi all,

I've got so far with debugging this but can't get any further.
Appreciate that this post might not have the info you need, but it
would be great for some pointers on how I could go about solving this
- I've hit a wall.

I'm using cURL to make a call to a paypal server.  It works fine until
I start using the Auth component in the controller that makes the
call.

Then (even when I have $this->Auth->allow('*'); in the beforeFilter)
curl_exec fails.

My curl_init and curl_setopt functions are all working fine.

Cheers if you can help.
Michael

Here is the relevant code:  Anything else you would like to know?

var $components = array('Email', 'Auth');

function beforeFilter() {
$this->Auth->allow('*');
}

function _fetchData($unique_id, $submiturl, $data) {
// get data ready for API
$user_agent = $_SERVER['HTTP_USER_AGENT'];
// Here's your custom headers; adjust appropriately for your 
setup:
$headers[] = "Content-Type: text/namevalue"; //or text/xml if 
using
XMLPay.
$headers[] = "Content-Length : " . strlen ($data);  // Length of
data to be passed
// Here I set the server timeout value to 45, but notice below 
in
the cURL section, I set the timeout
// for cURL to 90 seconds.  You want to make sure the server 
timeout
is less, then the connection.
$headers[] = "X-VPS-Timeout: 45";
$headers[] = "X-VPS-Request-ID:" . $unique_id;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $submiturl);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_HEADER, 1);// tells 
curl to
include headers in response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);// return 
into a
variable
curl_setopt($ch, CURLOPT_TIMEOUT, 90);  // times out
after 90 secs
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);// this line
makes it work under https
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);//adding 
POST
data
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2);   //verifies 
ssl
certificate
curl_setopt($ch, CURLOPT_FORBID_REUSE, TRUE);   //forces 
closure
of connection when done
curl_setopt($ch, CURLOPT_POST, 1);  
//data sent as POST

$i=1;
while ($i++ <= 1) {
$result = curl_exec($ch);
$headers = curl_getinfo($ch);
if ($headers['http_code'] != 200) {
sleep(5);  // Let's wait 5 seconds to see if 
its a temporary
network issue.
} else if ($headers['http_code'] == 200) {
break;
}
}
if ($headers['http_code'] != 200) {
echo 'General Error!';
echo 'Unable to receive response from PayPal 
server.';
echo 'Verify host URL of '.$submiturl.' and check 
for firewall/
proxy issues.';
curl_close($ch);
exit;
}
curl_close($ch);
$result = strstr($result, "RESULT");
// echo $result;
// prepare responses into array
$proArray = array();
while(strlen($result)){
// name
$keypos= strpos($result,'=');
$keyval = substr($result,0,$keypos);
// value
$valuepos = strpos($result,'&') ? strpos($result,'&'):
strlen($result);
$valval = substr($result,$keypos+1,$valuepos-$keypos-1);
// decoding the respose
$proArray[$keyval] = $valval;
$result = substr($result,$valuepos+1,strlen($result));
}
return $proArray;
}




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



Re: The First CakePHP Book is out!

2008-07-16 Thread Tapos Pal
oh great news. I was waiting for such an book. I am going to buy it :)

On Wed, Jul 16, 2008 at 8:33 PM, Rich <[EMAIL PROTECTED]> wrote:

>
> This is great. Its about time that a book about Cake came out!
> Congrats Ahsanul!
>
> On Jul 16, 5:47 am, Ahsan <[EMAIL PROTECTED]> wrote:
> > Hi guys,
> >
> > its not much that I write in this group lately, but couldn't stop myself
> > from sharing a good news. Packt Pub has published a book named "CakePHP
> > Application Development". It has been co-authored by Anupom and me.
> >
> > http://www.packtpub.com/cakephp-application-development/book
> >
> > Basically, its a good book for beginners in CakePHP. I am eager to know
> what
> > you guys think about it.
> >
> > I would like to thank the whole CakePHP community for helping us (both
> > directly and indirectly) in writing this book.
> >
> > Thanks
> >
> > --
> > Ahsanul Bari
> > Web Programmer
> > Trippert Labs, Inc.
> > Blog: [http://ahsanity.com]
> > LinkedIn Profile: [http://www.linkedin.com/in/ahsanulbari]
> >
>


-- 
Best Regards,
Tapos Pal
http://tapos.wordpress.com

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



Re: The First CakePHP Book is out!

2008-07-16 Thread Mariano Iglesias

I know I want one :)

-MI

Gwoo wrote:
> Technically it's not the first, since several have been written in
> Japanese. But congrats on having the first English book. Wonder if the
> dev team will get a free copy ;)
>   


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



Re: The First CakePHP Book is out!

2008-07-16 Thread Gwoo

Technically it's not the first, since several have been written in
Japanese. But congrats on having the first English book. Wonder if the
dev team will get a free copy ;)

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



Re: ordering a query with a field in another table

2008-07-16 Thread b logica

On Wed, Jul 16, 2008 at 2:10 AM, new2cake <[EMAIL PROTECTED]> wrote:
>
> Is there any way I can order the Comments listing by a field in the
> Post table?
>

That doesn't make much sense, SQL-wise Before trying that with
CakePHP, have you attempted it with straight SQL? I don't think you'd
get far with that.

Try ordering by Comments.post_id (or whatever foreign key points to
the posts table).

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



Re: The First CakePHP Book is out!

2008-07-16 Thread leo

Congratulations. I'm not sure about the photo of chopped liver and
brains on the cover, but I'm sure the contents are topper.

On 16 Jul, 17:32, "Julio Protzek" <[EMAIL PROTECTED]> wrote:
> That's awesome Ahsan!
> Congratulations for the release :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: The First CakePHP Book is out!

2008-07-16 Thread Julio Protzek

That's awesome Ahsan!
Congratulations for the release :)

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



Re: Updating multiple rows

2008-07-16 Thread schneimi

Not sure if I understood your problem, but in case you want to add
some data to the profiles inside the foreach and save it to the DB,
this could look like:

$profiles = $this->Profile->find('all');

foreach($profiles as $nr => $profile) {
  ..
  $profiles[$nr]['Profile']['new_attribute'] = some_value;
  ..
}

$this->Profile->saveAll($profiles);

Hope this helps.

Mr K schrieb:
> Help ... :)
>
> Okay .. so I have a problem & I need some help.
>
> I have a users table & a profile table. A user can have multiple
> profiles.
> Okay simple enough - I've got that bit working (user rego/login etc &
> creating base profiles)
>
> So once I have their base profile info I run some scripts (will later
> be cron run) to fill in more detail.
> So, I look up their profiles (lets pretend they have 3) and foreach I
> run through and fetch information.
>
> My Profiles Controller of course has the functions Add, Edit etc, also
> have a function called FetchProfile, which then I have a specific
> function for each profile I need to fetch (at this stage 3 functions)
>
> What I'm really struggling with is, I can use
>
> foreach($this->Profile as $profile) {
>  ... code here
> }
>
> to get and cycle through ...
> how the heck to I put it back into the database?
>
> I of course no longer have a profile object to simply save() ... I
> can't find anything on the cakePHP sites about how to do something
> like
>
> UPDATE table WHERE id='id' SET ...
>
> grrr .. I love the CakePHP framework ... but this is frustrating ..
> I'm sure it's a simple thing!! Help!
>
> Thanks all
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: The First CakePHP Book is out!

2008-07-16 Thread Rich

This is great. Its about time that a book about Cake came out!
Congrats Ahsanul!

On Jul 16, 5:47 am, Ahsan <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> its not much that I write in this group lately, but couldn't stop myself
> from sharing a good news. Packt Pub has published a book named "CakePHP
> Application Development". It has been co-authored by Anupom and me.
>
> http://www.packtpub.com/cakephp-application-development/book
>
> Basically, its a good book for beginners in CakePHP. I am eager to know what
> you guys think about it.
>
> I would like to thank the whole CakePHP community for helping us (both
> directly and indirectly) in writing this book.
>
> Thanks
>
> --
> Ahsanul Bari
> Web Programmer
> Trippert Labs, Inc.
> Blog: [http://ahsanity.com]
> LinkedIn Profile: [http://www.linkedin.com/in/ahsanulbari]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Form Helper - Date Problem

2008-07-16 Thread Siebren Bakker
Would you mind posting the code you have that is creating this data as well,
so we can see if there are any discrepancies? It would help diagnosing the
issue.


In the name of Life, Liberty, and the pursuit of my sanity.
Siebren Bakker(Aevum Decessus)

On Wed, Jul 16, 2008 at 06:57, liammc87 <[EMAIL PROTECTED]> wrote:

>
>
> I'm new to cake and have a problem with the form date helper. I'm using
> v.1.2.0.7296 RC2.
>
> I have a date field in my table, but the scaffolding returns (what I think)
> is an strange value.  It basically returns the array like this:
>
> Array
> (
>[Date] => Array
>(
>[people] => 5
>[service] => 1
>[date] => Array
>(
>[month] => 07
>)
>
>)
>
>[date] => Array
>(
>[date] => Array
>(
>[day] => 16
>[year] => 2008
>)
>
>)
>
> )
>
> Because of this (well, I think it's only because of this), it cannot write
> it to the database. Basically, the month is capitalized, but the day and
> year aren't?
>
> I hope this makes sense. Is it a bug? Please help!
> --
> View this message in context:
> http://www.nabble.com/Form-Helper---Date-Problem-tp18485260p18485260.html
> Sent from the CakePHP mailing list archive at Nabble.com.
>
>
> >
>

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



Form Helper - Date Problem

2008-07-16 Thread liammc87


I'm new to cake and have a problem with the form date helper. I'm using
v.1.2.0.7296 RC2.

I have a date field in my table, but the scaffolding returns (what I think)
is an strange value.  It basically returns the array like this:

Array
(
[Date] => Array
(
[people] => 5
[service] => 1
[date] => Array
(
[month] => 07
)

)

[date] => Array
(
[date] => Array
(
[day] => 16
[year] => 2008
)

)

)

Because of this (well, I think it's only because of this), it cannot write
it to the database. Basically, the month is capitalized, but the day and
year aren't?

I hope this makes sense. Is it a bug? Please help!
-- 
View this message in context: 
http://www.nabble.com/Form-Helper---Date-Problem-tp18485260p18485260.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Re: I am new to Cake PHP Can anybody help me on google chat

2008-07-16 Thread John David Anderson


On Jul 16, 2008, at 6:15 AM, Ayaz Khan, Indore, India wrote:

>
> HI,
>
> My Name is Ayaz.
> I am working as software developer on PHP from last 10 months but I
> have to work on cake php.
> I m doing installation of cake php. I have worked with cake php before
> 8 month. but Now I am facing some problem. May be version changed. So
> comming this.
>
> So Please Can Any body add me on google talk for help.
>
> Please Chat with me

Check out our IRC channel (#cakephp on freenode) for interactive help.

-- John

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



Re: 1.2 Data Validation - 'minlength" rule does not filter out blank fields

2008-07-16 Thread august.gresens

To anyone reading this, I've solved this problem myself.

It appears that the rules in the a multiple validation rule are read
from BOTTOM to TOP!

Hence if I arrange my multiple rules in the table like so, I get the
VALID_NOT_EMPTY rule tripping the validation mechanism before the
other rules.

'username' => array(

 // needs to be at least 4 chars long
'minrule' => array(
'rule' => array('minLength', 4),
'required' => true,
'allowEmpty' => false,
'message' => 'Your Username must be at least 4 
characters
long.'
),

// must be alphanumeric
'alphanumeric' => array(
'rule' => 'alphaNumeric',
'message' => 'Only alphabets and numbers allowed.'
 ),


// must be a unique name
'unique' => array(
'rule' => 'isUnique',
'message' => 'This username has already been taken.'
),

 // needs to be at least 4 chars long
'notempty' => array(
'rule' => VALID_NOT_EMPTY,
'message' => 'Username Can not be Empty.'
),


),


Thanks,

August



On Jul 16, 8:56 am, august <[EMAIL PROTECTED]> wrote:
> Hello
>
> I'm trying to create a user registration form. I'm having a few weird
> problems with this, mostly having to do with the validation rules in
> the model.
>
> One basic problem is detecting a simple blank field. This was so easy
> in 1.1, but I can't (for the life of me) figure out how this is done
> in 1.2. The 'minLength' rule only seems to invalidate the field when
> there is a actual text in the field, and not when it is blank..
>
> Here are the rules for my username field in my User model for example:
>
>         var $validate = array(
>
>                 // username field
>             'username' => array(
>
>                  // needs to be at least 4 chars long
>                 'minrule' => array(
>                                 'rule' => array('minLength', 4),
>                                         'required' => true,
>                                         'allowEmpty' => false,
>                                 'message' => 'Your Username must be at least 
> 4 characters
> long.'
>                 ),
>
>                 // must be alphanumeric
>                 'alphanumeric' => array(
>                     'rule' => 'alphaNumeric',
>                     'message' => 'Only alphabets and numbers allowed.'
>                  ),
>
>                 // must be a unique name
>                 'unique' => array(
>                     'rule' => 'isUnique',
>                     'message' => 'This username has already been taken.'
>                 ),
>
>             ),
>
> 
>
> )
>
> When I test this code, however, a blank field trips the 'alphanumeric'
> rule instead of minLength - generating the wrong message.
>
> If I enter only the letter "a" in the username field, the field is
> invalidated.
>
> Is this a bug?
>
> Thanks,
>
> August

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



persistant db connections

2008-07-16 Thread clrockwell

Using RC2 - 7296. MySQL tables remain open after information is
pulled.  When mysql is restarted, there are 6 open tables, as I
navigate the site and information is needed, tables are opened but not
closed.  Eventually there are 29 open tables.

I do have "'persistant' => false" in database.php

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



1.2 Data Validation - 'minlength" rule does not filter out blank fields

2008-07-16 Thread august

Hello

I'm trying to create a user registration form. I'm having a few weird
problems with this, mostly having to do with the validation rules in
the model.

One basic problem is detecting a simple blank field. This was so easy
in 1.1, but I can't (for the life of me) figure out how this is done
in 1.2. The 'minLength' rule only seems to invalidate the field when
there is a actual text in the field, and not when it is blank..

Here are the rules for my username field in my User model for example:

var $validate = array(

// username field
'username' => array(

 // needs to be at least 4 chars long
'minrule' => array(
'rule' => array('minLength', 4),
'required' => true,
'allowEmpty' => false,
'message' => 'Your Username must be at least 4 
characters
long.'
),

// must be alphanumeric
'alphanumeric' => array(
'rule' => 'alphaNumeric',
'message' => 'Only alphabets and numbers allowed.'
 ),


// must be a unique name
'unique' => array(
'rule' => 'isUnique',
'message' => 'This username has already been taken.'
),

),



)


When I test this code, however, a blank field trips the 'alphanumeric'
rule instead of minLength - generating the wrong message.

If I enter only the letter "a" in the username field, the field is
invalidated.

Is this a bug?

Thanks,

August


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



The First CakePHP Book is out!

2008-07-16 Thread Ahsan
Hi guys,

its not much that I write in this group lately, but couldn't stop myself
from sharing a good news. Packt Pub has published a book named "CakePHP
Application Development". It has been co-authored by Anupom and me.

http://www.packtpub.com/cakephp-application-development/book

Basically, its a good book for beginners in CakePHP. I am eager to know what
you guys think about it.

I would like to thank the whole CakePHP community for helping us (both
directly and indirectly) in writing this book.

Thanks

-- 
Ahsanul Bari
Web Programmer
Trippert Labs, Inc.
Blog: [http://ahsanity.com]
LinkedIn Profile: [http://www.linkedin.com/in/ahsanulbari]

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



Updating multiple rows

2008-07-16 Thread Mr K

Help ... :)

Okay .. so I have a problem & I need some help.

I have a users table & a profile table. A user can have multiple
profiles.
Okay simple enough - I've got that bit working (user rego/login etc &
creating base profiles)

So once I have their base profile info I run some scripts (will later
be cron run) to fill in more detail.
So, I look up their profiles (lets pretend they have 3) and foreach I
run through and fetch information.

My Profiles Controller of course has the functions Add, Edit etc, also
have a function called FetchProfile, which then I have a specific
function for each profile I need to fetch (at this stage 3 functions)

What I'm really struggling with is, I can use

foreach($this->Profile as $profile) {
 ... code here
}

to get and cycle through ...
how the heck to I put it back into the database?

I of course no longer have a profile object to simply save() ... I
can't find anything on the cakePHP sites about how to do something
like

UPDATE table WHERE id='id' SET ...

grrr .. I love the CakePHP framework ... but this is frustrating ..
I'm sure it's a simple thing!! Help!

Thanks all

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



Re: Trying to map findAll to $form->select()

2008-07-16 Thread Igor

> find('list')

Works like magic! Thank you Chris!

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



UpdateAll(), rawQuery()

2008-07-16 Thread VinceCarter

Hello,


ich have a problem using cakephp.
I want to create tracking links, so at the beginning i have made
function, called mailer(). This function takes the id of the page and
increments the counter. The problem is that i always receive an error
message: "SQL Error: 1064: You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right
syntax to use near 'updateAll' at line 1"

That's why i have tried with the method rawQuery(), with a working
query, but i still receive the error message.

Can somebody help me ?


function mailer($page_id = '') {

//$this->Nllink->updateAll(array('Nllink.counter' => 
'Nllink.counter
+ 1'), array('Nllink.page_id' => $page_id));
//$q = "UPDATE nllinks SET counter = '711' WHERE 
nllinks.page_id = ".
$page_id;
//echo $q;
//$this->Nllink->rawQuery($q);
$this->Nllink->updateAll(array('counter' => '8'), 
array('page_id' =>
$page_id));
$this->redirect('seminars/view/'.$page_id);

}

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



Re: Embed images to HTML-mails

2008-07-16 Thread Meloy

On 15 Jul., 23:42, "Renan Gonçalves" <[EMAIL PROTECTED]> wrote:
> If you want put the full url, you can do this:
> image()) ?>
>
> I think its more simple and less "weight" than embed image on a email.

Yep, I think your're right.
I'll do it that way.

Thanks.

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



I am new to Cake PHP Can anybody help me on google chat

2008-07-16 Thread Ayaz Khan, Indore, India

HI,

My Name is Ayaz.
I am working as software developer on PHP from last 10 months but I
have to work on cake php.
I m doing installation of cake php. I have worked with cake php before
8 month. but Now I am facing some problem. May be version changed. So
comming this.

So Please Can Any body add me on google talk for help.

Please Chat with me


Regards
Ayaz

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



UpdateAll(), rawQuery()

2008-07-16 Thread VinceCarter

Hello,


ich have a problem using cakephp.
I want to create tracking links, so at the beginning i have made
function, called mailer(). This function takes the id of the page and
increments the counter. The problem is that i always receive an error
message: "SQL Error: 1064: You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right
syntax to use near 'updateAll' at line 1"

That's why i have tried with the method rawQuery(), with a working
query, but i still receive the error message.

Can somebody help me ?


function mailer($page_id = '') {

//$this->Nllink->updateAll(array('Nllink.counter' => 
'Nllink.counter
+ 1'), array('Nllink.page_id' => $page_id));
//$q = "UPDATE nllinks SET counter = '711' WHERE 
nllinks.page_id = ".
$page_id;
//echo $q;
//$this->Nllink->rawQuery($q);
$this->Nllink->updateAll(array('counter' => '8'), 
array('page_id' =>
$page_id));
$this->redirect('seminars/view/'.$page_id);

}

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



Distinct Query in cakephp

2008-07-16 Thread vino

Hi,
i want to make a distinct query in cakephp, but it is not working
properly can any one suggest a means to write distinct query in cake
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



About the findById method and it's returns

2008-07-16 Thread iWorm

Hi,
I have 4 tables.
people
id
name

foods
id
name
shopid

shops
id
name

orders
id
peopleid
foodid

In my application, 1 order has 1 food, 1 shop has many foods, 1 people
has many orders

Models:
//People
var $hasMany = array(
'Order' => array(
'className' => 'Order',
'foreignKey' => 'peopleId'
)
);

//Food
var $belongsTo = array(
'Shop' => array(
'className' => 'Shop',
'foreignKey' => 'shopId'
)
);

//Shop
var $hasMany = array(
'Food' => array(
'className' => 'Food',
'foreignKey' => 'shopId'
)
);

//Order
var $belongsTo = array(
'People' => array(
'className' => 'People',
'foreignKey' => 'peopleId'
),
'Food' => array(
'className' => 'Food',
'foreignKey' => 'foodId'
)
);


I think the relationship is right, because when I use $this->Order-
>findAll()

I get an array like this
Array
(
[0] => Array
(
[Order] => Array
(
[id] => 1
[peopleId] => 1
[foodId] => 1
[created] =>
[modified] =>
[isPaid] =>
[shopId] => 1
[count] => 3
)

[People] => Array
(
[id] => 1
[name] => Roger
[email] => [EMAIL PROTECTED]
)

[Food] => Array
(
[id] => 1
[name] => Beef
[price] => 15.5
[shopId] => 1
)
)
)

But, when I get all orders, I can't get shop information. So I want to
get an array like this:
Array
(
[0] => Array
(
[Order] => Array
(
[id] => 1
[peopleId] => 1
[foodId] => 1
[created] =>
[modified] =>
[isPaid] =>
[shopId] => 1
[count] => 3
)

[People] => Array
(
[id] => 1
[name] => Roger
[email] => [EMAIL PROTECTED]
)

[Food] => Array
 (
 [id] => 1
 [name] => Beef
 [price] => 15.5
 [shopId] => 1
 [shop] = Array
(
  [id] => 1
  [name] => Beef
)
 )

)


How can I get this or something like 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



ordering a query with a field in another table

2008-07-16 Thread new2cake

Is there any way I can order the Comments listing by a field in the
Post table?


array('className' => 'Comment',
'conditions' => '',
'order' => 'Comment.created DESC',
'limit' => '5',
'foreignKey' => 'post_id',
'dependent' => true,
'exclusive' => false,
'finderQuery'   => '',
'fields' => '',
'offset' => '',
'counterQuery' => ''
)
);

var $validate = array(
'title'  => VALID_NOT_EMPTY,
'body'   => VALID_NOT_EMPTY

);
}
?>

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



Re: Configure::write

2008-07-16 Thread kik

Thanks I tried Configure::store and it's working great. However I
noticed something that's a little confusing. When I use
Configure::store it creates a php file in app/tmp/cache/persistent and
the php file does not have any closing tag such as "?>". Is this
normal and reliable way to store a variable or I have made a mistake
somewhere. Basically the php file in the cache folder looks like this:

//START

" tag. My other question is does
Configure::store saves the file in another location except the tmp/
cache folder? If not isn't this an unreliable way to save data that I
want to use later?

Thanks again for your big help!

On Jul 16, 12:39 am, "Renan Gonçalves" <[EMAIL PROTECTED]> wrote:
> And... if you wanna store this data "permanently" you must save on a local
> file.
> To do it, use Configure::store and Configure::load
>
> []'s
>
>
>
> On Tue, Jul 15, 2008 at 4:36 PM, Gonzalo Servat <[EMAIL PROTECTED]> wrote:
> > On Tue, Jul 15, 2008 at 4:02 PM, kik <[EMAIL PROTECTED]> wrote:
>
> >> [..snip..]
> >> ... As far as I understand when you
> >> use Configure::write it's storing a data in the config file and the
> >> data is permanently stored.
>
> > Nope. As far as I know, Configure::write() 'writes' the variable into the
> > Configure instance.
>
> >> But when I try to get the data from
> >> another controller or even another action of the same controller I'm
> >> not able to read the value.
>
> > If you are expecting to write in one call then read in another call, then
> > you probably want to use sessions for that.
>
> >> It seems that I'm able to get the value
> >> only from the same action that writes to Configure. Does this mean
> >> that Configure::write does not store the information permanently? For
> >> instance I have an action:
>
> > As above, that's correct. It does not store information permanently.
>
> > I will be thankfrul if someone explains to me how this works! Thank
> >> you in advance for any suggestions!
>
> > This is my understanding of the Configure class.
>
> > Group: If I gave any wrong info, please feel free to correct me.
>
> > - Gonzalo
>
> --
> Renan Gonçalves - Software Engineer
> Cell Phone: +55 11 8633 6018
> MSN: [EMAIL PROTECTED]
> São Paulo - SP/Brazil

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



maximum number of internal redirects reached

2008-07-16 Thread mojock

Hello,

I think I've exhausted every avenue I can find to no avail.  I am
using CakePHP to develop a site and everything has worked fine on
three development servers.  I have now moved everything out to the
production host and I am receiving the error "mod_rewrite: maximum
number of internal redirects reached. Assuming configuration error.
Use 'RewriteOptions MaxRedirects' to increase the limit if
neccessary."

I've tried several combinations of tricks that are on the web and none
seem to work.  I do not have write access to httpd.conf.  Here's the
config that is set up for me, though:



ServerAdmin  [EMAIL PROTECTED]
DocumentRoot /hsphere/local/home/mysite/mysite.com
ServerName   mysite.com



ServerAlias www.mysite.com  alias.hosting.com

User mysite
Groupmysite

AddType text/html .shtml
AddHandler server-parsed .shtml

AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps


AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

AddHandler cgi-script .cgi
AddHandler cgi-script .pl
ScriptAlias /cgi-bin"/hsphere/local/home/mysite/mysite.com/cgi-bin"
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i
\""
TransferLog /hsphere/local/home/mysite/logs/mysite.com/mysite.com
ErrorLog /hsphere/local/home/mysite/logs/mysite.com/error_log




OPTIONS  Indexes Includes ExecCGI FollowSymLinks
AllowOverride All

IndexOptions FancyIndexing




All of my CakePHP .htaccess files are untouched so I won't bother
posting them.  I have also confirmed that they are in the appropriate
directories.

At this point, I'm at a loss.  Any help would be enormously
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Global data

2008-07-16 Thread mark_story

Global variables in general are the spawn of satan.  However both
constants and using Configure::write('var', $value) are excellent
replacements as they prevent the collisions and spaghetti code that
globals can help create.

http://book.cakephp.org/view/39/configuration

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



Re: Using CakePHP with WebORB for PHP?

2008-07-16 Thread John David Anderson

I'd use this instead:

https://trac.cakefoundation.org/amf/

-- John

On Jul 16, 2008, at 3:15 AM, thomas wrote:

>
> Hey Guys,
>
> anyone ever used CakePHP together with WebORB for PHP?
> To me it looks like I need a different object structure in weborb and
> can't reuse my cakephp stuff, am I right?
> Anyone tried it?
>
>
> Thanks,
>
> Thomas
> >


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



Re: Soap in Cake

2008-07-16 Thread ryan

You could include the SOAP library as a vendor (place in app/vendors/)
and include the file with something like App::import('vendor', 'SOAP/
Client.php'); - I have not yet used vendors in 1.2 so I'm not sure the
correct syntax, you may want to google up cake vendors a bit or scope
out the manual.

Remember, CakePHP is still just PHP so there's nothing preventing you
from doing a regular old include(), but from what you're asking it
sounds like using vendors is the appropriate solution.

On Jul 16, 6:10 am, kaushik <[EMAIL PROTECTED]> wrote:
> I am new in Cakephp. I want to use soap in cake. I already implemented
> the same in general php coding in this way-
>
> include("SOAP/Client.php");
>
> $WSDL = new SOAP_WSDL('http://test.net/webservice.asmx?WSDL');
> $soapclient   = $WSDL->getProxy();
> $soapclient->setOpt('curl', CURLOPT_SSL_VERIFYPEER, 0);
> $soapclient->setOpt('curl', CURLOPT_SSL_VERIFYHOST, 0);
>
> $totalData  = $soapclient-
>
> >GetSearchParams('test','test','','','EN','','1');
>
> How to implement it in Cake? Where to place the Soap folder in cake?
>
> Please help 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Send text/plain Email using CRON

2008-07-16 Thread Pierre MARCOURT
Hello,

I am currently running a Cron file to execute a CakePHP controller.
The Cron file runs every minute and has to send reminders by email.
For that, I use PHPMailer and the users receive an HTML email. So it 
works great.

But, at the same time I send a HTML email I need to send a text/plain 
email for text message reminder. The thing is, it keeps sending the 
email in HTML even if I put : $this->Email->sendAs = 'text'; or 
$this->Email->IsHTML(false);

So I tried to send an email via the mail() PHP function but it does not 
works. No email are sent.
But if i run the Cron file manually, the email will be sent as I want.

Is there something wrong with mail() PHP function in CakePHP ? Or do you 
know what I should do with PHPMailer to send text/plain email ?

Thanks.

-- 
 *Pierre MARCOURT*  
 
*IT Department* 
*CableOrganizer.com*
5610 NW 12th Ave, suite 214
Fort Lauderdale, FL 33304
 


Phone: 954-861-6310
Fax: 954-861-2001


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



Re: how to set the root folder

2008-07-16 Thread Adam Royle

There should be a .htaccess file in the level above your app folder
which uses mod_rewrite to forward the request app/webroot/index.php

So if your folder structure should look like:

htdocs/.htaccess
htdocs/app
htdocs/cake
htdocs/vendors

etc...

Hope that helps.

Adam

On Jul 16, 7:51 pm, RJ <[EMAIL PROTECTED]> wrote:
> if somebody can tell me how does the folder "app" does not appear in
> the url although all the files are in that folder..
> for eg: localhost/project/users( though there is an 'app' folder
> inside 'project')
> mebbe can solve my problem.
>
> -RJ
>
> On Jul 16, 12:40 pm, RJ <[EMAIL PROTECTED]> wrote:
>
> > anybody to help 
>
> > On Jul 16, 11:21 am, RJ <[EMAIL PROTECTED]> wrote:
>
> > > can't do it coz subversioning data resides in 'xyz' folder.
> > > The directory structure has remain that way...
> > > Ne way out?
>
> > > On Jul 16, 11:18 am, Duncan <[EMAIL PROTECTED]> wrote:
>
> > > > If you don't need the xyz dir, then why not move the whole cake
> > > > install one directory up? /htdocs/appName/app
>
> > > > On Jul 15, 11:15 pm, RJ <[EMAIL PROTECTED]> wrote:
>
> > > > > The directory structure is as follows:
> > > > > /htdocs/appName/xyz/app
>
> > > > > app is the folder that contains all the cakephp files. Now when i hit
> > > > > any url , it appears as:
>
> > > > >http://localhost/apName/xyz/users/login,
>
> > > > > but the requirement is such that 'xyz' should not appear in the url.
>
> > > > > How to achieve the same , i guess it has something to do
> > > > > with .htaccess file
>
> > > > > any help wld be appreciated
>
> > > > > -RJ
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Solved: Advanced routing with prefix

2008-07-16 Thread Primeminister

Solved but not very satisfied. I allow a couple of actions in the
normal routing and the rest in the my prefix routing:
// account stuff (login, register, reset_password, etc)
Router::connect('/:lang/accounts/:action/*', array('controller' =>
'accounts'), array('lang'=>'[a-zA-Z]{2}','action'=>'(register|login|
logout|reset_password|confirm)'));

// when loggedin
Router::connect('/:lang/my/:controller/:action/*',
array('prefix'=>'my'), array('lang'=>'[a-zA-Z]{2}'));

But whenever an action is changed or added I have to add this in my
routes.php.

Thanks anyway Tarique!
- primeminister


On 16 jul, 12:22, Primeminister <[EMAIL PROTECTED]> wrote:
> That worked!
> The route changed also to:
> Router::connect('/:lang/my/:controller/:action/*',
> array('prefix'=>'my'), array('lang'=>'[a-zA-Z]{2}'));
>
> But now it collides with the normal account routes:
> Router::connect('/:lang/accounts/:action/*', array('controller' =>
> 'accounts'), array('lang'=>'[a-zA-Z]{2}'));
>
> Which I use for register, login, etc actions
> The HTML link is here:
> $html->link('Register',
> array('controller'=>'accounts','action'=>'register','admin'=>false),
> array('class'=>'signin'));
> and gives me the url:http://www.pages.local/nl/my/accounts/register
> And it must be without the 'my'
>
> On 16 jul, 12:14, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
>
> > On Wed, Jul 16, 2008 at 3:28 PM, Primeminister <[EMAIL PROTECTED]> wrote:
>
> > > Tried that to but gives me:
> > >http://www.pages.local/accounts/edit/77123
> > > So still no prefix 'my' like in
> > >http://www.pages.local/my/accounts/edit/77123
>
> > Try moving the Router::connect('/my/:controller/:action',
> > array('prefix'=>'my')); to be the first route and in the link you need not
> > give prefix=> just give controller, action and params
>
> > Tarique
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Advanced routing with prefix

2008-07-16 Thread Primeminister

That worked!
The route changed also to:
Router::connect('/:lang/my/:controller/:action/*',
array('prefix'=>'my'), array('lang'=>'[a-zA-Z]{2}'));

But now it collides with the normal account routes:
Router::connect('/:lang/accounts/:action/*', array('controller' =>
'accounts'), array('lang'=>'[a-zA-Z]{2}'));

Which I use for register, login, etc actions
The HTML link is here:
$html->link('Register',
array('controller'=>'accounts','action'=>'register','admin'=>false),
array('class'=>'signin'));
and gives me the url:
http://www.pages.local/nl/my/accounts/register
And it must be without the 'my'


On 16 jul, 12:14, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On Wed, Jul 16, 2008 at 3:28 PM, Primeminister <[EMAIL PROTECTED]> wrote:
>
> > Tried that to but gives me:
> >http://www.pages.local/accounts/edit/77123
> > So still no prefix 'my' like in
> >http://www.pages.local/my/accounts/edit/77123
>
> Try moving the Router::connect('/my/:controller/:action',
> array('prefix'=>'my')); to be the first route and in the link you need not
> give prefix=> just give controller, action and params
>
> Tarique
>
> --
> =
> Cheesecake-Photoblog:http://cheesecake-photoblog.org
> PHP for E-Biz:http://sanisoft.com
> =
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Advanced routing with prefix

2008-07-16 Thread Dr. Tarique Sani
On Wed, Jul 16, 2008 at 3:28 PM, Primeminister <[EMAIL PROTECTED]> wrote:

>
> Tried that to but gives me:
> http://www.pages.local/accounts/edit/77123
> So still no prefix 'my' like in
> http://www.pages.local/my/accounts/edit/77123


Try moving the Router::connect('/my/:controller/:action',
array('prefix'=>'my')); to be the first route and in the link you need not
give prefix=> just give controller, action and params

Tarique

-- 
=
Cheesecake-Photoblog: http://cheesecake-photoblog.org
PHP for E-Biz: http://sanisoft.com
=

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



Soap in Cake

2008-07-16 Thread kaushik

I am new in Cakephp. I want to use soap in cake. I already implemented
the same in general php coding in this way-

include("SOAP/Client.php");

$WSDL = new SOAP_WSDL('http://test.net/webservice.asmx?WSDL');
$soapclient   = $WSDL->getProxy();
$soapclient->setOpt('curl', CURLOPT_SSL_VERIFYPEER, 0);
$soapclient->setOpt('curl', CURLOPT_SSL_VERIFYHOST, 0);

$totalData  = $soapclient-
>GetSearchParams('test','test','','','EN','','1');

How to implement it in Cake? Where to place the Soap folder in cake?

Please help 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Advanced routing with prefix

2008-07-16 Thread Primeminister

Tried that to but gives me:
http://www.pages.local/accounts/edit/77123
So still no prefix 'my' like in http://www.pages.local/my/accounts/edit/77123

But in the manual it says in the section prefix:
Router::connect('/profiles/:controller/:action', array('prefix' =>
'profiles'));
Any calls to the profiles section would look for the profiles_ prefix
on the method calls

And that is what I did in the accounts_controller:
function my_edit() {}

Maybe the order of those two routes of mine must be different?

On 16 jul, 11:53, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On Wed, Jul 16, 2008 at 3:19 PM, Primeminister <[EMAIL PROTECTED]> wrote:
>
> > And then I use withing views:
> > $html->link('My pages',
>
> > array('admin'=>false,'prefix'=>'my','controller'=>'accounts','action'=>'my_edit',
> > $item['id']));
>
> 'action'=>'edit'
>
> Try with the above
>
> Tarique
>
> --
> =
> Cheesecake-Photoblog:http://cheesecake-photoblog.org
> PHP for E-Biz:http://sanisoft.com
> =
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Advanced routing with prefix

2008-07-16 Thread Dr. Tarique Sani
On Wed, Jul 16, 2008 at 3:19 PM, Primeminister <[EMAIL PROTECTED]> wrote:

>
> And then I use withing views:
> $html->link('My pages',
>
> array('admin'=>false,'prefix'=>'my','controller'=>'accounts','action'=>'my_edit',
> $item['id']));


'action'=>'edit'

Try with the above

Tarique



-- 
=
Cheesecake-Photoblog: http://cheesecake-photoblog.org
PHP for E-Biz: http://sanisoft.com
=

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



Re: how to set the root folder

2008-07-16 Thread RJ

if somebody can tell me how does the folder "app" does not appear in
the url although all the files are in that folder..
for eg: localhost/project/users( though there is an 'app' folder
inside 'project')
mebbe can solve my problem.

-RJ

On Jul 16, 12:40 pm, RJ <[EMAIL PROTECTED]> wrote:
> anybody to help 
>
> On Jul 16, 11:21 am, RJ <[EMAIL PROTECTED]> wrote:
>
> > can't do it coz subversioning data resides in 'xyz' folder.
> > The directory structure has remain that way...
> > Ne way out?
>
> > On Jul 16, 11:18 am, Duncan <[EMAIL PROTECTED]> wrote:
>
> > > If you don't need the xyz dir, then why not move the whole cake
> > > install one directory up? /htdocs/appName/app
>
> > > On Jul 15, 11:15 pm, RJ <[EMAIL PROTECTED]> wrote:
>
> > > > The directory structure is as follows:
> > > > /htdocs/appName/xyz/app
>
> > > > app is the folder that contains all the cakephp files. Now when i hit
> > > > any url , it appears as:
>
> > > >http://localhost/apName/xyz/users/login,
>
> > > > but the requirement is such that 'xyz' should not appear in the url.
>
> > > > How to achieve the same , i guess it has something to do
> > > > with .htaccess file
>
> > > > any help wld be appreciated
>
> > > > -RJ
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Advanced routing with prefix

2008-07-16 Thread Primeminister

Hi,
I have my routing setup and want to use the prefix (http://
book.cakephp.org/view/46/routes-configuration) for a couple of routes.
But I also want to use other urls with the same controllers.
So I did this in /config/routes.php

// account stuff (login, register, reset_password, etc)
// http://www.pages.local/nl/accounts/logout
Router::connect('/:lang/accounts/:action/*', array('controller' =>
'accounts'),array('lang'=>'[a-zA-Z]{2}'));

// when loggedin the urls to personal pages
Router::connect('/my/:controller/:action/*', array('prefix'=>'my'));

And then I use withing views:
$html->link('My pages',
array('admin'=>false,'prefix'=>'my','controller'=>'accounts','action'=>'my_edit',
$item['id']));
Which results in:
http://www.pages.local/accounts/my_edit/77123
which I want to be:
http://www.pages.local/my/accounts/edit/77123

Anyone a suggestion to prevent the collision here?

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



Re: About PHP i18n !

2008-07-16 Thread ghostjackyo

I have another question !
if I already make .mo file !
but I add new in my config !
then i make .po file !
so I want to transoft if again ?

On 7月16日, 上午12時15分, ghostjackyo <[EMAIL PROTECTED]> wrote:
> Oh !
> Thanks !
> I will try it today !
> I hope i can use it work !
>
> On 7月15日, 下午10時51分, morris <[EMAIL PROTECTED]> wrote:
>
> > I've been using Poedithttp://www.poedit.net/tocreate my
> > translated .po files from a po template file (.pot).
>
> > I haven't used any auto-translaters though I imagine there are some
> > out there. I doubt it would be a seamless translation though.
>
> > Poedit does have some fuzzy/suggestive translations and translation
> > memory when you are working in an existing .po file.
>
> > good luck!
>
> > ghostjackyo wrote:
> > > Excuse me !
> > > I want to ask some question about PHP i18n !
> > > Now i make some code with .po file !
> > > But it was zh_TW word !
> > > Does it have some tool can changed it to en_US ! (auto translation)
>
> > > This was some code !
>
> > > EX :
>
> > > #: i18n_lang.php:18
> > > msgid "�c�餤��"
> > > msgstr ""
>
> > > #: i18n_lang.php:19
> > > msgid "�^��"
> > > msgstr ""
>
> > > #: i18n_lang.php:20
> > > msgid "�n�J"
> > > msgstr ""
>
> > > #: i18n_lang.php:21
> > > msgid "�n�J�̱b��"
> > > msgstr ""
>
> > > #: i18n_lang.php:22
> > > msgid "�n�J�̱K�X"
> > > msgstr ""
>
> > > #: i18n_lang.php:23
> > > msgid "�y�t"
> > > msgstr ""
>
> > > #: i18n_lang.php:25
> > > msgid "�S��v��"
> > > msgstr ""- 隱藏被引用文字 -
>
> > - 顯示被引用文字 -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Using CakePHP with WebORB for PHP?

2008-07-16 Thread thomas

Hey Guys,

anyone ever used CakePHP together with WebORB for PHP?
To me it looks like I need a different object structure in weborb and
can't reuse my cakephp stuff, am I right?
Anyone tried it?


Thanks,

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



Re: Cake bake does not recognize relationships?

2008-07-16 Thread RichardAtHome

Try putting some data in your groups table. Cake will change the
textbox to a drop down select list.

On Jul 15, 10:35 pm, "Renan Gonçalves" <[EMAIL PROTECTED]> wrote:
> Recognize relationships based on InnoDB relationships is planned to CakePHP
> 2.0.https://trac.cakephp.org/wiki/Proposals/2.0ToDoList
>
> []'s
>
>
>
> On Tue, Jul 15, 2008 at 4:07 PM, Mech7 <[EMAIL PROTECTED]> wrote:
>
> > Does anybody know what could be wrong.. if I would bake my model /
> > controllers / views for users
> > it will just put a input text box for usergroup_id and in the model it
> > just says:
>
> >  > class Users extends AppModel {
> >        var $name = 'Users';
> > }
> > ?>
>
> > Here is the table setup..
>
> > ---
> > CREATE TABLE `usergroups` (
> >  `id` int(11) NOT NULL auto_increment,
> >  `name` varchar(120) NOT NULL,
> >  `created` datetime NOT NULL,
> >  `modified` datetime NOT NULL,
> >  PRIMARY KEY  (`id`)
> > ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
>
> > CREATE TABLE `users` (
> >  `id` int(11) NOT NULL auto_increment,
> >  `username` varchar(120) NOT NULL,
> >  `password` varchar(120) NOT NULL,
> >  `usergroup_id` int(11) NOT NULL,
> >  `created` datetime NOT NULL,
> >  `modified` datetime NOT NULL,
> >  PRIMARY KEY  (`id`),
> >  KEY `fk_usergroup_id` (`usergroup_id`)
> > ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
> > ---
>
> > Does anybody know why it would not recognize the other table?
>
> --
> Renan Gonçalves - Software Engineer
> Cell Phone: +55 11 8633 6018
> MSN: [EMAIL PROTECTED]
> São Paulo - SP/Brazil
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: MSSQL ntext problem

2008-07-16 Thread bitkidoku

Hmm so I am on the right track. The change is same as I did in
dbo_mssql.php. I will look into it.

On Jul 15, 9:40 pm, Nate <[EMAIL PROTECTED]> wrote:
> If the code above is the same as the method you patched in the core,
> then it should work fine.  Try examining the query output, and/or
> running the query in Enterprise Manager to get to a more informative
> error message.
>
> On Jul 15, 8:22 am, bitkidoku <[EMAIL PROTECTED]> wrote:
>
> > When I change the source it works fine. But when I try to extend the
> > driver I get the same error saying:
> > Warning (2): mssql_query() [function.mssql-query]: Query failed [CORE
> > \cake\libs\model\datasources\dbo\dbo_mssql.php, line 176]
>
> > I changed the database config to 'my_mssql'. And created the following
> > extension. I am obviously missing something but what?
>
> > - CODE START -
> >  > require (LIBS . 'model' . DS . 'datasources' . DS . 'dbo' . DS .
> > 'dbo_mssql.php');
>
> > class DboMyMssql extends DboMssql {
>
> >         var $description = "MSSQL DBO Extension Driver";
>
> >         // override this method to make ntext problem solved
> >         function fields(&$model, $alias = null, $fields = array(), $quote =
> > true) {
> >                 if (empty($alias)) {
> >                         $alias = $model->alias;
> >                 }
> >                 $fields = parent::fields($model, $alias, $fields, false);
> >                 $count = count($fields);
>
> >                 $fieldDescription = $this-> describe($model); // edit by 
> > b.e.d .
> > ref:https://trac.cakephp.org/attachment/ticket/4287/mssql_cake.patch
>
> >                 if ($count >= 1 && $fields[0] != '*' && strpos($fields[0],
> > 'COUNT(*)') === false) {
> >                         for ($i = 0; $i < $count; $i++) {
> >                                 $prepend = '';
>
> >                                 if (strpos($fields[$i], 'DISTINCT') !== 
> > false) {
> >                                         $prepend = 'DISTINCT ';
> >                                         $fields[$i] = 
> > trim(str_replace('DISTINCT', '', $fields[$i]));
> >                                 }
> >                                 $fieldAlias = count($this->__fieldMappings);
>
> >                                 if (!preg_match('/\s+AS\s+/i', 
> > $fields[$i])) {
> >                                         if (strpos($fields[$i], '.') === 
> > false) {
> >                                                 
> > $this->__fieldMappings[$alias . '__' . $fieldAlias] = $alias .
> > '.' . $fields[$i];
> >                                                 // edit by b.e.d start
> >                                                 //-$fieldName  = 
> > $this->name($alias . '.' . $fields[$i]);
> >                                                 //-$fieldAlias = 
> > $this->name($alias . '__' . $fieldAlias);
> >                                                 if 
> > ($fieldDescription[$fields[$i]]['type'] == 'text')
> >                                                 {
> >                                                         $fieldName  = 
> > "CAST(CAST(".$this->name($alias) . '.' . $this->name($fields[$i]) ." AS 
> > VARCHAR(8000)) AS TEXT)";
>
> >                                                         $fieldAlias = 
> > $this->name($alias . '__' . $fieldAlias);
> >                                                 }
> >                                                 else
> >                                                 {
> >                                                         $fieldName = 
> > $this->name($alias) . '.' . $this->name($fields[$i]);
>
> >                                                         $fieldAlias = 
> > $this->name($alias . '__' . $fieldAlias);
> >                                                 }
> >                                                 // edit by b.e.d end
> >                                         } else {
> >                                                 $build = explode('.', 
> > $fields[$i]);
> >                                                 
> > $this->__fieldMappings[$build[0] . '__' . $fieldAlias] =
> > $fields[$i];
> >                                                 $fieldName  = 
> > $this->name($build[0] . '.' . $build[1]);
> >                                                 $fieldAlias = 
> > $this->name(preg_replace("/^\[(.+)\]$/", "$1",
> > $build[0]) . '__' . $fieldAlias);
> >                                         }
> >                                         if 
> > ($model->getColumnType($fields[$i]) == 'datetime') {
> >                                                 $fieldName = 
> > "CONVERT(VARCHAR(20), {$fieldName}, 20)";
> >                                         }
> >                                         $fields[$i] =  "{$fieldName} AS 
> > {$fieldAlias}";
> >                                 }
> >                                 $fields[$i] = $prepend . $fields[$i];
> >                         }
> >                 }
> >   

Re: Onkeypress event

2008-07-16 Thread RJ

a bit doubt about $ajax->observeField(), when i keep
options['frequency'] =1 does it mean it makes ajax call every second
when the particular field is focussed or the ajax call is made only
when the value in the field is changed...

On Jul 16, 10:31 am, RJ <[EMAIL PROTECTED]> wrote:
> yes onblur wld be a good option..but m not able to find how to do
> that in cakephp.
> could any one help in this as to how to make an ajax call on any
> event(onBlur.onclick,etc)
>
> -RJ
>
> On Jul 15, 10:37 pm, Joel Perras <[EMAIL PROTECTED]> wrote:
>
> > Problem with using onkeydown for this is that the # of DB requests is
> > directly proportional to the length of the name being input; setting a
> > freq. of 1 sec seems like a good solution.  However, I can usually
> > input my name in less than a second.  Try performing the action on an
> > onblur instead of onkeydown; that'll retain the same functionality,
> > but reduce the # of requests to the DB.
>
> > -J.
>
> > On Jul 15, 9:27 am, RJ <[EMAIL PROTECTED]> wrote:
>
> > > hey got it when i put frequency of 1 sec , it gives the desired
> > > result.
> > > But as Mr Decot mentioned, it could be a lot on server...
>
> > > Thanks all
>
> > > On Jul 15, 6:15 pm, "Siegfried Hirsch" <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > I use frequecy for 1 seconds updates with the ajax call. Thats the way 
> > > > to handle
> > > > it without putting a burden on the server with every key stroke ;)
>
> > > > On Tue, Jul 15, 2008 at 3:11 PM, RJ <[EMAIL PROTECTED]> wrote:
>
> > > > > it doesn't work i guess ... i want to make ajax calls on 'onkeyup'
> > > > > event
> > > > > how to use $ajax->observeField for the same??
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how to set the root folder

2008-07-16 Thread RJ

anybody to help 

On Jul 16, 11:21 am, RJ <[EMAIL PROTECTED]> wrote:
> can't do it coz subversioning data resides in 'xyz' folder.
> The directory structure has remain that way...
> Ne way out?
>
> On Jul 16, 11:18 am, Duncan <[EMAIL PROTECTED]> wrote:
>
> > If you don't need the xyz dir, then why not move the whole cake
> > install one directory up? /htdocs/appName/app
>
> > On Jul 15, 11:15 pm, RJ <[EMAIL PROTECTED]> wrote:
>
> > > The directory structure is as follows:
> > > /htdocs/appName/xyz/app
>
> > > app is the folder that contains all the cakephp files. Now when i hit
> > > any url , it appears as:
>
> > >http://localhost/apName/xyz/users/login,
>
> > > but the requirement is such that 'xyz' should not appear in the url.
>
> > > How to achieve the same , i guess it has something to do
> > > with .htaccess file
>
> > > any help wld be appreciated
>
> > > -RJ
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Test Suite: parsing a CSV file, where to store file?

2008-07-16 Thread Marcin Domanski
From http://en.wikipedia.org/wiki/Test_fixture
"
--Examples of fixtures:

* loading a database with a specific, known set of data
* erasing a hard disk and installing a known clean operating
system installation
* copying a specific known set of files
* preparation of input data and setup/creation of fake or mock objects
"
I would also put it in fixture folder. I wouldn't put it out side of
tests/ folder (one should keep everything in one place ;)
You can also create a seperate folder in the tests dir...

--
Marcin Domanski
http://kabturek.info


On Wed, Jul 16, 2008 at 3:18 AM, aranworld <[EMAIL PROTECTED]> wrote:
>
> Thanks.  I just knew there had to be some conflicting opinions on
> this.  A webroot/files/tests directory maybe makes some sense?  tmp
> seems wierd, because the file shouldn't get deleted.
>
> -Aran
>
> On Jul 15, 2:47 pm, "Renan Gonçalves" <[EMAIL PROTECTED]> wrote:
>> Fixtures are for Model tests.
>> I think a "more standard place" to put the CSV file is on temporary
>> directory (/tmp) or on a webroot/files directory.
>>
>> []'s
>>
>> On Mon, Jul 14, 2008 at 10:35 PM, Grant Cox <[EMAIL PROTECTED]> wrote:
>>
>> > I do the same, and keep the file in fixtures.  Makes sense to me :)
>>
>> > On Jul 15, 8:33 am, aranworld <[EMAIL PROTECTED]> wrote:
>> > > I need to create a test case for the parsing of a tab delimited file.
>> > > Would it make sense to put the test version of this CSV file in the
>> > > fixtures directory of my test suite?  Or is there a more standard
>> > > place to put a file like this?
>>
>> --
>> Renan Gonçalves - Software Engineer
>> Cell Phone: +55 11 8633 6018
>> MSN: [EMAIL PROTECTED]
>> São Paulo - SP/Brazil
> >
>

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