Re: multiple controllers on 1 page

2006-09-11 Thread Brian French




It would mainly be for the view. in the controller i would call the
requestAction and assign the output to a view variable using set():

$this->set('someBlock',$this->requestAction('Controllers/_Method',array('foo'=>'bar')));
// i think this is right. correct me if im wrong

or (refering to the other thread "Simple question about $this->set")
you can do it like this:

$someBlock =
$this->requestAction('Controllers/_Method',array('foo'=>'bar'));
echo $someBlock; // refering to other thread in groups
$this->set('someBlock',$someBlock);

anyone, correct me if im wrong.

Brian French

[EMAIL PROTECTED] wrote:

  
bwaters wrote:
  
  
It seems that the consensus is to put the blocks into elements and if
they have data use a requestAction inside the element that returns a
data array containing whatever information you need.  There are lots of
other ways to skin this cat, depending on your situation and how many
blocks you are talking about.

Using requestAction(controller/action, array('return' => 'true'); is
easier but the overhead of multiple views being rendered will kill you
if you have several blocks per page.

I am currently changing my whole project over to the elements /
requestAction combo instead of the RequestAction / view (return =>
true) way of doing things.

  
  
Hello Brian.

Where are you putting all the elements together? e.g:
domain/pages/home.thtml or in view? I am also currently doing a small
project where I need to access different controlelrs on each page - so
this post is very interresting to me. 

Best regards.
Asbjørn Morell.





  


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





Re: multiple controllers on 1 page

2006-09-10 Thread [EMAIL PROTECTED]


bwaters wrote:
> It seems that the consensus is to put the blocks into elements and if
> they have data use a requestAction inside the element that returns a
> data array containing whatever information you need.  There are lots of
> other ways to skin this cat, depending on your situation and how many
> blocks you are talking about.
>
> Using requestAction(controller/action, array('return' => 'true'); is
> easier but the overhead of multiple views being rendered will kill you
> if you have several blocks per page.
>
> I am currently changing my whole project over to the elements /
> requestAction combo instead of the RequestAction / view (return =>
> true) way of doing things.

Hello Brian.

Where are you putting all the elements together? e.g:
domain/pages/home.thtml or in view? I am also currently doing a small
project where I need to access different controlelrs on each page - so
this post is very interresting to me. 

Best regards.
Asbjørn Morell.


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



Re: multiple controllers on 1 page

2006-09-08 Thread bwaters

It seems that the consensus is to put the blocks into elements and if
they have data use a requestAction inside the element that returns a
data array containing whatever information you need.  There are lots of
other ways to skin this cat, depending on your situation and how many
blocks you are talking about.

Using requestAction(controller/action, array('return' => 'true'); is
easier but the overhead of multiple views being rendered will kill you
if you have several blocks per page.

I am currently changing my whole project over to the elements /
requestAction combo instead of the RequestAction / view (return =>
true) way of doing things.


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



Re: multiple controllers on 1 page

2006-09-08 Thread AD7six

Rather than quote myself, Google is everybody's friend:
http://groups.google.com/group/cake-php/browse_thread/thread/63689f6171aa5cf3/27b15a01b48a2acb?lnk=gst&q=AD7six&rnum=1

RequestAction is simulating a url - so I wouldn't expect it to work
with _ methods. If you wanted to protect a method such that it isn´t
possible to call directly from the web you can check for the presence
of the parameters "return" AND "bare", as currently these are both set
for requestAction calls, and are not (both) present if called from the
web.

I don´t think it's a good idea to instanciate and call a controller
directly - what's the point of using an MVC framework to just create
strands of spaghetti between everything? But then, that's just my
opinion :)

Cheers,

AD7six


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



Re: multiple controllers on 1 page

2006-09-08 Thread Bert Van den Brande

RequestAction returns the rendered view template if I'm correct ...
I'm not sure but I think that a direct call to a controller method
doesn't auto-render the template ?


On 9/8/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> This kind of falls along the other conversation I was trying to have.
> Couldn't you then make a call to a underscored method?  So, you
> couldn't call /controller/_method, but you could do
> $this->controller->_method()??
>
> I would like to know whether the direct call or a requestAction is the
> "correct" CakePHP MVC way.
>
>
> >
>

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



Re: multiple controllers on 1 page

2006-09-08 Thread [EMAIL PROTECTED]

This kind of falls along the other conversation I was trying to have.
Couldn't you then make a call to a underscored method?  So, you
couldn't call /controller/_method, but you could do
$this->controller->_method()??

I would like to know whether the direct call or a requestAction is the
"correct" CakePHP MVC way.


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



Re: multiple controllers on 1 page

2006-09-07 Thread Mikee Freedom

in some instances I employ the uses attribute of a controller to
access other models so i don't have to use  the requestAction method.
for example, on my dashboard of the admin area I list a few totals:

e.g.

total users: 100
total users in last month: 35
total images on system: 32
total space on system: 1056 Kb

to do this i've given my admin controller access to my user and image model

var uses = array(
'User',
'Image'
);

Then within my dashboard method of my AdminController I can simply call

$this->set('user_count', $this->User->findCount());
$this->set('user_month_count', $this->User->findCount($someConditions));
etc

Then within my dashboard view (or elements therein) I can manipulate
that data any way I choose. You could employ this method to grab a
list of users and display them on your dashboard, or home page, or
wherever you wanted.

I think this method is acceptable in the MVC method. Could someone confirm?

On 08/09/06, Olivier Percebois-Garve <[EMAIL PROTECTED]> wrote:
>
>  Well,
>
>  U can also make use of requestAction in the layout, in components and I
> guess in elements too.
>
>  In my abroad experiences, sometimes, I found myself very happy when I could
> hide my French origin...
>
>
>  Brian French wrote:
>  Thanks for your help!
>  In response to my own first question, i am assuming that i am correct as i
> would have to call the requestAction for each block for each page unless
> they occure everywhere in which case i could use beforeRender()
>
>  Yes I'm American and no, it's not hard to live with :-p
>  The average American isn't as prejudice as people may believe :-p
>
>  Olivier Percebois-Garve wrote:
>  Hi
> I think requestAction is made for that.
> To avoid a method to be accessed, just use "_" as prefix e.g :
> function _blabla(){
>  //blabla
> }
>
>
> Are u american ? Isn't your lastname difficult to live with there?
>
>
> Brian French wrote:
>
>
>  Im still in the process of wrapping my head around the MVC. I understand
> the roles of each of the elements. What i am coming across that i cant
> seem to figure out is how to have multiple elements work on 1 page.
>
> Example: Myspace (i know, but good example of what im talking about).
>
> On the homepage you have multiple elements: Music box, Specials box,
> Cool new people, and videos.
>
> In my understanding of MVC, each one of them would be a different
> controller, prob calling the same method name like GetBlock or
> something. ($specials->GetBlock();, etc. ). So, the cakephp url would be
> 'Specials/GetBlock'. I have ran across the method 'requestAction' which
> can call the multiple controllers, by the cakephp url in the page
> controller. Then assign it to a variable to be used in the view.
>
> Questions:
> 1. would i basically have to create a seperate method for each of the
> pages i would have?
> 2. would the above way of using requestAction be the right way of
> accomplishing this or is there a better way to do this?
> 3. in doing it this way, what is preventing someone from access the url
> 'http://www.blah.com/Specials/GetBlock'?
>
> I hope i have explained this well enough.
>
> Brian
>
>
>
>
>
>
>
>
>
>
>
>
>  >
>
>

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



Re: multiple controllers on 1 page

2006-09-07 Thread Olivier Percebois-Garve




Well,

U can also make use of requestAction in the layout, in components and I
guess in elements too.

In my abroad experiences, sometimes, I found myself very happy when I
could hide my French origin...

Brian French wrote:

  
Thanks for your help! 
In response to my own first question, i am assuming that i am correct
as i would have to call the requestAction for each block for each page
unless they occure everywhere in which case i could use beforeRender()
  
Yes I'm American and no, it's not hard to live with :-p
The average American isn't as prejudice as people may believe :-p 
  
Olivier Percebois-Garve wrote:
  
Hi
I think requestAction is made for that.
To avoid a method to be accessed, just use "_" as prefix e.g :
function _blabla(){
//blabla
}


Are u american ? Isn't your lastname difficult to live with there?


Brian French wrote:
  

  Im still in the process of wrapping my head around the MVC. I understand 
the roles of each of the elements. What i am coming across that i cant 
seem to figure out is how to have multiple elements work on 1 page.

Example: Myspace (i know, but good example of what im talking about).

On the homepage you have multiple elements: Music box, Specials box, 
Cool new people, and videos.

In my understanding of MVC, each one of them would be a different 
controller, prob calling the same method name like GetBlock or 
something. ($specials->GetBlock();, etc. ). So, the cakephp url would be 
'Specials/GetBlock'. I have ran across the method 'requestAction' which 
can call the multiple controllers, by the cakephp url in the page 
controller. Then assign it to a variable to be used in the view.

Questions:
1. would i basically have to create a seperate method for each of the 
pages i would have?
2. would the above way of using requestAction be the right way of 
accomplishing this or is there a better way to do this?
3. in doing it this way, what is preventing someone from access the url 
'http://www.blah.com/Specials/GetBlock'?

I hope i have explained this well enough.

Brian









  
  
  
  



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





Re: multiple controllers on 1 page

2006-09-07 Thread Brian French




Thanks for your help! 
In response to my own first question, i am assuming that i am correct
as i would have to call the requestAction for each block for each page
unless they occure everywhere in which case i could use beforeRender()

Yes I'm American and no, it's not hard to live with :-p
The average American isn't as prejudice as people may believe :-p 

Olivier Percebois-Garve wrote:

  Hi
I think requestAction is made for that.
To avoid a method to be accessed, just use "_" as prefix e.g :
function _blabla(){
//blabla
}


Are u american ? Isn't your lastname difficult to live with there?


Brian French wrote:
  
  
Im still in the process of wrapping my head around the MVC. I understand 
the roles of each of the elements. What i am coming across that i cant 
seem to figure out is how to have multiple elements work on 1 page.

Example: Myspace (i know, but good example of what im talking about).

On the homepage you have multiple elements: Music box, Specials box, 
Cool new people, and videos.

In my understanding of MVC, each one of them would be a different 
controller, prob calling the same method name like GetBlock or 
something. ($specials->GetBlock();, etc. ). So, the cakephp url would be 
'Specials/GetBlock'. I have ran across the method 'requestAction' which 
can call the multiple controllers, by the cakephp url in the page 
controller. Then assign it to a variable to be used in the view.

Questions:
1. would i basically have to create a seperate method for each of the 
pages i would have?
2. would the above way of using requestAction be the right way of 
accomplishing this or is there a better way to do this?
3. in doing it this way, what is preventing someone from access the url 
'http://www.blah.com/Specials/GetBlock'?

I hope i have explained this well enough.

Brian


  

  
  



  


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





Re: multiple controllers on 1 page

2006-09-07 Thread Olivier Percebois-Garve

Hi
I think requestAction is made for that.
To avoid a method to be accessed, just use "_" as prefix e.g :
function _blabla(){
//blabla
}


Are u american ? Isn't your lastname difficult to live with there?


Brian French wrote:
> Im still in the process of wrapping my head around the MVC. I understand 
> the roles of each of the elements. What i am coming across that i cant 
> seem to figure out is how to have multiple elements work on 1 page.
>
> Example: Myspace (i know, but good example of what im talking about).
>
> On the homepage you have multiple elements: Music box, Specials box, 
> Cool new people, and videos.
>
> In my understanding of MVC, each one of them would be a different 
> controller, prob calling the same method name like GetBlock or 
> something. ($specials->GetBlock();, etc. ). So, the cakephp url would be 
> 'Specials/GetBlock'. I have ran across the method 'requestAction' which 
> can call the multiple controllers, by the cakephp url in the page 
> controller. Then assign it to a variable to be used in the view.
>
> Questions:
> 1. would i basically have to create a seperate method for each of the 
> pages i would have?
> 2. would the above way of using requestAction be the right way of 
> accomplishing this or is there a better way to do this?
> 3. in doing it this way, what is preventing someone from access the url 
> 'http://www.blah.com/Specials/GetBlock'?
>
> I hope i have explained this well enough.
>
> Brian
>
> >
>
>   


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



multiple controllers on 1 page

2006-09-07 Thread Brian French

Im still in the process of wrapping my head around the MVC. I understand 
the roles of each of the elements. What i am coming across that i cant 
seem to figure out is how to have multiple elements work on 1 page.

Example: Myspace (i know, but good example of what im talking about).

On the homepage you have multiple elements: Music box, Specials box, 
Cool new people, and videos.

In my understanding of MVC, each one of them would be a different 
controller, prob calling the same method name like GetBlock or 
something. ($specials->GetBlock();, etc. ). So, the cakephp url would be 
'Specials/GetBlock'. I have ran across the method 'requestAction' which 
can call the multiple controllers, by the cakephp url in the page 
controller. Then assign it to a variable to be used in the view.

Questions:
1. would i basically have to create a seperate method for each of the 
pages i would have?
2. would the above way of using requestAction be the right way of 
accomplishing this or is there a better way to do this?
3. in doing it this way, what is preventing someone from access the url 
'http://www.blah.com/Specials/GetBlock'?

I hope i have explained this well enough.

Brian

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