Table of Contents

Component Development

Access Menu Item in component

$menu = JSite::getMenu();
$par1 = $menu->getParams(117);
$par2 = $menu->getParams(119);

if (!isset($pageView)) $app->getParams(BETHICO_COMPONENT)->set(BETHICO_COMPONENT.'_'.$app->input->getCmd('view').'_'.$app->input->getCmd('layout', 'default').'_view', 4);
$pageView = $app->getParams(BETHICO_COMPONENT)->get(BETHICO_COMPONENT.'_'.$app->input->getCmd('view').'_'.$app->input->getCmd('layout', 'default').'_view');

Parameters

How to set a component's param

// Load the current component params.
$params = JComponentHelper::getParams('com_content');
// Set new value of param(s)
$params->set('show_title', 1);

// Save the parameters
$componentid = JComponentHelper::getComponent('com_content')->id;
$table = JTable::getInstance('extension');
$table->load($componentid);
$table->bind(array('params' => $params->toString()));

// check for error
if (!$table->check()) {
    echo $table->getError();
    return false;
}
// Save to database
if (!$table->store()) {
    echo $table->getError();
    return false;
}