Skip to content

Instantly share code, notes, and snippets.

View rdeutz's full-sized avatar

Robert Deutz rdeutz

  • Robert Deutz Business Solution
  • Aachen, Germany
View GitHub Profile
@rdeutz
rdeutz / log_data.php
Created December 19, 2013 14:08
two functions to log $data into a file using JLog
protected function logData($data, $type="ERROR")
{
jimport('joomla.log.log');
$types = array(
'EMERGENCY',
'ALERT',
'CRITICAL',
'ERROR',
'WARNING',
'NOTICE',
@rdeutz
rdeutz / gist:6988153
Last active December 25, 2015 13:59
Multilanguage Frontpage check
/**
* frontpage check
*/
$menu = JFactory::getApplication()->getMenu();
$defaultmenuitems = array($menu->getDefault()->id, $menu->getDefault(JFactory::getLanguage()->getTag())->id);
$isFrontpage = in_array($menu->getActive()->id, $defaultmenuitems);
@rdeutz
rdeutz / gist:6146981
Created August 3, 2013 16:07
adding form fields on the fly
Manipulation a JForm is easy the best place to add fields is to use the preprocessForm function
protected function preprocessForm(JForm $form, $data, $group = 'content')
{
// Add some needed hidden fields
$fields = array('id','cid');
foreach ($fields AS $field)
{
$element = new SimpleXMLElement('<field></field>');
@rdeutz
rdeutz / gist:4444404
Created January 3, 2013 15:46
Something I can't get into my head and remember
// Echo a query
echo nl2br(str_replace('#__','jos_',$query));