Welcome, Guest
Username: Password: Remember me

TOPIC: set var on controller

set var on controller 09 Apr 2015 13:23 #12907

  • albert
  • albert's Avatar
  • Offline
  • Senior Member
  • Posts: 70
  • Thank you received: 2
  • Karma: 2
Hi,
on a function of a controller i can get correctly vars by doing:

$jinput = JFactory::getApplication()->input;
$entry_id = $jinput->get('participant_id', null);

but when i try to set a var to recover on the view.html it doesn't work,
either if i do
$jinput->set('result',$result);
as
JRequest::setVar('result',$result);

i can't recover any data in the view.html.php

I could try to use the array of redirection, but i want to pass an object.
The administrator has disabled public write access.

set var on controller 13 May 2015 12:17 #12978

  • Romkabouter
  • Romkabouter's Avatar
  • Offline
  • Elite Member
  • Posts: 310
  • Thank you received: 131
  • Karma: 48
I do not exactly understand what you need, but in the controller you can set the state on the model:

$model = $this->getModel(); 
$model->setState('result',$result);

Then in your view you can pull that info in your view
$result = $model->getState('result');

Does that help?
The administrator has disabled public write access.
Time to create page: 0.072 seconds

Get Started