Skip to content

Instantly share code, notes, and snippets.

@amilabandara
Last active August 29, 2015 14:15
Show Gist options
  • Save amilabandara/5d6415e706a66e3e35f9 to your computer and use it in GitHub Desktop.
Save amilabandara/5d6415e706a66e3e35f9 to your computer and use it in GitHub Desktop.
Joomla essentials
<?php
#set variable from view
$this->form->setValue('image_name', null, $this->item->image);
#update dropdown
$('selector').val('value').trigger("liszt:updated");
#call any model from any component , any location
JModelLegacy::addIncludePath (JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_component' . DIRECTORY_SEPARATOR . 'models');
#add jtable if needs to call core functions
JTable::addIncludePath(JPATH_ADMINISTRATOR.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_component'.DIRECTORY_SEPARATOR.'tables');
#i.e if class name My_ComponentModelProduct break down it as follows
$model = JModelLegacy::getInstance('Product', 'My_ComponentModel');
?>
@4kasun
Copy link

4kasun commented Mar 4, 2015

Thank you very much. working perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment