Joomla! Content Model . Another way ! - Joomla! Development http://t.co/kTQo3Tmd
When we work with Joomla! Component. We often have page listing of records ( rows ). Sometime we want to have quick check to publish / unpublish each row. It could be with Joomla! API in sample.
At first we must have chekbox col:
<td>
<?php echo JHTML::_('grid.checkedout', $row, $key, 'quizCategoryId'); ?>
</td>
Note:// in normal last params used for identifier to know which field of record will use . By default it's "id", but sometime your table don't use that name ( not good id ), we can set it here
And next
<td>
<?php echo JHTML::_('grid.published', $row, $key); ?>
</td>
Just use that :)
Now in controller we need function publish / unpublish to check these task. And in model we can simple publish / unpublish via 2 functions
public function publish() {
$mainframe = &JFactory::getApplication();
$cid = JRequest::getVar('cid');
$row = &JTable::getInstance('YtcQuizCategory', 'JTable');
foreach ($cid as $id) {
$row->load($id);
$row->publish($id, 1);
}
$mainframe->redirect('index.php?option=com_ytcquiz&controller=ytcQuizCategory');
}
public function unpublish() {
$mainframe = &JFactory::getApplication();
$cid = JRequest::getVar('cid');
$row = &JTable::getInstance('YtcQuizCategory', 'JTable');
foreach ($cid as $id) {
$row->load($id);
$row->publish($id, 0);
}
$mainframe->redirect('index.php?option=com_ytcquiz&controller=ytcQuizCategory');
}
By normal to use FQL ( Facebook Query Language ) we will use like this:
return $this->_facebook->api(array('method' => 'fql.query', 'query' => $this->query));
With result is array. Ya it's okay ! But there is wrapped class to make easier. So we can use like Joomla! way:
$fql = $jooFacebook->getFQL($appId, $secret);
$sql = ' SELECT message,source FROM status WHERE uid = ' . (int) $fql->getUserId();
$fql->setQuery($sql);
$result = $fql->loadObjectList();
Supported methods: loadResult / loadRow / loadAssoc / loadObject and loadObjectList
How to included a plugin or module in Component package
Written by Long TangFor some reason , when you packing a component and you also want to include a plugin or module into this component and it will automatic install when user install your component.
$ext = pathinfo($filename, PATHINFO_EXTENSION);