Welcome, Guest
Username: Password: Remember me

TOPIC: Access data

Access data 20 Jun 2017 12:26 #15221

  • dyvel
  • dyvel's Avatar
  • Offline
  • Elite Member
  • Posts: 200
  • Thank you received: 11
  • Karma: 10
Hi

I've been away from component development for a long time. I have a few questions, as I'm trying to get my head around it.
I've created a Fly on an item view, where I have data from related tables. I have also added a custom button on the item view.

When clicking the button, I'm trying to access this related data, but not sure how.

$model = $this->getModel();
$item = $model->getItem();

Doesn't contain any of those related data.

Any help is greatly appreciated :-)
The administrator has disabled public write access.

Access data 22 Jun 2017 21:55 #15227

  • liubov
  • liubov's Avatar
  • Offline
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 278
  • Thank you received: 35
  • Karma: 22
did you write your custom code (custom task & redirection) in the right controller file ?
	/**
	* Method to custom an element.
	*
	* @access	public
	*
	* @return	void
	*/
	public function custom()
	{
		// TODO : Write your custom code here

		$model = $this->getModel();

		//Define the redirections
		switch($this->getLayout() .'.'. $this->getTask())
		{
		case 'extension.custom':
                // here you have to write the redirection (wich view?) in order to load the datas and display the layout ...
				$this->applyRedirection($result, array(
					'stay',
					'com_mycomponent.myview.default'
				), array(
					'cid[]' => null
				));
				break;

			default:
				$this->applyRedirection($result, array(
					'stay',
					'stay'
				));
				break;
		}
	}
Last Edit: 22 Jun 2017 21:56 by liubov.
The administrator has disabled public write access.
Time to create page: 0.178 seconds

Get Started