Re: controller calling an other controller with an array as parameter

2007-01-07 Thread TJSingleton


Try requestAction($url, $extra)


From the Manual:

This function calls a controller's action from any location and returns
the rendered view. The $url is a Cake URL
(/controllername/actionname/params). If the $extra array includes a
'return' key, AutoRender is automatically set to true for the
controller action.

http://manual.cakephp.org/chapter/controllers

--
TJ Singleton


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



Re: Preloading a div with AJAX

2007-01-05 Thread TJSingleton



[EMAIL PROTECTED] wrote:

Makes sense, but now I'm having the issue that the controller for the
div is different than the one for the main page, so it gives a can't
find controller error, any idea how to get around this?


Are you using requestAction() ?

http://manual.cakephp.org/chapter/controllers

--
TJ Singleton


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



Re: several "$content_for_layout"?

2007-01-03 Thread TJSingleton


As aforementioned, more info is really needed. But I think you will
only need one layout, you can use two views. One with two columns and
one with three.


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



Re: Can CakePHP do this? - Two

2007-01-03 Thread TJSingleton



In actual, we can't get the desired output since we can't do the
sequential outputs, call pass().


ok, so is this what you mean?

VIEW
Header 1: Fruits are here. 
";
}
?>

Header 2: Animals are here. 
";
}
?>

Header 3: Colors are here. 
";
}
?>

CONTROLLER:
set('fruits', $this->Test->myfunction(1));
   $this->set('animals', $this->Test->myfunction(2));
   $this->set('colors', $this->Test->myfunction(3));
 }

}

--
TJ Singleton
?>


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



Re: Can't we use $this->set in a loop?

2007-01-03 Thread TJSingleton


You could just move the whole loop to the view and pass the array from
the controller to it. I guess it really just depends on what you mean
by "on the fly". When I get a chance I'll update my example in the
other thread to produce your desired output.

On Jan 3, 12:02 pm, "skyblueink" <[EMAIL PROTECTED]> wrote:

Chris, very insightful opinion!!
Now it seems to be a time for me to learn something like ajax in
cakePHP.
Could anyone show me how to apply ajax to my tiny program for doing "on
the fly" output?
It could present with a  good starting point  for studying ajax in
Cake.

On 1월4일, 오전1시35분, "skyblueink" <[EMAIL PROTECTED]>
wrote:

> Hi, rpetrain1

> yes there is also a synchronization problem between the controller and
> the view.
> I know that $this->set doesn't do appending, but appending is time
> consuming in real life. What I aim at is 'not appending': instead of
> appending string data, I want to send each datum to view so that the
> user can see the output without enduring the whole appending time. That
> is my point.

> On 1월4일, 오전1시24분, "rpetrain" <[EMAIL PROTECTED]> wrote:

> > The out put that you got is right.
> > When you are using set it is setting the value not appending.
> > In your code you are not printing the value after it has been set each
> > time.
> > By the time the code gets to the call to echo the value of message your
> > loop has already completed and it print outs the last value that you
> > set message to.- 따온 텍스트 숨기기 -- 따온 텍스트 보기 -



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



Re: Can CakePHP do this? - Two

2007-01-03 Thread TJSingleton


This gives the desired output, but I'm not sure how your doing your
sequential outputs, or how you are calling pass.

VIEW:
";
}
?>

CONTROLLER:
set('results', $this->Test->myfunction($i));

 $i += -1;
 switch($i)
{
   case 0:
   $heading = 'Header 1: Fruits are here. ';
   break;
   case 1:
   $heading = 'Header 2: Animals are here. ';
   break;
   case 2:
   $heading = 'Header 3: Colors are here. ';
   break;
}
   $this->set('heading', $heading);
 }
 
}

?>


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



Re: File upload with AJAX

2007-01-03 Thread TJSingleton



Ámon Tamás wrote:

There is any way in cake php for ajax file uploading?


Check out:
http://www.thinkingphp.org/2006/04/27/an-ajax-file-upload-progressbar/
http://thinkingphp.org/demos/cake-timer/


I like to make a form where I have a file uploading field. If upload a
file I like to put the image to the page and an other file upload field.
Where can I find solution for it?


It should be easy to grab the file from the above mentioned link, and
add a image to a page.

--
TJ Singleton


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



Re: How to do arguments before Controller/Action in a URL?

2007-01-02 Thread TJSingleton


In the 1.2 you could do:

   Router::connect('/(.*)/posts/view', array('controller' => 'posts',
'action' => 'view', '$1'));

but, I don't think it will work in 1.1. You could use mod_rewrite
though.

--
TJ Singleton


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



Re: Can CakePHP do this? - Two

2007-01-02 Thread TJSingleton



skyblueink wrote:

Without using CakePHP or any other MVC framework, I would have
codedlike the following:


Can you give me an example of the final output you'd like it to
achieve? 


--
TJ Singleton


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



Re: Can CakePHP do this? - Two

2007-01-02 Thread TJSingleton



skyblueink wrote:

I want to show progress indicator to the user of my program for each
run of $i for loop of pass(). The pass() function could be modified
like the following(see below), but it does not give the expected
results since $message and $result are overwritten repeatedly. This
time I don't want to merge array of fruits, animals, and colors as I
did previously. I want to make Controller output each array into View.
this kind of job was easy when design and logic were not seperated, but
now that logic(Controller) and design(View) are seperated, and it doen
not seem to be so easy at least to me.
Could anyone show me how to modify the Controller and View?


I am completely lost as to the aim of what you are trying to do, or if
this answers it. But to simply pass the results to the view loop which
you can modify for the headers (I wouldn't even use a loop there. But I
don't know what you're trying to do.) just modify the controller as
follows.

Controller:
function pass($i) {
   $this->set('result', $this->Test->myfunction($i));
}

--
TJ Singleton


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



Re: "direct" data access?

2007-01-02 Thread TJSingleton



I think we are going to have some database access needs that may not be
easy to express using Cake's ActiveRecord, so we are trying to figure
out how to still have our models access the database using Cake classes
instead of interjecting our own connection managment code, etc.


What kind of functionality are you looking to do? Could you just create
custom model functions that utilizes the query() and execute() methods?

http://manual.cakephp.org/chapter/models

--
TJ Singleton


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



Re: How to fillup a transaction table.

2007-01-02 Thread TJSingleton


sumanpaul wrote:

now question is :
after adding the user successfully in the user table how to insert data
in the transaction table.



I figured out we can get the last inserted id by using
getLastInsertID().


You're on the right track with the getLastInsertID(). Here is a generic
add code from a controller:

function add() {
if(!empty($this->data)) {
$this->cleanUpFields();
$this->Client->create();
if($this->Client->save($this->data)) {
$this->Session->setFlash('The Client has been 
saved');
$this->redirect('/clients/index');
exit();
} else {
$this->Session->setFlash('Please correct errors 
below.');
}
}
}

What we want to do (as I understand it) is instead of calling the
controllers index action, is call the "transactions" select event
action (or whatever you called it). It's as simple as redirecting to
the desired controller's action

Here is the modified add code from a controller:

function add() {
if(!empty($this->data)) {
$this->cleanUpFields();
$this->Client->create();
if($this->Client->save($this->data)) {
$this->Session->setFlash('The Client has been 
saved');
$id = $Client->getLastInsertID();
/* Edit the following line with the proper 
controller, and action
*/
$this->redirect("/controller/action/$id");
exit();
} else {
$this->Session->setFlash('Please correct errors 
below.');
}
}
}


Please let me know if I should clarify the situation more.


Hopefully that helps, and is on the right track as far as your question
is concerned. Let me know if I am off base. 


--
TJ Singleton


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



Re: proper mvc way to validate 2 forms belonging to the same model

2007-01-02 Thread TJSingleton


gabordemeter wrote:

And the validation rule which makes sure that the respective email is
not already in the db fires and invalidates the email field. As the
email address is of course in the db (the user already signed up), I
would like to be able to remove this validation rule if the submitted
form is edit account, and only keep the rule active if the submitted
form is signup.

How can I do this in Cake respecting the MVC conventions?


You want to use the invalidate method for the signup form, for custom
controller validation and move the check for signup there. There is an
example of how to do it in the manual.

Check out: http://manual.cakephp.org/chapter/validation  as of today,
the relevent portion is the last paragraph and code block.

---
TJ Singleton


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