09 December 2014

Custom component of Joomla - for multiple checkboxes selection issue

For multiple checkboxes issues in Joomla. If you are facing any problem like this you can solve it by following instruction:

in libraries/joomla/form/fields/checkboxes.php
line line 67: 
need to change this two lines

$values = (is_array($this->value)) ? (array) $this->value : explode(",",$this->value);
$checked = (in_array((string) $option->value, $values) ? ' checked="checked"' : '');

You can check joomlacode.org.

http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=28640

Joomla 2.5.11 to Joomla 2.5.11 2.5.14 bug Frontend login error: “You cannot access the private section"

This bug you can solve it easily by using phpmyadmin. You have to run 2 query into assets table.
1) UPDATE `prefix_assets` SET `parent_id`=1 WHERE `parent_id`=0 AND id>1
After executing first query, run the following query:
2) UPDATE `prefix_assets` SET `parent_id`=0 WHERE `title` = 'Root Asset'
I hope this can help you

Recaptcha into custom form in Joomla

How to use recaptcha into custom form in joomla::
In order to use joomla default recaptcha plugin follow these steps-
1)Get recaptcha keys from http://www.google.com/recaptcha
2)Set these keys to recaptcha plugin and activate it if it's not.
3)Put below code where you want to show recaptcha
//php code
JPluginHelper::importPlugin('captcha');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onInit','dynamic_recaptcha_1');
//html code inside form tag
<div id="dynamic_recaptcha_1"></div>
4)Put this code where you validating/processing the form
$post = JRequest::get('post');
JPluginHelper::importPlugin('captcha');
$dispatcher = JDispatcher::getInstance();
$res = $dispatcher->trigger('onCheckAnswer',$post['recaptcha_response_field']);
if(!$res[0]){
die('Invalid Captcha');
}
//For Joomla 3.x
$post = JFactory::getApplication->input->post;
$dispatcher = JEventDispatcher::getInstance();

How to load Joomla framework into your non Joomla/ external php script

Load the Joomla! Framework in a Non-Joomla! PHP Script:
If you've ever had the need to load the Joomla! framework inside an external, non-Joomla! PHP script (say, when using Jumi), you can use this handy script to load the necessary files to allow you to use Joomla! classes in your PHP script.
define( '_JEXEC', 1 );
define( '_VALID_MOS', 1 );
// JPATH_BASE should point to Joomla!'s root directory
define( 'JPATH_BASE', realpath(dirname(__FILE__) .'/' ) );
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();

How to add calender or datepicker in Joomla 3 or Joomla 2.5

How to add calender or datepicker in Joomla 3 or Joomla 2.5 :
JHTML::_('behavior.calendar');
JHTML::_('behavior.tooltip');
<?php echo JHTML::calendar('','published_date','inputdate','%Y-%m-%d'); ?>
where field name->published_date
and input id ->inputdate