Skip to content

Instantly share code, notes, and snippets.

View phproberto's full-sized avatar

Roberto Segura phproberto

View GitHub Profile
@phproberto
phproberto / templates\protostar\html\layouts\com_content\article\image.php
Created October 23, 2015 02:03
Joomla layouts to generate thumbnails on the fly
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
@phproberto
phproberto / .gitconfig
Last active February 4, 2022 15:23
My git config file
[color]
status = auto
diff = auto
branch = auto
interactive = auto
ui = true
[alias]
amend = !"git commit --amend -C HEAD"
st = status
ci = commit
@phproberto
phproberto / multifont.php
Created June 26, 2012 02:34
Google font+variant joomla field
<?php
/**
* @copyright Copyright (C) 2012 Roberto Segura. All rights reserved.
* @license GNU General Public License version 3; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
jimport('joomla.form.formfield');
@phproberto
phproberto / override_controllers_admin_AdminImportController.php
Created October 26, 2012 11:07
Prestashop importer override to update prices without losing product names
<?php
class AdminImportController extends AdminImportControllerCore
{
public function __construct()
{
parent::__construct();
}
@phproberto
phproberto / blog.php
Last active February 15, 2018 10:56
Joomla: Use custom field for layout in category view
<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
@phproberto
phproberto / plg_system_test.php
Last active November 27, 2017 21:20
Experimento de cambio del formato de RSS para Ciro
<?php
/**
* The update check and notification email code is triggered after the page has fully rendered.
*
* @return void
*/
public function onAfterRender()
{
$app = JFactory::getApplication();
@phproberto
phproberto / explanation.md
Created October 27, 2017 11:54
Dummy router for Jooma Blank Component causing no 404 pages

Reproduce the issue:

  • You have Blank Component assigned to the home page of your Joomla! site.
  • When you manually enter a wrong url you don't get any 404 error. Your site redirects all the non-existing urls to the home page.

Explanation

Joomla redirects all the non-existing urls to the router of the component assigned as home page. Blank component does not have a router so you just get redirected to the home page.

This is a dummy empty router that will force an empty option be set if the component router is called to parse any url. This should not break anything because Blank Component cannot work without a menu item assigned to it. It only ensures that the router does not parse any url.

<?php
$app = JFactory::getApplication();
$newId = $app->input->getInt('mid');
$myId = $app->getUserStateFromRequest('phproberto.mid', 'mid');
if ($newId)
{
$url = JUri::getInstance();
@phproberto
phproberto / sample.php
Last active December 28, 2015 08:39
Load jQuery for Joomla! 2.5 - 3.x
<?php
if (version_compare(JVERSION, '3.0', '<'))
{
if (JFactory::getApplication()->get('jquery') !== true)
{
// Load jQuery in no conflict mode with B/C support
JHtml::script(JUri::root() . 'templates/joostrap/js/jquery.min.js');
JHtml::script(JUri::root() . 'templates/joostrap/js/jquery-migrate.min.js');
JHtml::script(JUri::root() . 'templates/joostrap/js/jquery-noconflict.js');
@phproberto
phproberto / README.md
Last active December 25, 2015 06:39
Ubuntu: JS minify compatible for bootstrap files using + Joomla bootstrap minify example

This uses UglifyJS to create minified files.

Install node:

# python-software-properties is needed to use add-apt-repository
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs