Skip to content

Instantly share code, notes, and snippets.

@Cook-Self-Service
Cook-Self-Service / models-forms-singular.xml
Last active December 26, 2015 14:49
JSON - encoded field
<form>
<!-- Your forms declarations -->
<fieldset name="sigular.form">
<field name="..."/>
<fieldset name="sigular.form2">
<field name="..."/>
<!-- Write at the end of the file -->
<!-- JSON FIELDSET -->
<fieldset class="fieldsform form-horizontal">
<legend><?php echo JText::_('My JSON fieldset');?></legend>
<?php echo $this->renderFieldset($this->form->getGroup('attribs', true)); ?>
</fieldset>
@Cook-Self-Service
Cook-Self-Service / view.html.php
Last active December 26, 2015 20:19
Structure of the empty fork file
// no direct access
defined('_JEXEC') or die('Restricted access');
/**
* Demo120 View
*
* @package Demo120
* @subpackage Classes
*/
class Demo120ViewProduct extends Demo120CkViewProduct
{
@Cook-Self-Service
Cook-Self-Service / view.html.php
Created October 29, 2013 01:09
Fork to replace
class Demo120ViewProduct extends Demo120CkViewProduct
{
protected function displayProduct($tpl = null)
{
echo("Forked"); // Fork and replace the original function
}
}
@Cook-Self-Service
Cook-Self-Service / view.html.php
Last active December 26, 2015 20:19
Fork to execute before
class Demo120ViewProduct extends Demo120CkViewProduct
{
protected function displayProduct($tpl = null)
{
// Read the ACL of the current user
$acl = Demo120Helper::getActions();
if ($acl->get('core.admin'))
{
// Call another Layout
$this->displayAdminLayout();
@Cook-Self-Service
Cook-Self-Service / view.html.php
Created October 29, 2013 01:12
Fork to execute after
class Demo120ViewProduct extends Demo120CkViewProduct
{
protected function displayProduct($tpl = null)
{
$result = parent::displayProduct($tpl);
$document = JFactory::getDocument();
$document->title = "Forked title - " . $document->title;
return $result;
@Cook-Self-Service
Cook-Self-Service / html.php
Last active January 2, 2016 06:19
Image Thumb
<?php echo JDom::_('html.fly.file', array(
// Get the field value
'dataKey' => 'image',
'dataObject' => $row,
//Or
//'dataValue' => $row->image,
// Define as indirect, with the root folder alias
@Cook-Self-Service
Cook-Self-Service / getUrl.php
Created January 4, 2014 23:51
Get thumb image url
MycomponentHelper::getFile($path, 'indirect', array(
'width' => 100,
'height' => 100,
'attrs' => array('crop', 'center')
));
MycomponentHelper::getFile($path);
MycomponentHelper::getFile($path, 'direct');