Skip to content

Instantly share code, notes, and snippets.

View phproberto's full-sized avatar

Roberto Segura phproberto

View GitHub Profile
@phproberto
phproberto / default.php
Created March 11, 2014 23:29
Sample email this page link
<?php $url = JUri::getInstance()->toString(); ?>
<a class="email" title="Email a friend" href="mailto:?subject=Interesting information&body=I thought you might find this information interesting: <?php echo $url; ?>">Email</a>
@phproberto
phproberto / asset.php
Created May 21, 2014 00:11
Sample Joomla asset helper
<?php
/**
* @package MyExtension.Library
* @subpackage Helper
*
* @copyright Copyright (C) 2014 Roberto Segura. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die;
@phproberto
phproberto / post-receive
Created July 11, 2014 06:52
Base post-receive bash hook for web deploy
#!/bin/bash
cd /var/www/mywebfolder.com
unset GIT_DIR
git fetch origin
git reset --hard origin/master
@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
@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 / 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 / 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 / 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 / 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 / overridable-media.md
Last active December 10, 2015 21:58
Joomla! overridable media cheatsheet