Skip to content

Instantly share code, notes, and snippets.

:atom:
coding

Sergey Mochalov proweb

:atom:
coding
Block or report user

Report or block proweb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@proweb
proweb / gist:1156153
Created Aug 19, 2011
jQuery focus on first field trick
View gist:1156153
$(document).ready(function(){
$("input[type=text]:first").focus();
});
@proweb
proweb / gist:1169347
Created Aug 24, 2011
Joomla 1.6 add "first" and "last" CSS classes to mod_menu
View gist:1169347
//Copy /modules/modmenu/tmpl/default.php to /templates/MYTEMPLATE/html/modmenu/default.php
// Replace
if ($item->deeper) {
$class .= 'deeper ';
}
// with this
$currentitemcount ++;
if ($item->shallower or $currentitemcount == count($list)) {
$class .= 'last ';
@proweb
proweb / default.php
Created Sep 28, 2011
Last and first classes MOD_MENU Joomla default.php
View 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 / index.php
Created Dec 10, 2011
Правильное (последовательное) подключение мета-тегов, CSS и JS.
View index.php
<?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 / index.php
Created Jan 25, 2012
Joomla - Execute some code on home page and other code on all other pages
View index.php
<?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 / blank-template-snippets.txt
Created Apr 11, 2012 — forked from Bloggerschmidt/template-snippets.txt
Blank Template Snippets for Joomla! 2.5
View blank-template-snippets.txt
# 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 Jan 25, 2013
HTML 5 Joomla head override - Переписываем вывод HEAD для Joomla 2.5 в соответствии со стандартами HTML5
View index.php
<?php
// no direct access
defined('_JEXEC') or die;
// Variables
$doc = JFactory::getDocument();
$user = JFactory::getUser();
$template = 'templates/' . $this->template;
// get html head data
@proweb
proweb / router.php
Created Feb 2, 2013
K2 Router (without "item" in URL)
View router.php
<?php
/**
* @version $Id: router.php 1618 2012-09-21 11:23:08Z lefteris.kavadas $
* @package K2
* @author JoomlaWorks http://www.joomlaworks.net
* @copyright Copyright (c) 2006 - 2012 JoomlaWorks Ltd. All rights reserved.
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
*/
// no direct access
@proweb
proweb / gist:4985650
Created Feb 19, 2013
Remoove Mootools for Unregistered users in Joomla
View gist:4985650
//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 / new_gist_file
Created Jun 9, 2013
How to redirect using the Joomla API
View new_gist_file
// 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');
You can’t perform that action at this time.