Skip to content

Instantly share code, notes, and snippets.

View proweb's full-sized avatar

Sergey Mochalov proweb

View GitHub Profile
@proweb
proweb / new_gist_file
Created June 9, 2013 21:19
How to redirect using the Joomla API
// joomla 2.5
$app = JFactory::getApplication();
$link = 'http://www.domain.com/';
$msg = 'You have been redirected to domain.com';
$app->redirect($link, $msg, $msgType='message');
@proweb
proweb / gist:4985650
Created February 19, 2013 12:59
Remoove Mootools for Unregistered users in Joomla
//Removing Mootools
$head = $doc->getHeadData();
//Unset Mootools for unregistered users
if($user->guest){
$head=$this->getHeadData();
reset($head['scripts']);
unset($head['scripts'][$this->baseurl . '/media/system/js/core.js']);
unset($head['scripts'][$this->baseurl . '/media/system/js/mootools.js']);
unset($head['scripts'][$this->baseurl . '/plugins/system/mtupgrade/mootools.js']);
unset($head['scripts'][$this->baseurl . '/media/system/js/mootools-core.js']);
@proweb
proweb / default.vcl
Created November 4, 2015 15:40 — forked from fevangelou/default.vcl_PREFACE.md
The perfect Varnish configuration for Joomla (& other CMS based) websites
#################################################################################
### The perfect Varnish configuration for Joomla (& other CMS based) websites ###
#################################################################################
# USE: Place the contents of this configuration inside the main
# Varnish configuration file, located in: /etc/varnish/default.vcl (root server access required - obviously)
# IMPORTANT: The following setup assumes a 2 minute cache time. You can safely increase
# this to 5 mins for less busier sites or drop it to 1 min or even 30s for high traffic sites.
@proweb
proweb / blank-template-snippets.txt
Created April 11, 2012 16:52 — forked from schmidt1024/template-snippets.txt
Blank Template Snippets for Joomla! 2.5
# index.php :: load the global joomla header
# between <head> and </head>
<jdoc:include type="head" />
# index.php :: output of the system messages
# between <body> and </body>
<jdoc:include type="message" />
# index.php :: article and component output
# between <body> and </body>
@proweb
proweb / index.php
Created January 25, 2012 19:53
Joomla - Execute some code on home page and other code on all other pages
<?php
//This will detect the Home Page of Joomla and perfom whatever code you tell it to
$menu = & JSite::getMenu();
if ($menu->getActive() == $menu->getDefault()) {
//This code will be executed on the home page
} else {
//This code will be executed on every page except the home page
@proweb
proweb / index.php
Created December 10, 2011 17:42
Правильное (последовательное) подключение мета-тегов, CSS и JS.
<?php
defined('_JEXEC') or die;
/* The following line loads the MooTools JavaScript Library */
JHTML::_('behavior.mootools');
/* The following line gets the application object for things like displaying the site name */
$app = JFactory::getApplication();
/* Get the document object */
@proweb
proweb / default.php
Created September 28, 2011 20:29
Last and first classes MOD_MENU Joomla default.php
// Copy /modules/mod_menu/tmpl/default.php to /templates/MYTEMPLATE/html/mod_menu/default.php
// Around line 34, find:
if ($item->deeper) {
$class .= 'deeper ';
}
// Replace this with:
$currentitemcount ++;
@proweb
proweb / gist:1156153
Created August 19, 2011 06:00
jQuery focus on first field trick
$(document).ready(function(){
$("input[type=text]:first").focus();
});
@proweb
proweb / .htaccess
Last active August 29, 2015 14:17
Block Semalt.com and buttons-for-website.com
# block visitors referred from semalt.com
RewriteEngine on
RewriteCond %{HTTP_REFERER} semalt\.com [NC]
RewriteRule .* – [F]
# End semalt block
# block referer spam buttons for website
RewriteEngine On
RewriteCond %{HTTP_REFERER} buttons\-for\-website\.com
RewriteRule ^.* - [F,L]
# End buttons for website block