Some Joomla Tips

About me,I am working on joomla since 2014. and so i find some tips, which are use for mostly during joomla work, so i would like to share to you. which will probably helpful for you.

  • Get menu ID  In joomla:
    $app = JFactory::getApplication();
    $menu = $app->getMenu()->getActive()->id;
    echo $menu;
    
  • Database Connection:
    $db= JFactory::getDBO();
    $q= "add your query here";
    $db->setQuery($q);
    //For get data
    $data = $db->loadObjectList();
    //For get single row
    $data = $db->loadObject();
    
  • DS Error:
    Just add bellow code in php file, so that error will fixed.

    if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
    
  • ADD tab code in component:
    echo JHtml::_('tabs.start', 'tab_group_id', $options);
     
    echo JHtml::_('tabs.panel', JText::_('Details'), 'details');
    echo 'Details';
     
    echo JHtml::_('tabs.panel', JText::_('Gallery'), 'gallery');
    echo 'Gallery';
    
    echo JHtml::_('tabs.panel', JText::_('Properties'), 'Properties');
    echo 'Properties';
     
    echo JHtml::_('tabs.panel', JText::_('Prices'), 'Prices');
    echo 'Prices';
    
    echo JHtml::_('tabs.panel', JText::_('Reservation Availablity'), 'Availablity');
    echo 'Availablity';
     
    echo JHtml::_('tabs.end');
    
  • Get Field Name in Joomla:
    $cols = $db->getTableColumns('[TABLENAME]');
Categories: Developer Notes
Strict Standards: Only variables should be passed by reference in /home/elisegxm/public_html/wp-content/themes/eliseinfotech/functions.php on line 62

Strict Standards: Only variables should be assigned by reference in /home/elisegxm/public_html/wp-content/themes/eliseinfotech/functions.php on line 62
| Comments