Skip to content

Instantly share code, notes, and snippets.

View phproberto's full-sized avatar

Roberto Segura phproberto

View GitHub Profile
@phproberto
phproberto / sample.php
Last active December 17, 2015 12:39
Retrieve JForm post data with JInput
<?php
// Required objects
$input = JFactory::getApplication()->input;
// Get the form data
$formData = new JRegistry($input->get('jform', '', 'array'));
// Get any data being able to use default values
$id = $formData->get('id', 0);
@phproberto
phproberto / plugin-parcheado.js
Last active December 16, 2015 16:59
Apaño para Ciro
(function($){
// AQUI TU CODIGO JS USANDO $
})(jQuery);
@phproberto
phproberto / examples.md
Last active December 11, 2015 14:38
Joomla! overridable asset loader

Joomla! overridable media asset loader

Asset loader based on @dongilbert asset loader ( https://gist.github.com/4205674 )

Stylesheets

ELHtml::asset('style.css');
@phproberto
phproberto / overridable-media.md
Last active December 10, 2015 21:58
Joomla! overridable media cheatsheet
@phproberto
phproberto / README.md
Created December 7, 2012 11:15
Trick to make com_taxonomy use content blog templates

Force com_taxonomy to use content category blog templates.

This method uses a hidden menu item to customize the com_taxonomy tag results.

Demo

You can see it in action in:

@phproberto
phproberto / bshead.php
Created June 21, 2012 23:25
In extension parameters show a section header customized with bootstrap appearence. Based on K2 approach.
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
jimport('joomla.form.formfield');
class JFormFieldBshead extends JFormField {
var $type = 'bshead';
@phproberto
phproberto / googlefont.php
Created June 16, 2012 01:01
Generate a JForm field list with all the fonts available in Google Web Fonts
<?php
defined('JPATH_BASE') or die;
jimport('joomla.html.html');
jimport('joomla.form.formfield');
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
class JFormFieldGooglefont extends JFormFieldList {
@phproberto
phproberto / sample.php
Created June 5, 2015 10:12
Joomla: Get available values for a fieldsattach multiple selector
<?php
$db = JFactory::getDbo();
// Get the available offices
$offices = array();
$officeFieldId = 5;
$query = $db->getQuery(true)
->select('field.extras')
->from('#__fieldsattach AS field')
@phproberto
phproberto / params.php
Last active August 29, 2015 14:14
Disable scripts inside joomla template
<?php
$doc = JFactory::getDocument();
// Supposes you have a template setting with name loadJquery
$loadJquery = $this->params->get('loadJquery', 1);
if ($loadJquery)
{
$removeJs = array(
'/jquery.min.js',
@phproberto
phproberto / default.xml
Created October 29, 2014 09:48
Sample Joomla logout & redirect view
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_MYCOMPONENT_TITLE_VIEW_LOGOUT" option="View">
<message>
<![CDATA[COM_MYCOMPONENT_TITLE_VIEW_LOGOUT_DESC]]>
</message>
</layout>
<fields name="params">
<fieldset name="basic">
<field