Controller interation with Model-View

For Joomla! 1.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Locked
oc666
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 215
Joined: Wed Oct 10, 2007 9:46 am
Location: Israel, TA
Contact:

Controller interation with Model-View

Post by oc666 » Fri Nov 06, 2009 12:24 pm

Hello
I build a component which the controller make some actions which return array with values. Those values need to manipulate the page that open after the controller make the actions.
I need some action to pass values to the model or view directly without setRedirect method. How could I do that?

Thanks
http://www.embad.com - new way to insert ads to your website

becyn
Joomla! Explorer
Joomla! Explorer
Posts: 458
Joined: Mon Aug 11, 2008 1:16 am
Location: Newburgh Ny , USA
Contact:

Re: Controller interation with Model-View

Post by becyn » Fri Nov 06, 2009 2:42 pm

oc666 wrote:Hello
I build a component which the controller make some actions which return array with values. Those values need to manipulate the page that open after the controller make the actions.
I need some action to pass values to the model or view directly without setRedirect method. How could I do that?

Thanks
set a task for the controller to intercept and process.
use JReqest::getVar() to capture POST vars.
use setVar() to set what view or layout you want.
Learn something new every day!

oc666
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 215
Joined: Wed Oct 10, 2007 9:46 am
Location: Israel, TA
Contact:

Re: Controller interation with Model-View

Post by oc666 » Fri Nov 06, 2009 4:42 pm

becyn wrote: set a task for the controller to intercept and process.
use JReqest::getVar() to capture POST vars.
use setVar() to set what view or layout you want.
Could you give me an example or some more info, please?

Thanks
http://www.embad.com - new way to insert ads to your website

becyn
Joomla! Explorer
Joomla! Explorer
Posts: 458
Joined: Mon Aug 11, 2008 1:16 am
Location: Newburgh Ny , USA
Contact:

Re: Controller interation with Model-View

Post by becyn » Fri Nov 06, 2009 7:36 pm

oc666 wrote:
becyn wrote: set a task for the controller to intercept and process.
use JReqest::getVar() to capture POST vars.
use setVar() to set what view or layout you want.
Could you give me an example or some more info, please?

Thanks
See the tutorials and API
http://docs.joomla.org/
A good book on this is "Mastering Joomla 1.5".
Learn something new every day!

oc666
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 215
Joined: Wed Oct 10, 2007 9:46 am
Location: Israel, TA
Contact:

Re: Controller interation with Model-View

Post by oc666 » Sat Nov 07, 2009 2:01 pm

becyn wrote:
See the tutorials and API
http://docs.joomla.org/
A good book on this is "Mastering Joomla 1.5".
I read about it and I've one last question. If I use JReqest::setVar() and then redirect to other page. Could I use the variables I set in the page I redirect into?

Thanks
http://www.embad.com - new way to insert ads to your website

becyn
Joomla! Explorer
Joomla! Explorer
Posts: 458
Joined: Mon Aug 11, 2008 1:16 am
Location: Newburgh Ny , USA
Contact:

Re: Controller interation with Model-View

Post by becyn » Sat Nov 07, 2009 4:43 pm

oc666 wrote:
becyn wrote:
See the tutorials and API
http://docs.joomla.org/
A good book on this is "Mastering Joomla 1.5".
I read about it and I've one last question. If I use JReqest::setVar() and then redirect to other page. Could I use the variables I set in the page I redirect into?

Thanks
If you mean the variables collected from a post method, the answer is yes. Assign the references in the the layout view.
Note that the contents of the last post operation is what will be in the array.
The best way to get a feel for it is to do some experimentation to find out how these things work.
Learn something new every day!

swast
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Apr 14, 2008 8:56 am
Contact:

Re: Controller interation with Model-View

Post by swast » Sun Nov 08, 2009 7:20 pm

maybe this could help

$view=&$this->getView($viewName,$viewType);
$view->assignRef('mBooks', $mBooks);
$view->assignRef('mWorks', $mWorks);

you set new var mWorks and give it value of $mWorks
Taras Remez
http://taraska.ru


Locked

Return to “Joomla! 1.5 Coding”