about the controller insert data into two tables

2008-09-30 Thread flyingfish

hi everybody , now i have need to add user information into two
tables ,one is users,the other is usefields ,

in model , user hasOne usefield

now , i need to insert information into users and userfields at the
same time,

in my users_controller, i have the code like this


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

function add() {
$this->User->save($this->data);
$this->Userfield->save($this->data);
}


the problem is , if i use this add method, the code just insert data
into users tables


for your suggestion and solutions ,thank you

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



Database Conventions: 2 foreign keys to same table

2008-09-30 Thread James

I'm setting up a database that includes tracking of trades of baseball
teams. For the teams table I have:

CREATE TABLE teams (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
city VARCHAR(13),
name VARCHAR(12),
abbreviation VARCHAR(3)
);

I get lost when creating the trades table how do I set it up so
there's two foreign keys to the teams table? I'm trying to achieve
something along the lines of this:

CREATE TABLE trades (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
team2_id INT UNSIGNED NOT NULL,
team1_id INT UNSIGNED NOT NULL
);

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: CakePHP Auth - Basic Template User System

2008-09-30 Thread Tom Chapin

Hello,

Thank you for your reply!

I downloaded NeutrinoCMS and it looks like it has a functional user
login system, but I didn't see anything about new user registration in
it, though...

Does anyone know of any other cake apps out there that have fully
functional user authentication built in? Maybe I could mix and match
to get a complete picture.

I'd really like to put together a web app starter pack that just does
user registration/login/management (and does it well), and put it up
on cakeforge for people to use. I noticed a couple of other similar
concepts on the cakeforge, but for some reason, none of them had any
files available to download. Strange.

-Tom Chapin


On Sep 30, 6:17 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote:
> Try Neutrino CMS its fantasic; that uses auth. I downloaded some time ago; I
> have not used it on any projects though;   Its a working example you can
> learn from
>
> All you'd have to
>
> > do is throw some other models and controllers on it and you'd have a
> > complete web app.
>
> I have found adding auth to a site very easy, but I baked test projects and
> rebaked after mistakes.
>
> (There is plenty of info about auth)
>
> 2008/9/30 Tom Chapin <[EMAIL PROTECTED]>
>
>
>
> > I've been using CakePHP for a number of projects over the past two
> > years (and I love it).
>
> > One of the things that's been holding me back is the Auth system. I
> > was using a custom coded user system for CakePHP 1.1, and it worked
> > pretty well. However, now that I'm moving to 1.2, I found that it no
> > longer works, and I would really like to take advantage of the built-
> > in Authentication object instead of using some hacked together user
> > system. The only problem is that all the documentation I've been able
> > to find seems to be in pieces and all spread around. I haven't found
> > any complete, coherent examples of the 1.2 Auth user system in proper
> > use. All I've found are snippets and what not here and there.
>
> > Does anyone have (or know of) a ready-to-roll user system for CakePHP
> > 1.2? Like, just a basic CakePHP app that does nothing but User
> > registration (hopefully including sign up confirmation and forgotten
> > password emailing), User Login, and User Management? All you'd have to
> > do is throw some other models and controllers on it and you'd have a
> > complete web app.
>
> > If something like this existed and was open sourced and freely
> > available for people to use or improve on, I think it would be so
> > useful. I have a number of projects that I've dreamed up and have half-
> > built, and if I could just plug in a working user registration/login/
> > management piece, I could practically launch 3 different web apps
> > right now.
>
> > Any ideas?
>
> > Thanks,
>
> > Tom Chapin
> > Tornado Design
> > [EMAIL PROTECTED]
> >http://www.tornadodesign.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: Effect.Fade and Effect.Appear

2008-09-30 Thread Arak Tai'Roth

Anyone able to assist in this matter?

Not a big deal, as like I said, it works, I just wouldn't mind better.

On Sep 29, 3:27 am, "Arak Tai'Roth" <[EMAIL PROTECTED]> wrote:
> This is my ajax link that I am using:
>
> echo $ajax->link($html->image('/img/portfolio/small/' .
> $portfolio['Portfolio']['picture'], array('alt' =>
> $portfolio['Portfolio']['title'])), '/portfolios/view/' .
> $portfolio['Portfolio']['id'], array('update'=> 'case_study',
> 'complete' => 'Effect.Appear(\'case_study\', {duration: 2.0})'), null,
> false);
>
> Long I know. I can explain it more if you want me to, but the main
> part here that is my focus is this part:
>
> array('update'=> 'case_study', 'complete' =>
> 'Effect.Appear(\'case_study\', {duration: 2.0})')
>
> Now all of this works as it is. However what I wanted was that after
> the case_study div initially "appeared" was once another link was
> clicked I wanted it to fade away and have it re-appear when it was
> complete. So I thought I could add before the 'complete':
>
> 'before' => 'Effect.Fade(\'case_study\')
> or
> 'loading' => Effect.Fade(\'case_study\')
>
> Neither of these are working. What happens as soon as I add either of
> those, is the div vaguely appears and then suddenly disappears, never
> to appear again until another link appears and then it just continues
> that cycle.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: 'schema generate' and different connections (was: help with YAML pls basic syntax...etc)

2008-09-30 Thread forrestgump

Hey,
 So ive been messing around with cake schema for 2 days and i learnt y
i dont like it.

1)it doesnt let u insert data
2) it does not let you rollback
3)there is no way u can save ur queries and run them up anytime u feel
like with a simple command
4)all of the above makes team-development a pain in the a**

I would recommend migrationsand i would still like someone to tell
me the correct way to insert data using yaml

Forrestgump
http://techcrate.wordpress.com/2008/09/29/hello-world/


On Oct 1, 8:01 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
> Hi Mark,
>
> Schema seems to want to schemify all models using the same connection,  
> the one it automatically defaults to or the one that was specified,  
> ignoring the $useDbConfig setting in the model itself. Opened a ticket  
> for it:https://trac.cakephp.org/ticket/5502
>
> Chrs,
> Dav
>
> On 30 Sep 2008, at 23:22, mark_story wrote:
>
>
>
> > David,
>
> > So you have different models using different connections, and when
> > specifying a -connection
> > the shell is attempting to schem-ify models not using that connection?
>
> > If that is the case please open a ticket, with some examples on how to
> > reproduce it.
>
> > -Mark
>
> > On Sep 30, 1:53 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
> >> Speaking of which...
>
> >> I have multiple connections in my database.conf. Running a 'cake
> >> schema generate' always quits with "Error: Missing database table 'x'
> >> for model 'y'". Even doing 'schema -connection alt -name Model
> >> generate' quits with the same message. Depending on which '-
> >> connection' I specify it quits on different models, so it seems it
> >> always tries to generate schemas for all models, ignoring my flags.
>
> >> Am I misusing the schema shell or should I open a ticket?
>
> >> Chrs,
> >> Dav
>
> >> On 30 Sep 2008, at 05:03, mark_story wrote:
>
> >>> In 1.2 there is a builtin Schema shell (console app) that can manage
> >>> things like ALTER statements that need to be run on a db between  
> >>> runs.
> >>> To my knowledge it doesn't insert records.  From a prompt cd into
> >>> cake/
> >>> console and try cake schema help.  That will give you a list of
> >>> commands supported by the SchemaShell.
>
> >>> -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: sending mail through google server using EMail component

2008-09-30 Thread Gonzalo Servat
On Tue, Sep 30, 2008 at 10:10 PM, Zoltan <[EMAIL PROTECTED]> wrote:

>
> [..snip..]
>
> The settings I'm using are:
>
> function send( $subject = 'General', $msg ){
>$this->Email->from= '[EMAIL PROTECTED]';
>$this->Email->to  = 'Zoltan <[EMAIL PROTECTED]>';
>$this->Email->subject = $subject;
>$this->Email->replyTo = '[EMAIL PROTECTED]';
>
> /* SMTP Options */
>  $this->Email->smtpOptions = array(
>'host' => 'smtp.googlemail.com',
>'username'=> '[EMAIL PROTECTED],
>'password'=> 'PASSWORD';
>
> /* Set delivery method */
> $this->Email->delivery = 'smtp';
> /* Do not pass any args to send() */
> $this->Email->send($msg);
>
>
> I've tried these with other smtp accounts with no problems, but with
> Google the connection just seems to hang with a server time-out.
>
> Anyone have any luck with Google's server?
>

Hi,

I believe you need to use SSL with Google's mail server (not a plaintext
port 25 connection). I don't think the built-in email component supports SSL
so you might want to check out the SwiftMailer component (pay attention to
the $smtpType variable):

http://bakery.cakephp.org/articles/view/improved-swiftmailer-component

- Gonzalo

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: CakePHP Auth - Basic Template User System

2008-09-30 Thread Sam Sherlock
Try Neutrino CMS its fantasic; that uses auth. I downloaded some time ago; I
have not used it on any projects though;   Its a working example you can
learn from

All you'd have to
> do is throw some other models and controllers on it and you'd have a
> complete web app.


I have found adding auth to a site very easy, but I baked test projects and
rebaked after mistakes.

(There is plenty of info about auth)

2008/9/30 Tom Chapin <[EMAIL PROTECTED]>

>
> I've been using CakePHP for a number of projects over the past two
> years (and I love it).
>
> One of the things that's been holding me back is the Auth system. I
> was using a custom coded user system for CakePHP 1.1, and it worked
> pretty well. However, now that I'm moving to 1.2, I found that it no
> longer works, and I would really like to take advantage of the built-
> in Authentication object instead of using some hacked together user
> system. The only problem is that all the documentation I've been able
> to find seems to be in pieces and all spread around. I haven't found
> any complete, coherent examples of the 1.2 Auth user system in proper
> use. All I've found are snippets and what not here and there.
>
> Does anyone have (or know of) a ready-to-roll user system for CakePHP
> 1.2? Like, just a basic CakePHP app that does nothing but User
> registration (hopefully including sign up confirmation and forgotten
> password emailing), User Login, and User Management? All you'd have to
> do is throw some other models and controllers on it and you'd have a
> complete web app.
>
> If something like this existed and was open sourced and freely
> available for people to use or improve on, I think it would be so
> useful. I have a number of projects that I've dreamed up and have half-
> built, and if I could just plug in a working user registration/login/
> management piece, I could practically launch 3 different web apps
> right now.
>
> Any ideas?
>
> Thanks,
>
> Tom Chapin
> Tornado Design
> [EMAIL PROTECTED]
> http://www.tornadodesign.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
-~--~~~~--~~--~--~---



sending mail through google server using EMail component

2008-09-30 Thread Zoltan

Hello,

The mail on my website is done through a google account and I'm trying
to use that server to send mail (this is being done local from a site
running on XAMPP locally currently).

The settings I'm using are:

function send( $subject = 'General', $msg ){
$this->Email->from= '[EMAIL PROTECTED]';
$this->Email->to  = 'Zoltan <[EMAIL PROTECTED]>';
$this->Email->subject = $subject;
$this->Email->replyTo = '[EMAIL PROTECTED]';

/* SMTP Options */
  $this->Email->smtpOptions = array(
'host' => 'smtp.googlemail.com',
'username'=> '[EMAIL PROTECTED],
'password'=> 'PASSWORD';

/* Set delivery method */
$this->Email->delivery = 'smtp';
/* Do not pass any args to send() */
$this->Email->send($msg);
...

I've tried these with other smtp accounts with no problems, but with
Google the connection just seems to hang with a server time-out.

Anyone have any luck with Google's server?

Zoltan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: dealing with curly quotes

2008-09-30 Thread Adam Royle

If your database is correctly setup as utf8, cakephp db settings as
utf8 and your html is output as utf8, and make sure all of your code
is utf8 compliant (eg string conversion, etc) then you shouldn't have
any issues. Unless you just don't like the look of curly quotes?

Cheers,
Adam

On Oct 1, 8:39 am, Ryan <[EMAIL PROTECTED]> wrote:
> I'm using a UTF-8 character set and the curly single and double quotes
> are causing some problems with my app. I have a couple of questions
> regarding the best way to deal with (eliminate) them:
>
> Allow the curly quotes to go into the database, but convert them to
> straight quotes before display? Or convert them into straight quotes
> before going into the database?
>
> And beyond that fundamental issue, what is the best way to convert
> from curly to straight? I've dealt with similar issues in some of my
> non-Cake PHP applications and am wondering if Cake has any built-in
> functionality for dealing.
>
> 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: One controller for multiple models - Or any better design?

2008-09-30 Thread Adam Royle

I've used this before and it works well, with the ability to cache the
element easily as well.

http://bakery.cakephp.org/articles/view/creating-reusable-elements-with-requestaction

However, many people advise against using (abusing?) requestAction as
it executes a whole new page request.

If you cache the output however, it can be a good technique.

Cheers,
Adam

On Oct 1, 9:59 am, Jimmy Bourassa <[EMAIL PROTECTED]> wrote:
> I've been thinking about how to do this cakelike and so far I haven't
> found anything that is not messy (and mostly because I am fairly new
> to cake should I say)
>
> Heres what I would like to do. I have Games and Events. On my
> homepage, I want a "Coming up" section to show, let's say, the next
> five event/games ordered by date.
>
> So basically I need to gather information from two different models in
> one single view (or element I think it'll be). And I need to be able
> to order the whole lot by date.
>
> Should I create a controller that uses ($var uses) Games and Events?
>
> 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
-~--~~~~--~~--~--~---



CakePHP Auth - Basic Template User System

2008-09-30 Thread Tom Chapin

I've been using CakePHP for a number of projects over the past two
years (and I love it).

One of the things that's been holding me back is the Auth system. I
was using a custom coded user system for CakePHP 1.1, and it worked
pretty well. However, now that I'm moving to 1.2, I found that it no
longer works, and I would really like to take advantage of the built-
in Authentication object instead of using some hacked together user
system. The only problem is that all the documentation I've been able
to find seems to be in pieces and all spread around. I haven't found
any complete, coherent examples of the 1.2 Auth user system in proper
use. All I've found are snippets and what not here and there.

Does anyone have (or know of) a ready-to-roll user system for CakePHP
1.2? Like, just a basic CakePHP app that does nothing but User
registration (hopefully including sign up confirmation and forgotten
password emailing), User Login, and User Management? All you'd have to
do is throw some other models and controllers on it and you'd have a
complete web app.

If something like this existed and was open sourced and freely
available for people to use or improve on, I think it would be so
useful. I have a number of projects that I've dreamed up and have half-
built, and if I could just plug in a working user registration/login/
management piece, I could practically launch 3 different web apps
right now.

Any ideas?

Thanks,

Tom Chapin
Tornado Design
[EMAIL PROTECTED]
http://www.tornadodesign.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
-~--~~~~--~~--~--~---



One controller for multiple models - Or any better design?

2008-09-30 Thread Jimmy Bourassa

I've been thinking about how to do this cakelike and so far I haven't
found anything that is not messy (and mostly because I am fairly new
to cake should I say)

Heres what I would like to do. I have Games and Events. On my
homepage, I want a "Coming up" section to show, let's say, the next
five event/games ordered by date.

So basically I need to gather information from two different models in
one single view (or element I think it'll be). And I need to be able
to order the whole lot by date.

Should I create a controller that uses ($var uses) Games and Events?

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: Simple Ajax link to update div

2008-09-30 Thread qwanta

OK, I understand things a bit better now and got it to work. My
problem was that my editor renamed my default layout to
default.ctp.php causing the links to prototype & scriptaculous to not
register ( echo $javascript->link('prototype'); echo $javascript-
>link('scriptaculous'); ) to not register.

Now that I have something working, I thought I would lay out the steps
I took in case someone comes across this while looking for help:

So, to get a basic ajax example working with cakephp:

1) Download prototype from http://prototypejs.org/download. You should
end up with a javascript file like "prototype-1.6.0.3.js". Rename to
"prototype.js" and place in your "app\webroot\js" folder.

2) Download the script.aculo.us zip file from http://script.aculo.us/downloads.
You should end up with a zip file (for example: "scriptaculous-
js-1.8.1.zip"). Within is a "src" folder containing a bunch of *.js
files. Copy all these files and place them into your "app\webroot\js"
folder.

3) We now need to add the javascript and ajax helpers. One option is
to add them to each controller as needed, but it's easier to add them
to the app_controller to make them available to all controllers
automatically. Find "app_controller.php" in "\cake\libs\controller" &
copy it to your "\app" folder. Add one line to make the AppController
class definition look like this:
class AppController extends Controller {
var $helpers = array('Html','Form','Javascript','Ajax');
}

4) Every html page that uses javascript has to have something like
this in the head:  to indicate where the javascript functions are
located. In CakePHP the javascript helper can generate this line like
this $javascript->link('prototype'); So copy the default layout from
\cake\libs\view\layouts to \app\views\layouts and add these lines in
the head:
link('prototype');
echo $javascript->link('scriptaculous');
?>
Now all views that use the default layout are "javascript enabled".

5) Now that we have set things up, let's add a very simple example: an
ajax link that when clicked updates the text in a div:

create a new folder called "tests" inside \app\views\ and place the
following code in a file called simple_ajax1.ctp inside it:

simple_ajax1

link('link1',
array('controller'=>'tests' ,

'action'=>'simple_ajax1_fcn'),
array('update' => 'divout')
);

?>






6) Create a controller called tests_controller.php:

autoRender = false;
echo "text from ajax call";
}
}
?>


7) Now navigate to http://127.0.0.1/[cakephpapp]/tests/simple_ajax1
where [cakephpapp] is your app folder name, click the link, and you
should see the "text from ajax call" text appear in the div below the
link.

Comments:
1) Troubleshooting: to make sure the ajax call is happening, add some
parameters to the ajax link as follows:
echo $ajax->link('link1',
array('controller'=>'tests' ,

'action'=>'simple_ajax1_fcn'),
array('update' => 'divout',
'complete' => 
'alert( "Executed OK" )',
'loading'=> 
'alert("Loading")',
'loaded'=> 
'alert("Loaded")')
);
You'll then get an alert popup window when (from cake api):
* loading:: Called when the remote document is being loaded with
data by the browser.
* loaded:: Called when the browser has finished loading the remote
document.
* complete:: Called when the XMLHttpRequest is complete.

If no popup windows appear when the link is clicked, there is likely a
problem with the javascript setup.

2) What helped me understand things a bit better was getting a better
comprehension of the relationship between a cake view & controller.
Basically, when you type a cake link such as 
http://127.0.0.1/[cakephpaapp]/tests/simple_ajax1,
the function simple_ajax1 within the tests controller is executed. At
the end of the function an IMPLICIT call is made to then render the
view. If spelled out it would look like this: $this-
>render('simple_ajax1','default'); ('default' is the layout). We can
prevent this rendering from happening by placing the line $this-
>autoRender = false; in the controller function as I have done above.
Also, note that the render function is simply generating text and
returning it to the browser via http. Any text output with "echo" in
the controller function will also be sent back to the browser when it
browses to the function. To ill

dealing with curly quotes

2008-09-30 Thread Ryan

I'm using a UTF-8 character set and the curly single and double quotes
are causing some problems with my app. I have a couple of questions
regarding the best way to deal with (eliminate) them:

Allow the curly quotes to go into the database, but convert them to
straight quotes before display? Or convert them into straight quotes
before going into the database?

And beyond that fundamental issue, what is the best way to convert
from curly to straight? I've dealt with similar issues in some of my
non-Cake PHP applications and am wondering if Cake has any built-in
functionality for dealing.

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
-~--~~~~--~~--~--~---



Best solution to glue ACL authorized by action witch per element

2008-09-30 Thread [EMAIL PROTECTED]

So i have users>roles, roles: administrator and moderator can create
events, administrator have all privileges but moderator can delete
only he own events best solutions for it ?

now i have that

$this->Auth->authorize = 'actions';

ACL per action
ROOT
+Events
--create
--edit
--delete

Administartor CED
Moderator CE

Model Event ActAs Controlled

Controller Event create
$acoNode = array('model'=>$this->Event->name,   'foreign_key' =>$this-
>Event->id);
$aroNode = array('model'=>'User','foreign_key'=>$this->Auth-
>user('id'));   // User has full control of the action he created
// User has full control of the action he created
$role = $this->Auth->user('role');
if($role=='Administrator')
 $this->Acl->allow($aroNode, $acoNode, '*');
else
 $this->Acl->allow($aroNode, $acoNode, 'read','update');

What i must to do next for implement ACL per element witch cake auth
by action ??



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: pushing my luck -- complete pm system?

2008-09-30 Thread Markus Muschol

This should be kind of easy to write on your own

setup a new database table:

id  int
sender_id   int foreign key to user table
receiver_id int foreign key to user table
message varchar

Then create a message write form and a message list template for inbox  
and outbox.

The controller has some crud functions that can be generated by cake  
and a simple send and index function.

Thats it ;)

Regards

Am 30.09.2008 um 21:31 schrieb rocket:

>
> PM stands for private messages.
> basically a system inside cake that will allow my users to send
> messaages to eachother.
>
> On Sep 30, 12:35 pm, "Gonzalo Servat" <[EMAIL PROTECTED]> wrote:
>> On Tue, Sep 30, 2008 at 1:26 PM, rocket <[EMAIL PROTECTED]> wrote:
>>
>>> I'm about to write a PM system for users... but why invent the  
>>> wheel?
>>> Anyone know of a good prebuilt cake pm system, or a vendor I can  
>>> use?
>>
>> *
>> What does PM stand for?
>> Your abbreviation search returned 164 meanings*
>>
>> Which one of the 164 does your PM stand for?
>>
>> - Gonzalo
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: CHAR datatype problem

2008-09-30 Thread Donkeybob

Nevermind, it works fine with VARCHAR. . . .

On Sep 28, 11:14 am, Donkeybob <[EMAIL PROTECTED]> wrote:
> Can cake use this datatype? VARCHAR(36)?
>
> On Sep 27, 6:37 pm, Donkeybob <[EMAIL PROTECTED]> wrote:
>
> > I'm using a CHAR(36) for my id fields and my dev machine is fine with
> > that but when I move the table to the host server, the CHAR get
> > changed to a VARCHAR. What do I do with the automatic ID creation for
> > CHAR datatypes?
>
> > Rich
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: pushing my luck -- complete pm system?

2008-09-30 Thread rocket

PM stands for private messages.
basically a system inside cake that will allow my users to send
messaages to eachother.

On Sep 30, 12:35 pm, "Gonzalo Servat" <[EMAIL PROTECTED]> wrote:
> On Tue, Sep 30, 2008 at 1:26 PM, rocket <[EMAIL PROTECTED]> wrote:
>
> > I'm about to write a PM system for users... but why invent the wheel?
> > Anyone know of a good prebuilt cake pm system, or a vendor I can use?
>
> *
> What does PM stand for?
> Your abbreviation search returned 164 meanings*
>
> Which one of the 164 does your PM stand for?
>
> - Gonzalo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Find - table join - find all posts by user_id using the name

2008-09-30 Thread Benster

Cracked it!

$this->set('posts',$this->Post-
>find('all',array('conditions'=>array('User.name'=>$username;

Ben.

On Sep 30, 3:58 pm, Benster <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Im building a site where i would like to retrieve all articles based
> on a username.  The username is supplied as part of the url i.e.
> mysite.com/userName.
>
> So i need to use find to list all posts based on username however I
> only have user_id in the posts table, which then joins to the user
> table on id.
>
> So im looking for an example of how to run a find command passing in
> the username, and joining on the user_id to the user table.
>
> Can anyone advise?
>
> Best regards, Ben.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: CakePHP 1.1, AJAX and forms not doing anything.

2008-09-30 Thread aka

Yes Sorry clemos, was alittle tired on this afternoon.

Here is the question completely rewritten :)

1. Download the latest stable release of CakePHP (1.1.19.6305)
1.1 Set it up and running.

2. Download the prototype.js library and copy it to your fresh cake
installation "js" -folder.

3. Lets create the controller we need
3.1 create users_controller.php, source is here: 
http://bin.cakephp.org/view/228475902
3.2 create settings controller.php, source here: 
http://bin.cakephp.org/view/1561727948

4. Now we need some models too...
4.1 Let's create the user.php, source can be found here:
http://bin.cakephp.org/view/1560512038
4.2 Next we need the setting.php, get the source here:
http://bin.cakephp.org/view/325085541

5. We need three views as well... V for Views!
5.1 /users/index.thtml, source: http://bin.cakephp.org/view/227887042
5.2 /users/edit.thtml, source: http://bin.cakephp.org/view/1754502406
5.3 /settings/index.thtml, source: http://bin.cakephp.org/view/1797653162
view:settings/index

6. Let's modify the default layout a little (include the prototype
library and what not)
6.1 download this layout and save it under /views/layouts/test.thtml
(http://bin.cakephp.org/view/1757453857)

7. Now we are ready to begin testing...
7.1 browse to localhost/your/new/cake/installation/settings/
7.2 try to type something to the text field and press submit...
nothing happens. The browser doesen't send any XHR request.
7.3 click the link that says click me, this invokes an AJAX call
(which works BTW)
7.4 Click the link on that window again. That load the same view, that
we used in 7.1 and now the AJAX submit button works..

-Antti


prototype.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: Auth Redirect Problems

2008-09-30 Thread LunarDraco

In my original response, I mentioned there are a couple of
requirements for this auth redirect issue to present itself and fail.
1 - logoutRedirect has to point to the loginAction. (your example
doesn't)
2 - autoRedirect needs to be true. (your example is set to false)
3 - You've called the logout action from a link on different
controller/action page than the user/logout page.

And it really doesn't make much sense to have your loginRedirect
pointed to itself.

Your example will not show the problem. And it will not autoRedirect
to a controlled page after authentication either.

On Sep 30, 1:06 am, "Okto Silaban" <[EMAIL PROTECTED]> wrote:
> How come? I get no problem with the syntax.. It works fine for me..
>
> This is the full code in app/app_controller.php (I just copy paste it)
>
> beforeFilter()
> {
>         $this->Auth->loginAction = array('controller' => 'users', 'action'
> => 'login');
>         $this->Auth->logoutRedirect = '/';
>         $this->Auth->loginRedirect = array('controller' => 'users', 'action'
> => 'login');
>         $this->Auth->autoRedirect = FALSE;
>
> }
>
> Okto.Silaban.Net
>
> On Fri, Sep 26, 2008 at 10:00 PM, Tony Thomas <[EMAIL PROTECTED]> wrote:
>
> > This gives me an "unexpected T_VARIABLE" error on the line with $this-
> > >Auth->autoRedirect = FALSE;
>
> > I think the algorithm might be right, but the syntax is wrong.
>
> > On Sep 17, 12:20 pm, "Okto Silaban" <[EMAIL PROTECTED]> wrote:
> > > I'm not really sure, but I think :
> > > $this->Auth->loginRedirect
>
> > > doesn't tell we're we gonna go after logging in..
>
> > > But, if we're acessing an area which not allowed by Auth, we will sent to
> > > that page.. (if you're not login yet..).
>
> > > So I set that in beforeFilter :
>
> > > function beforeFilter() {
> > >   $this->Auth->loginRedirect = array('controller' => 'controller_name',
> > > 'action' => 'index');
> > >    $this->Auth->autoRedirect = FALSE; // so after logging in we're not
> > auto
> > > redirected
>
> > > }
>
> > > then manually set
>
> > > function login() {
> > >     $this->redirect('somewhere');
> > >     exit();
>
> > > }
> > > On Tue, Sep 9, 2008 at 10:12 PM, Tony Thomas <[EMAIL PROTECTED]> wrote:
>
> > > > If someone is familiar with a post to this group or blog entry that
> > > > addresses this issue, please let me know. I've spent the morning
> > > > scouring both with no satisfactory results.
>
> > > > I have a cakePHP app on a shared server. In local testing, everything
> > > > worked fine. But mod_rewrite did not function properly on the shared
> > > > server, so I'm using CakePHP pretty URLS instead. Also caching (at
> > > > least temporarily) is off. I've uncommented the pertinent lines of
> > > > code in core.php and I've dutifully deleted the .htaccess files.
>
> > > > The problem I have is that after logging in, the redirect is
> > > > inconsistent. About 2/3 of the time I get redirected to
> > > >https://[base_url]/https:/[domain]. I just can't seem to find away
> > > > around this problem.
>
> > > > My login function looks like this:
>
> > > > function login() {
> > > >                        $this->Auth->loginRedirect = array('controller'
> > =>
> > > > 'controller_name', 'action' => 'index');
> > > >    }
>
> > > > I still get inconsistent results with the redirect going to a URL like
> > > > the former example the majority of the time. Any insight, links, etc.
> > > > would be appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: 'Undefined index' problem on production server

2008-09-30 Thread Pieter Van Leuven

Ok, I did some research and discovered the following:

On my local system I have a query like this:  (as seen in the query
overview delivered by CakePHP when running in debugmode 2)

"SELECT `Post`.`id`, `Post`.`title`, `Post`.`content`,
`Post`.`created`, `Post`.`modified`, `Post`.`user_id`,
`Post`.`category_id`, `User`.`id`, `User`.`username`,
`User`.`password`, `User`.`emailaddress`, `User`.`created`,
`User`.`last_login`, `User`.`active`, `User`.`is_admin`,
`Category`.`id`, `Category`.`name` FROM `posts` AS `Post` LEFT JOIN
`users` AS `User` ON (`Post`.`user_id` = `User`.`id`) LEFT JOIN
`categories` AS `Category` ON (`Post`.`category_id` = `Category`.`id`)
WHERE 1 = 1 ORDER BY `Post`.`created` desc LIMIT 10"

On the online webserver, the exact same query looks like this:

"SELECT `Post`.`id`, `Post`.`title`, `Post`.`content`,
`Post`.`created`, `Post`.`modified`, `Post`.`user_id`,
`Post`.`category_id` FROM `posts` AS `Post` WHERE 1 = 1 ORDER BY
`Post`.`created` desc LIMIT 10"

This problem occurs even when I deleted the cache. Somebody an idea
how this is possible? Why would CakePHP decide to not fetch relative
data? Is there a way to eventually force this?

Below I posted the code, but I think nothing is wrong with that. It's
as simple as it can be.

Code in 'post' model:
// Relaties
var $belongsTo = array('User','Category');
var $hasMany = array(
'Comment' => array(
'className' => 'Comment',#
'foreignKey' => 'node_id',
'conditions' => 'contenttype_id = 1',
'order' => 'Comment.created DESC'
 )
);

Code in 'posts' controller:
$posts = $this->paginate('Post');
$this->set(compact('posts'));

Example code from view:
link($post['User']['username'], '/
users/view/'.$post['User']['username']); ?> als link($post['Category']['name'], '/categories/view/'.$post['Category']
['id']); ?>

On 30 sep, 12:37, Pieter Van Leuven <[EMAIL PROTECTED]>
wrote:
> Ah I see. I switched the error reporting value for my local PHP to
> E_ALL, but I'm getting no errors at all. It has indeed to be
> difference in configuration between my local machine and the online
> server, but I have absolutely what it could be.
>
> Is the fact that I didn't build the models with the bake command
> relevant? I build them myself. It's my first project with CakePHP. If
> you want, to take a look, the project can be found 
> here:http://kljichtegem.be/beta/.
>
> Kind regards.
>
> On 30 sep, 11:58, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>
> > No, I mean the PHP error reporting in your 
> > php.ini.http://jp2.php.net/manual/en/configuration.phphttp://jp2.php.net/manu..
>
> > The error is coming from PHP, not Cake.
> > You should switch error reporting on on your development system and  
> > off on your production system. If the error reporting is on on your  
> > development system and it's not giving you any errors (i.e. no  
> > programming mistakes) it'll be something that's set up differently on  
> > your production machine.
>
> > On 30 Sep 2008, at 18:48, Pieter Van Leuven wrote:
>
> > > Hello David,
>
> > > thanks for the tips. Both are currently running in debuglevel 2 mode.
> > > That's why I think it's so strange.
>
> > > Can someone give me some tips about what could be wrong with the
> > > database? The application can reach the database, because some data is
> > > fetched correctly...
>
> > > Thanks in advance,
> > > Pieter Van Leuven
>
> > > On 30 sep, 07:37, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
> > >> Stabs into the dark:
>
> > >> a) your local PHP has a lower debug level than your production  
> > >> server,
> > >> i.e. your local system doesn't complain about missing indexes but  
> > >> your
> > >> server does
> > >> b) the associated model can't be fetched because your database setup
> > >> is different/misconfigured
>
> > >> Hope that helps,
> > >> Dav
>
> > >> On 30 Sep 2008, at 06:26, Pieter Van Leuven wrote:
>
> > >>> Hello people,
>
> > >>> I have a strange problem i ran into with CakePHP. On my local  
> > >>> machine
> > >>> all works fine. When I upload the complete project to my webhost,  
> > >>> the
> > >>> problems begin.
>
> > >>> For example: when I query posts from the database. All fields of  
> > >>> this
> > >>> posts are shown fine (for example $post['Post']['title'], but all
> > >>> relative data like for example the username ($post['User']
> > >>> ['username']) gives an error similar to 'Notice (8): Undefined
> > >>> index:'. Someone an idea what the problem could be?
>
> > >>> Could this be a know problem? I tried to search, but it is difficult
> > >>> with that less information.
>
> > >>> Some things I already thought of:
> > >>> - Version difference of apache/mysql from my local machine/webhost
> > >>> server
> > >>> - windows newlines on my local machine versus webhost server (not
> >

Finding records that have associated records

2008-09-30 Thread Daniel

I'm a bit of a newbie when it comes to CakePHP and MySQL and I'm not
really sure about all of the terminology involved, so if this question
has been asked before, I apologize.

I have three models:

Skill
Tree
Link

A Skill hasAndBelongsToMany Links.  A Skill hasMany Trees.  Under
normal circumstances, a Skill should have at least 1 Link and 1 Tree.
But there are valid reasons that a Skill may have 0 Links and/or 0
Trees (e.g. when the Skill is a work-in-progress), but the casual end-
user of the site shouldn't really see these.  Since there are
currently 707 Skills, I use Paginator to display them.

What I want to do is create some kind of Paginator query or condition
that will only display Skills that have 1 or more Links and 1 or more
Trees.

(I know I could probably do it easily using a tree_count and
link_count field in the skills table, but that'll be a lot of hassle
to set up.  I was thinking there might be some better way to use, say,
a MySQL COUNT() function instead.)

Any thoughts?  Thanks for your help!

Daniel

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



html helper issue

2008-09-30 Thread soosa
Hello guys,
while i was trying to add some meta data in the header of my project i was
able to add a "description" meta using a call to the html helper object,
something like "echo $html->meta( 'description', 'some text here', array(),
false );" to output (  ),
and likewise i was able to add the "keywords" meta but when i was trying to
add other meta(s) like (Author, Abstract, Copyright ... etc) the output
wasn't as expected when dealing with description and keywords, is there any
way to generate the output for those metas as dealing with description and
keywords metas?

Thanks in advance for any replies.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Any freelance jobs?

2008-09-30 Thread BrendonKoz

http://cakephp.org/jobs
http://withcake.com/

On Sep 28, 4:33 am, evert0n <[EMAIL PROTECTED]> wrote:
> Hi, guys anyone need a hand for cakephp projects?
>
> I'm avaliable for any opportunities as freelance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



Schema troubles

2008-09-30 Thread neverlosty

Hi,

I'm having some trouble with schemas. I'm using 1.2.x.x trunk.

I'm using it to migrate my  DB by using the update feature.
I use schema generate to do a snapshot of my development DB and use
schema update on prod with the generated schema file.

However, I've run into a few different problems:
1) It always seems to crash one of my tables every time, and even if I
repair it doesn't help, I must drop and create the table again:

var $jobs = array(
'id' => array('type'=>'integer', 'null' => false, 
'default' =>
NULL, 'key' => 'primary'),
'dispatch_line_id' => array('type'=>'integer', 'null' 
=> true,
'default' => NULL, 'key' => 'index'),
'personalized_product_id' => array('type'=>'integer', 
'null' =>
false, 'default' => NULL, 'key' => 'index'),
'price' => array('type'=>'float', 'null' => false, 
'default' =>
NULL, 'length' => '12,4'),
'quantity' => array('type'=>'integer', 'null' => false, 
'default'
=> NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 
'unique' =>
1), 'product' => array('column' => 'personalized_product_id', 'unique'
=> 0), 'dispatch_line' => array('column' => 'dispatch_line_id',
'unique' => 0))
);


2) It has trouble with primary key switching. I had a linking table
with 2 columns as a combined primary key. I then introduced a new
column called ID and wanted to use that instead as the primary key. It
seems to not handle it so well and doesn't do the update.


Has anyone else had great success with cake schemas in a production
environment to do updates?

thanks,
Tony.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: pushing my luck -- complete pm system?

2008-09-30 Thread Pieter Van Leuven

I guess PM stands for 'Personal Messaging' system.

On 30 sep, 18:35, "Gonzalo Servat" <[EMAIL PROTECTED]> wrote:
> On Tue, Sep 30, 2008 at 1:26 PM, rocket <[EMAIL PROTECTED]> wrote:
>
> > I'm about to write a PM system for users... but why invent the wheel?
> > Anyone know of a good prebuilt cake pm system, or a vendor I can use?
>
> *
> What does PM stand for?
> Your abbreviation search returned 164 meanings*
>
> Which one of the 164 does your PM stand for?
>
> - Gonzalo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: pushing my luck -- complete pm system?

2008-09-30 Thread Gonzalo Servat
On Tue, Sep 30, 2008 at 1:26 PM, rocket <[EMAIL PROTECTED]> wrote:

>
> I'm about to write a PM system for users... but why invent the wheel?
> Anyone know of a good prebuilt cake pm system, or a vendor I can use?
>
*
What does PM stand for?
Your abbreviation search returned 164 meanings*

Which one of the 164 does your PM stand for?

- Gonzalo

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Wrong i18n query

2008-09-30 Thread BrendonKoz

Without posting the CakePHP code you used to generate your query,
there is little anyone can offer to help.  Hopefully, however, you've
gotten this straightened out by now.

On Sep 24, 12:21 pm, davidhc <[EMAIL PROTECTED]> wrote:
> Hi at all!
> I'm using i18n and i'm trying to search results with a form. But
> cakephp creates a wrong query. I get the error below:
> SQL Error: 1054: Unknown column 'Category.names' in 'where clause'
>
> The query is:
> SELECT `Category`.*, `I18n__name`.`content`, `Category`.`id` FROM
> `categorys` AS `Category` LEFT JOIN `i18n` AS `I18n__name` ON
> (`Category`.`id` = `I18n__name`.`foreign_key` AND `I18n__name`.`model`
> = 'Category' AND `I18n__name`.`field` = 'name') WHERE
> `Category`.`names` LIKE '%AAA%' AND `I18n__name`.`locale` = 'en';
>
> But it should be:
> SELECT `Category`.*, `I18n__name`.`content`, `Category`.`id` FROM
> `categorys` AS `Category` LEFT JOIN `i18n` AS `I18n__name` ON
> (`Category`.`id` = `I18n__name`.`foreign_key` AND `I18n__name`.`model`
> = 'Category' AND `I18n__name`.`field` = 'name') WHERE
> `I18n__name`.`content` LIKE '%AAA%' AND `I18n__name`.`locale` = 'en'
>
> Note that the table name and the field name are wrong!
>
> I think cakephp should create a wright query...
>
> I hope you can help me...
> Thank you 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
-~--~~~~--~~--~--~---



pushing my luck -- complete pm system?

2008-09-30 Thread rocket

I'm about to write a PM system for users... but why invent the wheel?
Anyone know of a good prebuilt cake pm system, or a vendor I can use?

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: how to save twice??

2008-09-30 Thread rocket

perfect the ->create() works
i'd also like to tell others it unsets $this->data


On Sep 30, 12:03 pm, grigri <[EMAIL PROTECTED]> wrote:
> > Btw, you also have saveAll(), which allows to save multiple records at
> > once.
>
> The 1.1 people don't have that
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: page refresh?

2008-09-30 Thread rocket

just implmemented it works. lol
cool :) i ended up doing a md5 on time() :)

On Sep 30, 11:30 am, rocket <[EMAIL PROTECTED]> wrote:
> interesting fix. thanks
>
> On Sep 29, 5:15 pm, "3lancer.eu" <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > > but when you change the picture, the old picture is still stuck in the
> > > cache, so to see the new pic the user needs to push F5... I can't
> > > figure out how to "refresh" the page automatically.
>
> > > any ideas?
>
> > Simplest way is to add some random query string at the end of the url,
> > likehttp://example.com/images/some_profile_image.jpg?andThisIsSomeHash
>
> > It would be good to utilize the browser cache the proper way, so you
> > can try to set 'andThisIsSomeHash' to something like
> > md5($myModel['MyModel']['modified']) or md5(filemtime('images/
> > some_profile_image.jpg'));
>
> > Regards,
> > Piotr
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 save twice??

2008-09-30 Thread grigri

> Btw, you also have saveAll(), which allows to save multiple records at
> once.

The 1.1 people don't have that


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



Re: override built-in validation methods

2008-09-30 Thread grigri

I frequently override validation functions in AppModel, it works fine
for me.

Put a debug statement inside your AppModel's alphaNumeric method. If
it appears, then the problem is in your regexp/validation handling. If
it doesn't appear, you've probably got a typo in the method name.

Also make sure that your AppModel method prototype matches the 'Custom
Validation Methods' prototype from the manual, as it is NOT the same
as the prototype for Validation::alphaNumeric (first parameter of
model validation methods is an array: { key => value }, parameters of
Validation class methods are all scalar).

Actually, this last one sounds like it might well be the answer.

hth
grigri

On Sep 30, 4:49 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Is anyone knows how to properly overrdie a bult-in validation
> function?
>
> I just created in my app_model.php file a function named alphaNumeric,
> the whole function is the same as the built-in, I just changed the
> regex.
>
> Still I get error message:
> Warning (2): preg_match() expects parameter 2 to be string, array
> given [CORE/cake/libs/validation.php, line 830]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 save twice??

2008-09-30 Thread teknoid

Btw, you also have saveAll(), which allows to save multiple records at
once.

On Sep 30, 11:50 am, teknoid <[EMAIL PROTECTED]> wrote:
> you need to call $this->Post->create(); before the second save, that
> is if you are getting an update instead of an insert, but you've never
> specified what problem you are actually having.
>
> On Sep 30, 11:29 am, rocket <[EMAIL PROTECTED]> wrote:
>
> > I am trying to save an entry twice after getting processed.
>
> > Ideally the query would look like
>
> > $this->Post->save($this->data()); // the first save, so in the mySQL
> > db it will have id 1
> > $this->Post->save($this->data()); // a second save, so another row
> > with id 2
>
> > However it doens't seem to work correctly.
> > Does anyone knwo what I'm doing wrong?
>
> > also, i'm on 1.1x
>
> > thanks
> > rocket
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 save twice??

2008-09-30 Thread teknoid

you need to call $this->Post->create(); before the second save, that
is if you are getting an update instead of an insert, but you've never
specified what problem you are actually having.

On Sep 30, 11:29 am, rocket <[EMAIL PROTECTED]> wrote:
> I am trying to save an entry twice after getting processed.
>
> Ideally the query would look like
>
> $this->Post->save($this->data()); // the first save, so in the mySQL
> db it will have id 1
> $this->Post->save($this->data()); // a second save, so another row
> with id 2
>
> However it doens't seem to work correctly.
> Does anyone knwo what I'm doing wrong?
>
> also, i'm on 1.1x
>
> thanks
> rocket
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 save twice??

2008-09-30 Thread Daniel Hofstetter

Hi rocket,

> I am trying to save an entry twice after getting processed.
>
> Ideally the query would look like
>
> $this->Post->save($this->data()); // the first save, so in the mySQL
> db it will have id 1
> $this->Post->save($this->data()); // a second save, so another row
> with id 2
>
> However it doens't seem to work correctly.
> Does anyone knwo what I'm doing wrong?
>
> also, i'm on 1.1x

Call $this->Post->create() before the second save() to reset the
models state.

Hope that helps!

--
Daniel Hofstetter
http://cakebaker.42dh.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
-~--~~~~--~~--~--~---



override built-in validation methods

2008-09-30 Thread [EMAIL PROTECTED]

Is anyone knows how to properly overrdie a bult-in validation
function?

I just created in my app_model.php file a function named alphaNumeric,
the whole function is the same as the built-in, I just changed the
regex.

Still I get error message:
Warning (2): preg_match() expects parameter 2 to be string, array
given [CORE/cake/libs/validation.php, line 830]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Simple Ajax link to update div

2008-09-30 Thread qwanta

Thanks for the reply.

I placed an fwrite statement in ajaxfcn1() and it is writing to file.
So I'm getting as far as triggering ajaxfcn1 now. But the div isn't
updating.
I guess what I am having trouble understanding is how CakePHP
generates a response to the asynchronous call. With the standard
javascript XMLhttprequest object, the server-side php usually
generates an xml response containing the desired data to be is sent
back to the client.

eg. something like this:
===
';
// create the  element
echo '';
//
echo $data;
// close the  element
echo '';
?>
=

then you can use $data on the client side javascript, for example
placing it in a  element.

I understand that this is abstracted out in CakePHP, but I am having a
hard time understanding the process conceptually. In CakePHP how is
this xml data generated? (how do I place data in the response to be
passed back to the client)? And how do I update divs with it? (without
having access to js functions like
document.getElementById("divout").innerHTML). thanks

On Sep 30, 9:07 am, Donkeybob <[EMAIL PROTECTED]> wrote:
> it looks like your syntax is wrong for the ajax link . . .no
> parenthesis around '$ajax->link' code either . . .check 
> outhttp://book.cakephp.org/view/212/Methodsfor proper syntax.
>
> from the manual related to your code
> link('View Post',
> array( 'controller' => 'tests', 'action' => 'ajaxfcn1', 1 ),
> array( 'update' => 'divout', 'complete' => 'alert( "Executed
> OK" )' )
>  );
> ?>
>
> in your controller function:
>
> echo "Controller Executed";
>
> as long as protoptype is linked up, then that should work.
>
> On Sep 29, 11:56 pm, qwanta <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> > I have been struggling a bit to get a simple Ajax link working. I have
> > searched this group for help in older posts, but it seems like a key
> > tutorial (the grahambird one) is no longer available - perhaps because
> > it no longer works with 1.2.
>
> > If there is a tutorial somewhere that covers this, please let me know.
> > I think I have gone over all the available (through google) CakePHP
> > ajax tutorials, but unfortunately without success - some are outdated
> > (pre 1.2), others do not have full working code etc...
>
> > In any case, here is my code:
> > 
> > index.ctp
> > Ajax 3 - testing ajax link and button
> >  > $link_array1 = array('controller'=>'tests' ,
> > 
> > 'action'=>'ajaxfcn1');   // the function to execute: function
> > ajaxfcn1 in controller tests
>
> > $link_array2 = array( 'update' => 'divout',
> > 'complete' 
> > => 'alert( "Executed OK" )' );  // the div we want
> > to update
>
> > echo ($ajax->link('this an ajax link', $link_array1,
> > $link_array2,'Confirmation String'));
>
> > echo "";
>
> > echo ($ajax->submit('this is an ajax button', $link_array1,
> > $link_array2,'Confirmation String'));
> > ?>
> > 
> > 
> > the div to update
> > 
> > 
> > tests_controller.php
> >  > class TestsController extends AppController {
>
> > var $name = 'Tests';
> > var $uses = array();// prevent cake from looking for a 
> > database
> > model
>
> > function index() {
>
> > }
>
> > function ajaxfcn1() {
> > $this->render('index', 'ajax');
> > }}
>
> > ?>
> > 
>
> > So basically I have a view with an ajax link, an ajax button, and a
> > . I would like to change the text in the div when I click the
> > link or button. At this point, nothing happens when I click them. I am
> > not sure if the ajaxfcn1() function is even executing at this point.
> > What's an easy statement to add in ajaxfcn1() to determine if the code
> > is executing? What function would I use to set the new div text from
> > within ajaxfcn1()?
>
> > 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: page refresh?

2008-09-30 Thread rocket

interesting fix. thanks

On Sep 29, 5:15 pm, "3lancer.eu" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> > but when you change the picture, the old picture is still stuck in the
> > cache, so to see the new pic the user needs to push F5... I can't
> > figure out how to "refresh" the page automatically.
>
> > any ideas?
>
> Simplest way is to add some random query string at the end of the url,
> likehttp://example.com/images/some_profile_image.jpg?andThisIsSomeHash
>
> It would be good to utilize the browser cache the proper way, so you
> can try to set 'andThisIsSomeHash' to something like
> md5($myModel['MyModel']['modified']) or md5(filemtime('images/
> some_profile_image.jpg'));
>
> Regards,
> Piotr
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



how to save twice??

2008-09-30 Thread rocket

I am trying to save an entry twice after getting processed.

Ideally the query would look like

$this->Post->save($this->data()); // the first save, so in the mySQL
db it will have id 1
$this->Post->save($this->data()); // a second save, so another row
with id 2

However it doens't seem to work correctly.
Does anyone knwo what I'm doing wrong?

also, i'm on 1.1x

thanks
rocket
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: validate alphanumeric

2008-09-30 Thread [EMAIL PROTECTED]

It seems somehow the root of the problem is I try to override the
built-in alpaNumeric function. Still no idea how to solve it
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Find - table join - find all posts by user_id using the name

2008-09-30 Thread Benster

Hi,

Im building a site where i would like to retrieve all articles based
on a username.  The username is supplied as part of the url i.e.
mysite.com/userName.

So i need to use find to list all posts based on username however I
only have user_id in the posts table, which then joins to the user
table on id.

So im looking for an example of how to run a find command passing in
the username, and joining on the user_id to the user table.

Can anyone advise?

Best regards, Ben.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 model without a database for form

2008-09-30 Thread sniper

 Hi
I am not sure if this has already been asked, but i couldnt find the
answer anywhere sad.gif

Anyway my question is
i have a controller,model and view
i dont want to use database/tables since persistance will be
webservice(soap) based.
and i am using cake_1.2.0.7296-rc2.
PHP Code
data)) {

if ($this->Cheer->save($this->data)) {
$this->flash('Your post has been saved.', '/cheers');
}else
{
$this->flash('Your post has NOT been saved.', '/
cheers');
}
}
}
}

/**
* cheer.php
*/
class Cheer extends AppModel
{
var $name = "Cheer";
var $useTable = false;
}

/**
* add.ctp
*/
echo $form->create('Cheer');

?>

throws this error
CODE

Fatal error: Call to a member function schema() on a non-object in C:
\xampp\htdocs\cake_1.2.0.7296-rc2\cake\libs\view\helpers\form.php on
line 127

what more do i need to do? after much googling it looks like i have to
override schema() function in my model.
but i cant seem to figure out how? i tried to return a array but still
doesnt work
PHP Code
 array('type' => 'string','null' => 1, 'default' =>
'','length' => 30),
 'msg' => array('type' => 'string','null' => 1, 'default' =>
'','length' => 30),
   'senderId' => array('type' => 'string','null' => 1,
'default' => '','length' => 30)
);
function schema($field = false)
{
return $this->_schema;
}
}

?>

Any help, direction would be a greatly 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: javascipt onclick in $html->image

2008-09-30 Thread ORCC

Double quotes should work too:

'on_click' => "open_win($id);"

On 30 sep, 10:37, bartez <[EMAIL PROTECTED]> wrote:
> Panic over
>
> answer is:
>
> 'onclick'=>'open_win('. $id .')'
>
> cheers
>
> a
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: javascipt onclick in $html->image

2008-09-30 Thread bartez

Panic over


answer is:

'onclick'=>'open_win('. $id .')'


cheers

a
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: 'schema generate' and different connections (was: help with YAML pls basic syntax...etc)

2008-09-30 Thread mark_story

David,

So you have different models using different connections, and when
specifying a -connection
the shell is attempting to schem-ify models not using that connection?

If that is the case please open a ticket, with some examples on how to
reproduce it.

-Mark

On Sep 30, 1:53 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
> Speaking of which...
>
> I have multiple connections in my database.conf. Running a 'cake
> schema generate' always quits with "Error: Missing database table 'x'
> for model 'y'". Even doing 'schema -connection alt -name Model
> generate' quits with the same message. Depending on which '-
> connection' I specify it quits on different models, so it seems it
> always tries to generate schemas for all models, ignoring my flags.
>
> Am I misusing the schema shell or should I open a ticket?
>
> Chrs,
> Dav
>
> On 30 Sep 2008, at 05:03, mark_story wrote:
>
> > In 1.2 there is a builtin Schema shell (console app) that can manage
> > things like ALTER statements that need to be run on a db between runs.
> > To my knowledge it doesn't insert records.  From a prompt cd into
> > cake/
> > console and try cake schema help.  That will give you a list of
> > commands supported by the SchemaShell.
>
> > -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
-~--~~~~--~~--~--~---



javascipt onclick in $html->image

2008-09-30 Thread bartez

hey all,

This is really bugging me and i'm sure it's something that i'm not
doing.

my code is:

$id = $module['Module']['id'];
echo $form->input($module['Module']['refer_name'],
array(

'label'=>$module['Module']['title'].$html->image('1/
question.gif',
array(
'class'=>'question',

'onclick'=>'open_win($id)'
)),
'type'=>'checkbox',

'value'=>$module['Module']['price'],
'onclick'=>'addValue(this)'
));



This issue is with the onclick => open_win($id). it is not being
passed correctly. I have tried various combinations and they are as
follows:
(the code works fine if i pass a number through: open_win(1))

In this example, $id is equal to 2.


$id = blank, i.e it is defined but as blank
'$id' = error (unexpected T_VARIABLE)
"$id" = $id (not the value)
 = blank, i.e. it is defined but as blank
'' = error (unexpected '?')
"" =  not the value

Has anyone come across this before or has anyone got some pointers?

Cheers

alex
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



Umlauts and regular expressions

2008-09-30 Thread thomas

Hi,

I use 1.2.0.7296 RC2 and got problems to check user input via regular
expressions.

In my project, users are able to change their name. Works well, except
when entering umlauts. My regex always identifies umlauts as illegal
characters.

The $validate array for the field looks like this:

'displayname' => array(
   'rule' => array('custom', '/^[\w\p{L}\40]*$/u'),
   'message' => 'illegal_characters'
)

In the html header the meta tag

is there.

I have no further idea how to solve this.

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



Re: app_controller.php causing errors with my app

2008-09-30 Thread dr. Hannibal Lecter

No problem.

Perhaps you had moment of "crazy"? :-)

On Sep 30, 3:07 pm, Ryan <[EMAIL PROTECTED]> wrote:
> That did it. What was I thinking?!
>
> Thank you
>
> On Sep 30, 4:47 am, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote:
>
> > This may be a dumb suggestion, but try removing the "var $name =
> > 'AppController';" line and see if that helps.
>
> > It's not correct anyways, or at least seems incorrect to me.
>
> > On Sep 29, 11:57 pm, Ryan <[EMAIL PROTECTED]> wrote:
>
> > > I am working on a new app and everything was playing nicely until I
> > > added a simple app_controller.php in order to take advantage of the
> > > Firecake helper:
>
> > >  > > class AppController extends Controller {
> > >         var $name = 'AppController';
> > >         var $helpers = array('Html', 'Form', 'Javascript', 'Firecake');}
>
> > > ?>
>
> > > Now I am getting errors:
>
> > > Notice (8): Undefined property: ItemsController::$Item [APP/
> > > controllers/items_controller.php, line 6]
>
> > > Fatal error: Call to a member function find() on a non-object in /web/
> > > php/balistik_list_app/app/controllers/items_controller.php on line 6
>
> > > When I delete app_controller.php everything works again. Any ideas?
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: bigner for cake

2008-09-30 Thread PaulW

On Sep 30, 8:28 am, anjum <[EMAIL PROTECTED]> wrote:
> I am also getting same error on this example I putted the file into
> app/view/tasks/index.ctp

Hi I assume you are both working through the samples in the book
CakePHP Application Development by Ahsanul Bari and Anupom Syam? If so
I have done these and they do work.

anjum - It might just be a typo in your message but that should be
'views' not 'view'...

app/views/tasks/index.ctp

akhilesh - I agree with Donkeybob your index.ctp should be in a sub
folder called...

app/views/tasks/index.ctp
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: bigner for cake

2008-09-30 Thread villas

Hi,  As you have already created a table,  why not try to use the
commandline 'Cake Bake' script?
This should give you a flying start and create everything you
need  :-)


On Sep 23, 12:31 pm, akhilesh <[EMAIL PROTECTED]> wrote:
> http://localhost/myfirstcake/
> this is my cake folder name
> --
>
> i have set in httpd.conf both
>
> Apache mod_rewrite module is switched on
> AllowOverride is set to all
>
> temp dir is writable
> -
> table sturucture is
>
> CREATE TABLE tasks (
> id int(10) unsigned NOT NULL auto_increment,
> title varchar(255) NOT NULL,
> done tinyint(1) default NULL,
> created datetime default NULL,
> modified datetime default NULL,
> PRIMARY KEY (id)
> );
>
> database.php.default. Rename to database.php
>
> my database configuration file is present and Cake is able to connect
> to the database
> -
>
> my cake module file is CakeTooDoo/app/models/task.php, write the
> following code:
>
>  class Task extends AppModel {
> var $name = 'Task';}
>
> ?>
> -
>
> Controller file is CakeTooDoo/app/controllers/tasks_controller.php,
> with the following code:
>
>  class TasksController extends AppController {
> var $name = 'Tasks';
> function index() {
> $this->set('tasks', $this->Task->find('all'));}
> }
>
> ?>
>
> -
>
> CakeTooDoo/app/views/index.ctp
>
> Tasks
> 
> There are no tasks in this list
> 
> 
> 
> Title
> Status
> Created
> Modified
> Actions
> 
> 
> 
> 
> 
> 
> 
>  if($task['Task']['done']) echo "Done";
> else echo "Pending";
> ?>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>
> -
>
> i am trying to run with this link but it is not 
> runhttp://localhost/CakeTooDoo/tasks/index
>
> i am new for this frame work
> can any one tell me what is the problem in this cake application
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 can run my first program in cakephp

2008-09-30 Thread Donkeybob

if you follow the manual step by step, then you should have a basic
cake site running. Run through the blog tutorial . . .it will help.

On Sep 30, 4:19 am, "Sonal Kumari" <[EMAIL PROTECTED]> wrote:
> Hi All
> i m new in cakephp.
> i have installed all things regradinh cakephp... and now i want to run
> my programs..
> but not getting proper
> so anyone would you help me...
> plz give me steps for first program..
>
> thanks a lot..
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Simple Ajax link to update div

2008-09-30 Thread Donkeybob

it looks like your syntax is wrong for the ajax link . . .no
parenthesis around '$ajax->link' code either . . .check out
http://book.cakephp.org/view/212/Methods for proper syntax.

from the manual related to your code
link('View Post',
array( 'controller' => 'tests', 'action' => 'ajaxfcn1', 1 ),
array( 'update' => 'divout', 'complete' => 'alert( "Executed
OK" )' )
 );
?>

in your controller function:

echo "Controller Executed";

as long as protoptype is linked up, then that should work.


On Sep 29, 11:56 pm, qwanta <[EMAIL PROTECTED]> wrote:
> Hi,
> I have been struggling a bit to get a simple Ajax link working. I have
> searched this group for help in older posts, but it seems like a key
> tutorial (the grahambird one) is no longer available - perhaps because
> it no longer works with 1.2.
>
> If there is a tutorial somewhere that covers this, please let me know.
> I think I have gone over all the available (through google) CakePHP
> ajax tutorials, but unfortunately without success - some are outdated
> (pre 1.2), others do not have full working code etc...
>
> In any case, here is my code:
> 
> index.ctp
> Ajax 3 - testing ajax link and button
>          $link_array1 = array('controller'=>'tests' ,
>                                                                 
> 'action'=>'ajaxfcn1');               // the function to execute: function
> ajaxfcn1 in controller tests
>
>         $link_array2 = array( 'update' => 'divout',
>                                                                 'complete' => 
> 'alert( "Executed OK" )' );  // the div we want
> to update
>
>         echo ($ajax->link('this an ajax link', $link_array1,
> $link_array2,'Confirmation String'));
>
>         echo "";
>
>         echo ($ajax->submit('this is an ajax button', $link_array1,
> $link_array2,'Confirmation String'));
> ?>
> 
> 
> the div to update
> 
> 
> tests_controller.php
>  class TestsController extends AppController {
>
>         var $name = 'Tests';
>         var $uses = array();            // prevent cake from looking for a 
> database
> model
>
>         function index() {
>
>         }
>
>         function ajaxfcn1() {
>                         $this->render('index', 'ajax');
>         }}
>
> ?>
> 
>
> So basically I have a view with an ajax link, an ajax button, and a
> . I would like to change the text in the div when I click the
> link or button. At this point, nothing happens when I click them. I am
> not sure if the ajaxfcn1() function is even executing at this point.
> What's an easy statement to add in ajaxfcn1() to determine if the code
> is executing? What function would I use to set the new div text from
> within ajaxfcn1()?
>
> 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
-~--~~~~--~~--~--~---



ACL checking in find()

2008-09-30 Thread Daniel

Hi there,

I'm currently working on an application that makes use of the Cake
ACL component with the database backed configuration. This is working
wonderfully and I am able to assign permissions to my ACO's for my
ARO's and ensure that they are enforced throughout my application with
liberal calls to the 'check' method of the ACL class. The ACO's in my
case are 'Event' instances, and the ARO's are specicic users. Both are
set up with proper foreign_key references in the ARO and ACO tables.

However, I am now running into an issue I hadn't thought of.
Specifically, I need to load a list of Events from the database
between two dates that a user has 'view' permission for. I've had no
trouble loading this list of events without worrying about permission,
but now I need to integrate that bit. I realize that I can ignore the
permissions in the DB query and then loop through the results trimming
out ones that fail a call to Acl->check(), but this seems like an
incredibly inefficient way of doing things.

What I would like to know, is if there is an easy way for me to
integrate permissions checking into the 'find' call I am using to
fetch the events.

Adding the ARO and ACO objects as relationships in my event and user
model has been done, so I suppose I could crawl my way down and check
the permissions that way using a large value for the 'recursive'
property of find, but again, this seems like it might not scale very
effectively.

Any ideas are greatly appreciated! Let me know if I can clarify my
question further.

- Daniel
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: app_controller.php causing errors with my app

2008-09-30 Thread dr. Hannibal Lecter

This may be a dumb suggestion, but try removing the "var $name =
'AppController';" line and see if that helps.

It's not correct anyways, or at least seems incorrect to me.

On Sep 29, 11:57 pm, Ryan <[EMAIL PROTECTED]> wrote:
> I am working on a new app and everything was playing nicely until I
> added a simple app_controller.php in order to take advantage of the
> Firecake helper:
>
>  class AppController extends Controller {
>         var $name = 'AppController';
>         var $helpers = array('Html', 'Form', 'Javascript', 'Firecake');}
>
> ?>
>
> Now I am getting errors:
>
> Notice (8): Undefined property: ItemsController::$Item [APP/
> controllers/items_controller.php, line 6]
>
> Fatal error: Call to a member function find() on a non-object in /web/
> php/balistik_list_app/app/controllers/items_controller.php on line 6
>
> When I delete app_controller.php everything works again. Any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: help me understand cakaphp

2008-09-30 Thread majna

http://book.cakephp.org/view/219/Blog
http://groups.google.com/group/cake-php/web/faq
bakery app https://svn.cakeforge.org/svn/bakery
there's some cakephp books on amazon


On Sep 30, 3:16 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
>  I m totally new to cakephp and i need to develope my project using
> cakephp framework .Previously all projects was done using simple php
> coding no framework nothing was used.Can any body tell me how do i
> start my application using cakephp. Before this i used devlope coding
> in php  .I have read the begining mannual but not understood how to
> start.So plz tell me from the beging steps.If posiible plz give any
> example of theapplication where cakephp was used.
>          not exactally where i have use code and put and how run on
> localserver
>
>     Will be very thankfull if somebosy helps me in
> this regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



how can run my first program in cakephp

2008-09-30 Thread Sonal Kumari
Hi All
i m new in cakephp.
i have installed all things regradinh cakephp... and now i want to run
my programs..
but not getting proper
so anyone would you help me...
plz give me steps for first program..

thanks a lot..

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



help me understand cakaphp

2008-09-30 Thread [EMAIL PROTECTED]

 I m totally new to cakephp and i need to develope my project using
cakephp framework .Previously all projects was done using simple php
coding no framework nothing was used.Can any body tell me how do i
start my application using cakephp. Before this i used devlope coding
in php  .I have read the begining mannual but not understood how to
start.So plz tell me from the beging steps.If posiible plz give any
example of theapplication where cakephp was used.
 not exactally where i have use code and put and how run on
localserver

Will be very thankfull if somebosy helps me in
this regards

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



Simple Ajax link to update div

2008-09-30 Thread qwanta

Hi,
I have been struggling a bit to get a simple Ajax link working. I have
searched this group for help in older posts, but it seems like a key
tutorial (the grahambird one) is no longer available - perhaps because
it no longer works with 1.2.

If there is a tutorial somewhere that covers this, please let me know.
I think I have gone over all the available (through google) CakePHP
ajax tutorials, but unfortunately without success - some are outdated
(pre 1.2), others do not have full working code etc...

In any case, here is my code:

index.ctp
Ajax 3 - testing ajax link and button
'tests' ,

'action'=>'ajaxfcn1');  // the function to execute: function
ajaxfcn1 in controller tests

$link_array2 = array( 'update' => 'divout',
'complete' => 
'alert( "Executed OK" )' );   // the div we want
to update

echo ($ajax->link('this an ajax link', $link_array1,
$link_array2,'Confirmation String'));

echo "";

echo ($ajax->submit('this is an ajax button', $link_array1,
$link_array2,'Confirmation String'));
?>


the div to update


tests_controller.php
render('index', 'ajax');
}
}
?>


So basically I have a view with an ajax link, an ajax button, and a
. I would like to change the text in the div when I click the
link or button. At this point, nothing happens when I click them. I am
not sure if the ajaxfcn1() function is even executing at this point.
What's an easy statement to add in ajaxfcn1() to determine if the code
is executing? What function would I use to set the new div text from
within ajaxfcn1()?

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: bigner for cake

2008-09-30 Thread anjum

I am also getting same error on this example I putted the file into
app/view/tasks/index.ctp

But it gives up can't load page error.

Secondly if i go through this way
http://localhost/CakeTooDoo/app/views/tasks/index.ctp

It only shows up the plain HTML form. After adding the add method in
controller its UI totally messes up. Please some one provide step by
step version to run this example for new bies.

with Regards
Anjum

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



question about hasMany and length of form

2008-09-30 Thread (withheld)@gmail.com

I am in the process of learning relational database design by making a
scoring system for golf.

in the early stages of planning the database I know I will have a
general relationship as follows:

Tournament hasMany stablefords, pars, eagles etc..

now question is, when i'm making a new tournament it's unknown exactly
how many participants there will be for each type of competition but
it is known there will be at least 20, instead of having to manually
add each entry, how could I have it so I can dynamically add more rows
to the form? I was thinking of rigging up a button with javascript to
add more rows as needed in the view, before I get started, is there an
easier way I should be doing this?

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



Re: cake bake doesn't find new tables

2008-09-30 Thread Kenchu

Thank you. Works excellent now. :)

On Sep 30, 3:05 pm, Markus Muschol <[EMAIL PROTECTED]>
wrote:
> You have to clean the cache.
> Delete all files in tmp/cache/models.
>
> Best Regards
>
> Am 30.09.2008 um 14:54 schrieb Kenchu:
>
>
>
> > I use cake bake to generate all my controllers, views and models.
> > Unfortunatelyl cake bake doesn't seem to realize the changes I make in
> > my database anymore. I've added a couple of more tables, but when I
> > try to bake some new models, they aren't even in the list of models.
> > Only the old tables are. I've checked the database configuration
> > multiple times and cannot see anything that would suggest why cake is
> > acting this way.
>
> > database.php
>
> > class DATABASE_CONFIG {
>
> >    var $default = array(
> >            'driver' => 'mysql',
> >            'persistent' => false,
> >            'host' => 'localhost',
> >            'login' => 'root',
> >            'password' => '',
> >            'database' => 'mydb',
> >            'prefix' => '',
> >    );
> > }
>
> > If I do this in the command prompt:
>
> > mysql  (password and user details) ENTER
> > use mydb; ENTER
> > show tables; ENTER
>
> > I get this:
>
> > +-+
> > | Tables_in_mydb  |
> > +-+
> > | adresses        |
> > | bankaccounts    |
> > | banks           |
> > | cars            |
> > | categories      |
> > | comments        |
> > | countries       |
> > | orders          |
> > | orders_products |
> > | products        |
> > | searches        |
> > | users           |
> > +-+
> > 12 rows in set (0.00 sec)
>
> > Using cake bake I get these:
>
> > Possible Models based on your current database:
> > 1. Bankaccount
> > 2. Bank
> > 3. Category
> > 4. Comment
> > 5. Country
> > 6. Order
> > 7. OrdersProduct
> > 8. Product
> > 9. Search
> > 10. User
>
> > Cars and adresses are new tables. Both of them are not present in the
> > list. Any ideas what's wrong here?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 Redirect Problems

2008-09-30 Thread Tony Thomas

I don't know why. Are you you using 1.2 or 1.1? I'm using 1.2.

This:

$this->Auth->autoRedirect = FALSE;

Gives me:

"unexpected T_VARIABLE"

I haven't had a chance to investigate.

On Sep 30, 2:06 am, "Okto Silaban" <[EMAIL PROTECTED]> wrote:
> How come? I get no problem with the syntax.. It works fine for me..
>
> This is the full code in app/app_controller.php (I just copy paste it)
>
> beforeFilter()
> {
>         $this->Auth->loginAction = array('controller' => 'users', 'action'
> => 'login');
>         $this->Auth->logoutRedirect = '/';
>         $this->Auth->loginRedirect = array('controller' => 'users', 'action'
> => 'login');
>         $this->Auth->autoRedirect = FALSE;
>
> }
>
> Okto.Silaban.Net
>
> On Fri, Sep 26, 2008 at 10:00 PM, Tony Thomas <[EMAIL PROTECTED]> wrote:
>
> > This gives me an "unexpected T_VARIABLE" error on the line with $this-
> > >Auth->autoRedirect = FALSE;
>
> > I think the algorithm might be right, but the syntax is wrong.
>
> > On Sep 17, 12:20 pm, "Okto Silaban" <[EMAIL PROTECTED]> wrote:
> > > I'm not really sure, but I think :
> > > $this->Auth->loginRedirect
>
> > > doesn't tell we're we gonna go after logging in..
>
> > > But, if we're acessing an area which not allowed by Auth, we will sent to
> > > that page.. (if you're not login yet..).
>
> > > So I set that in beforeFilter :
>
> > > function beforeFilter() {
> > >   $this->Auth->loginRedirect = array('controller' => 'controller_name',
> > > 'action' => 'index');
> > >    $this->Auth->autoRedirect = FALSE; // so after logging in we're not
> > auto
> > > redirected
>
> > > }
>
> > > then manually set
>
> > > function login() {
> > >     $this->redirect('somewhere');
> > >     exit();
>
> > > }
> > > On Tue, Sep 9, 2008 at 10:12 PM, Tony Thomas <[EMAIL PROTECTED]> wrote:
>
> > > > If someone is familiar with a post to this group or blog entry that
> > > > addresses this issue, please let me know. I've spent the morning
> > > > scouring both with no satisfactory results.
>
> > > > I have a cakePHP app on a shared server. In local testing, everything
> > > > worked fine. But mod_rewrite did not function properly on the shared
> > > > server, so I'm using CakePHP pretty URLS instead. Also caching (at
> > > > least temporarily) is off. I've uncommented the pertinent lines of
> > > > code in core.php and I've dutifully deleted the .htaccess files.
>
> > > > The problem I have is that after logging in, the redirect is
> > > > inconsistent. About 2/3 of the time I get redirected to
> > > >https://[base_url]/https:/[domain]. I just can't seem to find away
> > > > around this problem.
>
> > > > My login function looks like this:
>
> > > > function login() {
> > > >                        $this->Auth->loginRedirect = array('controller'
> > =>
> > > > 'controller_name', 'action' => 'index');
> > > >    }
>
> > > > I still get inconsistent results with the redirect going to a URL like
> > > > the former example the majority of the time. Any insight, links, etc.
> > > > would be appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: CakePHP 1.1, AJAX and forms not doing anything.

2008-09-30 Thread clemos

Hi

You should at least give the code from your view, so that we can
figure out what's going on.

Also, english is not my mother language, and I don't understand this sentence :
> However, the $ajax->link's works just fine and when I click one of the
> links, resultin an update to the that element and then return back to
> the original "element" the form starts to work.

Please be a bit more clear.
+++
Clément

On Tue, Sep 30, 2008 at 1:34 PM, aka <[EMAIL PROTECTED]> wrote:
>
> Hi!
>
> I have a controller, which fetches other controllers data through
> requestAction().
>
> The first element contains a form in which there is an $ajax-
>>submit(...);
>
> the problem here is that the form does nothing. The form doesen't even
> send XHR request.
>
> However, the $ajax->link's works just fine and when I click one of the
> links, resultin an update to the that element and then return back to
> the original "element" the form starts to work.
>
> Am I missing something? becouse this seems very odd.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 doesn't find new tables

2008-09-30 Thread [EMAIL PROTECTED]

Hi,

when you make changes to the database you have to clean the cache.
Delete all files in tmp/cache/models/. Then you should find your new
table.

On 30 Sep., 14:54, Kenchu <[EMAIL PROTECTED]> wrote:
> I use cake bake to generate all my controllers, views and models.
> Unfortunatelyl cake bake doesn't seem to realize the changes I make in
> my database anymore. I've added a couple of more tables, but when I
> try to bake some new models, they aren't even in the list of models.
> Only the old tables are. I've checked the database configuration
> multiple times and cannot see anything that would suggest why cake is
> acting this way.
>
> database.php
>
> class DATABASE_CONFIG {
>
>         var $default = array(
>                 'driver' => 'mysql',
>                 'persistent' => false,
>                 'host' => 'localhost',
>                 'login' => 'root',
>                 'password' => '',
>                 'database' => 'mydb',
>                 'prefix' => '',
>         );
>
> }
>
> If I do this in the command prompt:
>
> mysql  (password and user details) ENTER
> use mydb; ENTER
> show tables; ENTER
>
> I get this:
>
> +-+
> | Tables_in_mydb  |
> +-+
> | adresses        |
> | bankaccounts    |
> | banks           |
> | cars            |
> | categories      |
> | comments        |
> | countries       |
> | orders          |
> | orders_products |
> | products        |
> | searches        |
> | users           |
> +-+
> 12 rows in set (0.00 sec)
>
> Using cake bake I get these:
>
> Possible Models based on your current database:
> 1. Bankaccount
> 2. Bank
> 3. Category
> 4. Comment
> 5. Country
> 6. Order
> 7. OrdersProduct
> 8. Product
> 9. Search
> 10. User
>
> Cars and adresses are new tables. Both of them are not present in the
> list. Any ideas what's wrong here?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: app_controller.php causing errors with my app

2008-09-30 Thread Ryan

That did it. What was I thinking?!

Thank you



On Sep 30, 4:47 am, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote:
> This may be a dumb suggestion, but try removing the "var $name =
> 'AppController';" line and see if that helps.
>
> It's not correct anyways, or at least seems incorrect to me.
>
> On Sep 29, 11:57 pm, Ryan <[EMAIL PROTECTED]> wrote:
>
> > I am working on a new app and everything was playing nicely until I
> > added a simple app_controller.php in order to take advantage of the
> > Firecake helper:
>
> >  > class AppController extends Controller {
> >         var $name = 'AppController';
> >         var $helpers = array('Html', 'Form', 'Javascript', 'Firecake');}
>
> > ?>
>
> > Now I am getting errors:
>
> > Notice (8): Undefined property: ItemsController::$Item [APP/
> > controllers/items_controller.php, line 6]
>
> > Fatal error: Call to a member function find() on a non-object in /web/
> > php/balistik_list_app/app/controllers/items_controller.php on line 6
>
> > When I delete app_controller.php everything works again. Any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: cake bake doesn't find new tables

2008-09-30 Thread Markus Muschol

You have to clean the cache.
Delete all files in tmp/cache/models.

Best Regards

Am 30.09.2008 um 14:54 schrieb Kenchu:

>
> I use cake bake to generate all my controllers, views and models.
> Unfortunatelyl cake bake doesn't seem to realize the changes I make in
> my database anymore. I've added a couple of more tables, but when I
> try to bake some new models, they aren't even in the list of models.
> Only the old tables are. I've checked the database configuration
> multiple times and cannot see anything that would suggest why cake is
> acting this way.
>
> database.php
>
> class DATABASE_CONFIG {
>
>   var $default = array(
>   'driver' => 'mysql',
>   'persistent' => false,
>   'host' => 'localhost',
>   'login' => 'root',
>   'password' => '',
>   'database' => 'mydb',
>   'prefix' => '',
>   );
> }
>
> If I do this in the command prompt:
>
> mysql  (password and user details) ENTER
> use mydb; ENTER
> show tables; ENTER
>
> I get this:
>
> +-+
> | Tables_in_mydb  |
> +-+
> | adresses|
> | bankaccounts|
> | banks   |
> | cars|
> | categories  |
> | comments|
> | countries   |
> | orders  |
> | orders_products |
> | products|
> | searches|
> | users   |
> +-+
> 12 rows in set (0.00 sec)
>
> Using cake bake I get these:
>
> Possible Models based on your current database:
> 1. Bankaccount
> 2. Bank
> 3. Category
> 4. Comment
> 5. Country
> 6. Order
> 7. OrdersProduct
> 8. Product
> 9. Search
> 10. User
>
> Cars and adresses are new tables. Both of them are not present in the
> list. Any ideas what's wrong here?
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



cake bake doesn't find new tables

2008-09-30 Thread Kenchu

I use cake bake to generate all my controllers, views and models.
Unfortunatelyl cake bake doesn't seem to realize the changes I make in
my database anymore. I've added a couple of more tables, but when I
try to bake some new models, they aren't even in the list of models.
Only the old tables are. I've checked the database configuration
multiple times and cannot see anything that would suggest why cake is
acting this way.

database.php

class DATABASE_CONFIG {

var $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => '',
'database' => 'mydb',
'prefix' => '',
);
}

If I do this in the command prompt:

mysql  (password and user details) ENTER
use mydb; ENTER
show tables; ENTER

I get this:

+-+
| Tables_in_mydb  |
+-+
| adresses|
| bankaccounts|
| banks   |
| cars|
| categories  |
| comments|
| countries   |
| orders  |
| orders_products |
| products|
| searches|
| users   |
+-+
12 rows in set (0.00 sec)

Using cake bake I get these:

Possible Models based on your current database:
1. Bankaccount
2. Bank
3. Category
4. Comment
5. Country
6. Order
7. OrdersProduct
8. Product
9. Search
10. User

Cars and adresses are new tables. Both of them are not present in the
list. Any ideas what's wrong here?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: validate alphanumeric

2008-09-30 Thread [EMAIL PROTECTED]

Still I get the same error message.

At /cake/libs/validation.php line 830
if (preg_match($_this->regex, $_this->check)) {

I have an array in $_this->check and this is what generates the error.

In my model I use the following validation rule:

var $validate = array(
'nev' => array('rule' => 'alphaNumeric')
);

By this in validation.php at line 830 I have array('nev' =>
'theGivenString') at this makes the problem, but I can not find out
how to solve it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



CakePHP 1.1, AJAX and forms not doing anything.

2008-09-30 Thread aka

Hi!

I have a controller, which fetches other controllers data through
requestAction().

The first element contains a form in which there is an $ajax-
>submit(...);

the problem here is that the form does nothing. The form doesen't even
send XHR request.

However, the $ajax->link's works just fine and when I click one of the
links, resultin an update to the that element and then return back to
the original "element" the form starts to work.

Am I missing something? becouse this seems very odd.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 migrations

2008-09-30 Thread forrestgump

Just in case someone needs a lil help.
http://techcrate.wordpress.com/2008/09/29/hello-world/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: 'schema generate' and different connections (was: help with YAML pls basic syntax...etc)

2008-09-30 Thread forrestgump

just in case someone is interested 
http://techcrate.wordpress.com/2008/09/29/hello-world/

On Sep 30, 10:53 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
> Speaking of which...
>
> I have multiple connections in my database.conf. Running a 'cake  
> schema generate' always quits with "Error: Missing database table 'x'  
> for model 'y'". Even doing 'schema -connection alt -name Model  
> generate' quits with the same message. Depending on which '-
> connection' I specify it quits on different models, so it seems it  
> always tries to generate schemas for all models, ignoring my flags.
>
> Am I misusing the schema shell or should I open a ticket?
>
> Chrs,
> Dav
>
> On 30 Sep 2008, at 05:03, mark_story wrote:
>
> > In 1.2 there is a builtin Schema shell (console app) that can manage
> > things like ALTER statements that need to be run on a db between runs.
> > To my knowledge it doesn't insert records.  From a prompt cd into  
> > cake/
> > console and try cake schema help.  That will give you a list of
> > commands supported by the SchemaShell.
>
> > -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: Multiple Inserts without a loop

2008-09-30 Thread JadB

@Chris: no comment...

@RichardAtHome: run any benchmark, you'd quickly realize that there is
a BIG difference between 1 and 1000 insert made to a DB.

@teknoid, Richard: not all applications are about inserting what the
user is trying to insert in the DB, sometimes you have applications
that are building reports or scraping data, etc. those can easily do
over 1000 rows insert at times, all day long...

@seth: in an attempt to answer your question

DboMysql::insertMulti will return an SQL query similar to the one you
are looking to get: INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),
(7,8,9);

You could add this new method to app_controller.php if you want:

function multiSave(&$model, $values, $fields = null)
{
   $this->db =& $model->getDataSource();
   $this->db->insertMulti($model->table, $fields, $values);
}

Pass to it something like:

$values = array('(1, 2, 3)', '(4, 5, 6)', '(7, 8, 9)');
$fields = array('a','b','c');

I might be wrong, but this works for me so far and isn't really any
kind of 'hack', it's just using what's there in the framework. Hope it
helps!

JadB
http://loudbaking.myeasyscripts.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: 'Undefined index' problem on production server

2008-09-30 Thread Pieter Van Leuven

Ah I see. I switched the error reporting value for my local PHP to
E_ALL, but I'm getting no errors at all. It has indeed to be
difference in configuration between my local machine and the online
server, but I have absolutely what it could be.

Is the fact that I didn't build the models with the bake command
relevant? I build them myself. It's my first project with CakePHP. If
you want, to take a look, the project can be found here: 
http://kljichtegem.be/beta/.

Kind regards.

On 30 sep, 11:58, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
> No, I mean the PHP error reporting in your 
> php.ini.http://jp2.php.net/manual/en/configuration.phphttp://jp2.php.net/manual/en/errorfunc.configuration.php#ini.display-...
>
> The error is coming from PHP, not Cake.
> You should switch error reporting on on your development system and  
> off on your production system. If the error reporting is on on your  
> development system and it's not giving you any errors (i.e. no  
> programming mistakes) it'll be something that's set up differently on  
> your production machine.
>
> On 30 Sep 2008, at 18:48, Pieter Van Leuven wrote:
>
>
>
> > Hello David,
>
> > thanks for the tips. Both are currently running in debuglevel 2 mode.
> > That's why I think it's so strange.
>
> > Can someone give me some tips about what could be wrong with the
> > database? The application can reach the database, because some data is
> > fetched correctly...
>
> > Thanks in advance,
> > Pieter Van Leuven
>
> > On 30 sep, 07:37, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
> >> Stabs into the dark:
>
> >> a) your local PHP has a lower debug level than your production  
> >> server,
> >> i.e. your local system doesn't complain about missing indexes but  
> >> your
> >> server does
> >> b) the associated model can't be fetched because your database setup
> >> is different/misconfigured
>
> >> Hope that helps,
> >> Dav
>
> >> On 30 Sep 2008, at 06:26, Pieter Van Leuven wrote:
>
> >>> Hello people,
>
> >>> I have a strange problem i ran into with CakePHP. On my local  
> >>> machine
> >>> all works fine. When I upload the complete project to my webhost,  
> >>> the
> >>> problems begin.
>
> >>> For example: when I query posts from the database. All fields of  
> >>> this
> >>> posts are shown fine (for example $post['Post']['title'], but all
> >>> relative data like for example the username ($post['User']
> >>> ['username']) gives an error similar to 'Notice (8): Undefined
> >>> index:'. Someone an idea what the problem could be?
>
> >>> Could this be a know problem? I tried to search, but it is difficult
> >>> with that less information.
>
> >>> Some things I already thought of:
> >>> - Version difference of apache/mysql from my local machine/webhost
> >>> server
> >>> - windows newlines on my local machine versus webhost server (not
> >>> tested yet)
>
> >>> Local server:
> >>> - Apache/2.2.9 (Win32)
> >>> - mysql/5.0.51b with phpMyAdmin/5.0.51b
> >>> - vista
>
> >>> Webhost server:
> >>> - Apache/2.2.3
> >>> - mysql/5.0.32-Debian_7etch6-log with phpMyAdmin/5.0.32
> >>> - debian
>
> >>> Already thanks for reading this folks!
>
> >>> Kind regards,
> >>> Pieter Van Leuven
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: 'Undefined index' problem on production server

2008-09-30 Thread David C. Zentgraf

No, I mean the PHP error reporting in your php.ini.
http://jp2.php.net/manual/en/configuration.php
http://jp2.php.net/manual/en/errorfunc.configuration.php#ini.display-errors

The error is coming from PHP, not Cake.
You should switch error reporting on on your development system and  
off on your production system. If the error reporting is on on your  
development system and it's not giving you any errors (i.e. no  
programming mistakes) it'll be something that's set up differently on  
your production machine.

On 30 Sep 2008, at 18:48, Pieter Van Leuven wrote:

>
> Hello David,
>
> thanks for the tips. Both are currently running in debuglevel 2 mode.
> That's why I think it's so strange.
>
> Can someone give me some tips about what could be wrong with the
> database? The application can reach the database, because some data is
> fetched correctly...
>
> Thanks in advance,
> Pieter Van Leuven
>
> On 30 sep, 07:37, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>> Stabs into the dark:
>>
>> a) your local PHP has a lower debug level than your production  
>> server,
>> i.e. your local system doesn't complain about missing indexes but  
>> your
>> server does
>> b) the associated model can't be fetched because your database setup
>> is different/misconfigured
>>
>> Hope that helps,
>> Dav
>>
>> On 30 Sep 2008, at 06:26, Pieter Van Leuven wrote:
>>
>>
>>
>>> Hello people,
>>
>>> I have a strange problem i ran into with CakePHP. On my local  
>>> machine
>>> all works fine. When I upload the complete project to my webhost,  
>>> the
>>> problems begin.
>>
>>> For example: when I query posts from the database. All fields of  
>>> this
>>> posts are shown fine (for example $post['Post']['title'], but all
>>> relative data like for example the username ($post['User']
>>> ['username']) gives an error similar to 'Notice (8): Undefined
>>> index:'. Someone an idea what the problem could be?
>>
>>> Could this be a know problem? I tried to search, but it is difficult
>>> with that less information.
>>
>>> Some things I already thought of:
>>> - Version difference of apache/mysql from my local machine/webhost
>>> server
>>> - windows newlines on my local machine versus webhost server (not
>>> tested yet)
>>
>>> Local server:
>>> - Apache/2.2.9 (Win32)
>>> - mysql/5.0.51b with phpMyAdmin/5.0.51b
>>> - vista
>>
>>> Webhost server:
>>> - Apache/2.2.3
>>> - mysql/5.0.32-Debian_7etch6-log with phpMyAdmin/5.0.32
>>> - debian
>>
>>> Already thanks for reading this folks!
>>
>>> Kind regards,
>>> Pieter Van Leuven
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: 'Undefined index' problem on production server

2008-09-30 Thread Pieter Van Leuven

Hello David,

thanks for the tips. Both are currently running in debuglevel 2 mode.
That's why I think it's so strange.

Can someone give me some tips about what could be wrong with the
database? The application can reach the database, because some data is
fetched correctly...

Thanks in advance,
Pieter Van Leuven

On 30 sep, 07:37, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
> Stabs into the dark:
>
> a) your local PHP has a lower debug level than your production server,  
> i.e. your local system doesn't complain about missing indexes but your  
> server does
> b) the associated model can't be fetched because your database setup  
> is different/misconfigured
>
> Hope that helps,
> Dav
>
> On 30 Sep 2008, at 06:26, Pieter Van Leuven wrote:
>
>
>
> > Hello people,
>
> > I have a strange problem i ran into with CakePHP. On my local machine
> > all works fine. When I upload the complete project to my webhost, the
> > problems begin.
>
> > For example: when I query posts from the database. All fields of this
> > posts are shown fine (for example $post['Post']['title'], but all
> > relative data like for example the username ($post['User']
> > ['username']) gives an error similar to 'Notice (8): Undefined
> > index:'. Someone an idea what the problem could be?
>
> > Could this be a know problem? I tried to search, but it is difficult
> > with that less information.
>
> > Some things I already thought of:
> > - Version difference of apache/mysql from my local machine/webhost
> > server
> > - windows newlines on my local machine versus webhost server (not
> > tested yet)
>
> > Local server:
> > - Apache/2.2.9 (Win32)
> > - mysql/5.0.51b with phpMyAdmin/5.0.51b
> > - vista
>
> > Webhost server:
> > - Apache/2.2.3
> > - mysql/5.0.32-Debian_7etch6-log with phpMyAdmin/5.0.32
> > - debian
>
> > Already thanks for reading this folks!
>
> > Kind regards,
> > Pieter Van Leuven
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Saving self-referential-HABTM relationships...

2008-09-30 Thread wallerdm

Ha Ha!

Started again from scratch using the Cake Bake console and it all
seems to be working. A few errors again when adding friends but should
be fixable.

In case it's of use to anyone here's how it's all set up now...

DATABASE...

Users table... id | username | password
Profiles table... id | user_id | forename | surname | etc
Statuses table... id | user_id | status_text | created_at
Users_users table... id | user_id | friend_id | approved

USER MODEL...

 array('alphanumeric'),
'password' => array('alphanumeric')
);

//The Associations below have been created with all possible keys,
those that are not needed can be removed
var $hasOne = array(
'Profile' => array('className' => 'Profile',
'foreignKey' => 
'user_id',
'dependent' => 
false,
'conditions' => 
'',
'fields' => '',
'order' => ''
)
);

var $hasMany = array(
'Status' => array('className' => 'Status',
'foreignKey' => 
'user_id',
'dependent' => 
false,
'conditions' => 
'',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => 
'',
'finderQuery' 
=> '',
'counterQuery' 
=> ''
)
);

var $hasAndBelongsToMany = array(
'friend' => array('className' => 'User',
'joinTable' => 'users_users',
'foreignKey' => 'user_id',
'associationForeignKey' => 
'friend_id',
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
)
);

}
?>

USERS CONTROLLER...

User->recursive = 0;
$this->set('users', $this->paginate());
}

function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid User.', true));
$this->redirect(array('action'=>'index'));
}
$this->set('user', $this->User->read(null, $id));
}

function add() {
if (!empty($this->data)) {
$this->User->create();
if ($this->User->save($this->data)) {
$this->Session->setFlash(__('The User has been 
saved', true));
$this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash(__('The User could not 
be saved. Please,
try again.', true));
}
}
$friends = $this->User->Friend->find('list');
$this->set(compact('friends'));
}

function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid User', true));
$this->redirect(array('action'=>'index'));
}
if (!empty($this->data)) {
if ($this->User->save($this->data)) {
$this->Session->setFlash(__('The User has been 
saved', true));
$this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash(__('The User could not 
be saved. Please,
try again.', true));
}
}
 

Re: Add comment in the bakery doesn't work

2008-09-30 Thread dr. Hannibal Lecter

I second that, doesn't work for me either.

On Sep 30, 10:30 am, Kanten <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm afraid there is something wrong with the add comment function in
> the bakery:http://bakery.cakephp.org/
>
> When trying to add a comment it always comes back with:
> "The comment could not be saved. Please correct the errors below."
>
> When looking below at the comment, no errors are listed and in
> reality, there is no errors.
>
> Is there anyone with developer access to the bakery, that can look
> into this?
>
> /Anders
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



Add comment in the bakery doesn't work

2008-09-30 Thread Kanten

Hi,

I'm afraid there is something wrong with the add comment function in
the bakery:
http://bakery.cakephp.org/

When trying to add a comment it always comes back with:
"The comment could not be saved. Please correct the errors below."

When looking below at the comment, no errors are listed and in
reality, there is no errors.

Is there anyone with developer access to the bakery, that can look
into this?

/Anders
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Saving self-referential-HABTM relationships...

2008-09-30 Thread wallerdm

Thanks Bernardo - that makes sense. I think I might drop the concept
of admirers and have an "accepted" state for friendships.

This all works well when displaying user data, a user model
automatically has data about previous friendships but I still can't
add new friends. The best I can get when I play with the code is a
drop of all entries in the "users_users" and in insert of the new
friendship.

Any ideas or tutorials that might help me out?

Dave.

On Sep 29, 6:23 pm, Bernardo Vieira <[EMAIL PROTECTED]> wrote:
> I imagine it should work if you use different join tables for each HABTM
> relationship. Regardless of cakephp this is what I imagine you'd need in
> this situation (imagine what would happen if a user is both a friend and
> an admirer of another user).
>
>         var $hasAndBelongsToMany = array(
>                         'Friend' => array('className' => 'User',
>                                                 'joinTable' => 
> 'friends_users',
>                                                 'foreignKey' => 'friend_id',
>                                                 'associationForeignKey' => 
> 'user_id'
>                         ),
>
>                         'Admirer' => array('className' => 'User',
>                                                 'joinTable' => 
> 'admirers_users',
>                                                 'foreignKey' => 'admirer_id',
>                                                 'associationForeignKey' => 
> 'user_id'
>                         )
>         );
>
> wallerdm wrote:
> > Dear All,
>
> > Forgive me if this is covered elsewhere. I'm playing with cakePHP as
> > an alternative to Rails and am getting to grips with it by creating a
> > really simple social network app.
>
> > I've got some nice authentication and user profiles sorted and that's
> > all displaying great but now I've come to add the "add as a friend"
> > functionality and I'm struggling.
>
> > Every user in the "users" table has an "id" and I also have a table
> > set up, "users_users", to hold the self referential join. This table
> > has a an "id", a "user_id" and a "friend_id".
>
> > My user model contains the following...
>
> >  > class User extends AppModel {
>
> >    var $name = 'User';
> >    var $hasOne = 'Profile';
> >    var $hasMany = array('Status' => array('order' => 'Status.created
> > DESC' ));
>
> >    var $hasAndBelongsToMany = array(
> >                    'Friend' => array('className' => 'User',
> >                                            'joinTable' => 'users_users',
> >                                            'foreignKey' => 'user_id',
> >                                            'associationForeignKey' => 
> > 'friend_id'
> >                    ),
> >                    'Admirer' => array('className' => 'User',
> >                                            'joinTable' => 'users_users',
> >                                            'foreignKey' => 'friend_id',
> >                                            'associationForeignKey' => 
> > 'user_id'
> >                    )
> >    );
>
> > }
> > ?>
>
> > And my users_controller contains...
>
> >  > class UsersController extends AppController {
>
> > .
> >    function addfriend($friend_id = null) {
> >            $user_id = $this->Session->read('User');
> >            $this->data['User']['id'] = $user_id['id'];
> >            $this->data['Friend']['id'] = $friend_id;
> >            print_r($this->data);
> >            if($this->User->saveAll($this->data)){
> >                    echo 'saved';
> >            }else{
> >                    echo 'failed';
> >            }
> >    }
> > .
>
> > }
> > ?>
>
> > Now I know that I've got the data element wrong for the database save
> > because it isn't working and the SQL that's generated when you add a
> > friend is incorrect.
>
> > If you're logged in as a user with id 1 and want to become friends
> > with the user with id 4 (http://localhost/network/users/addfriend/4),
> > you get...
>
> > data = Array ( [User] => Array ( [id] => 1) [Friend] => Array ( [id]
> > => 4 ) )
>
> > ...and the SQL from the CakePHP debug panel is...
>
> > UPDATE `users` SET `id` = 1 WHERE `users`.`id` = 1
>
> > Is anyone able to help me get this whole self-referential-HABTM
> > relationship thing sorted?
>
> > Thanks in advance.
>
> > Dave.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth Redirect Problems

2008-09-30 Thread Okto Silaban
How come? I get no problem with the syntax.. It works fine for me..

This is the full code in app/app_controller.php (I just copy paste it)

beforeFilter()
{
$this->Auth->loginAction = array('controller' => 'users', 'action'
=> 'login');
$this->Auth->logoutRedirect = '/';
$this->Auth->loginRedirect = array('controller' => 'users', 'action'
=> 'login');
$this->Auth->autoRedirect = FALSE;
}

Okto.Silaban.Net

On Fri, Sep 26, 2008 at 10:00 PM, Tony Thomas <[EMAIL PROTECTED]> wrote:

>
> This gives me an "unexpected T_VARIABLE" error on the line with $this-
> >Auth->autoRedirect = FALSE;
>
> I think the algorithm might be right, but the syntax is wrong.
>
> On Sep 17, 12:20 pm, "Okto Silaban" <[EMAIL PROTECTED]> wrote:
> > I'm not really sure, but I think :
> > $this->Auth->loginRedirect
> >
> > doesn't tell we're we gonna go after logging in..
> >
> > But, if we're acessing an area which not allowed by Auth, we will sent to
> > that page.. (if you're not login yet..).
> >
> > So I set that in beforeFilter :
> >
> > function beforeFilter() {
> >   $this->Auth->loginRedirect = array('controller' => 'controller_name',
> > 'action' => 'index');
> >$this->Auth->autoRedirect = FALSE; // so after logging in we're not
> auto
> > redirected
> >
> > }
> >
> > then manually set
> >
> > function login() {
> > $this->redirect('somewhere');
> > exit();
> >
> > }
> > On Tue, Sep 9, 2008 at 10:12 PM, Tony Thomas <[EMAIL PROTECTED]> wrote:
> >
> > > If someone is familiar with a post to this group or blog entry that
> > > addresses this issue, please let me know. I've spent the morning
> > > scouring both with no satisfactory results.
> >
> > > I have a cakePHP app on a shared server. In local testing, everything
> > > worked fine. But mod_rewrite did not function properly on the shared
> > > server, so I'm using CakePHP pretty URLS instead. Also caching (at
> > > least temporarily) is off. I've uncommented the pertinent lines of
> > > code in core.php and I've dutifully deleted the .htaccess files.
> >
> > > The problem I have is that after logging in, the redirect is
> > > inconsistent. About 2/3 of the time I get redirected to
> > >https://[base_url]/https:/[domain]. I just can't seem to find away
> > > around this problem.
> >
> > > My login function looks like this:
> >
> > > function login() {
> > >$this->Auth->loginRedirect = array('controller'
> =>
> > > 'controller_name', 'action' => 'index');
> > >}
> >
> > > I still get inconsistent results with the redirect going to a URL like
> > > the former example the majority of the time. Any insight, links, etc.
> > > would be appreciated.
> >
> >
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---