One of our clients emailed us yesterday afternoon and told us that after making a small change on his YouGrids Joomla template, he was seeing the following warnings (several times):
Warning: explode() expects parameter 2 to be string, array given in /templates/yougrids/yjsgcore/lib/yjsg_loadgrids.php on line 247
Warning: array_key_exists() expects parameter 2 to be array, null given in /templates/yougrids/yjsgcore/lib/yjsg_loadgrids.php on line 254
Additionally, most of the content was not displayed (especially on the homepage). We opened up the offending template file (in all fairness, it was the first time we heard about a YouGrids template) which was the file yjsg_loadgrids.php located under the templates/yougrids/yjsgcore/lib folder, and we examined the file closely. It didn’t take us long to find the origin of the problem, it was in this line:
$grid_widths = explode('|', $document->params->get( $get_w_param ));
Apparently, $document->params->get( $get_w_param ) was already an array, so the whole statement was not needed (the explode function). In any case, the explode function will not work if the second parameter is other than a string. So, in order to fix the problem, we changed the above line to:
if (is_array($document->params->get( $get_w_param ))) $grid_widths = $document->params->get( $get_w_param ); else $grid_widths = explode('|', $document->params->get( $get_w_param ));
…and that fixed the problem!
But, why did the problem happen in the first place?
According to YouGrids support, the problem happened because the way Joomla saves/retrieves a specific type of data to/from the database has changed in recent Joomla 3 versions. That was the cause of the issue.
Is there any other way to fix the problem?
YouGrids claim that they have fixed the problem in the template, and all one needs to do is to uninstall/re-download/reinstall the YouGrids template. We can’t confirm if the latest version of the template fixes the problem because we haven’t tried it.
If you have the same problem on your YouGrids Joomla template and you were not able to solve it using our method above, then please contact us, we are more than happy to help. Please note that our super affordable fees apply.
Thank you! This helped for yet another YouJoomla template!
You’re welcome Bernd!