This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$cache = JFactory::getCache(); // Объект кешировани | |
$cache->setCaching(1); // Пренудительно включаем кеширование | |
$cache->get(array($this,'getFilterPrice'), $args=array(),$cacheId=false) // |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Цели метрики | |
* Область видимости функции должна быть ГЛОБАЛЬНОЙ | |
*/ | |
slTarget=function (targetName) { | |
if(Ya===undefined) {console.error('Не найден счетчик метрики'); return false;} | |
var counterID=Ya.Metrika2.counters()[0].id; | |
ym(counterID, 'reachGoal',targetName); | |
console.info('Событие: '+targetName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FIND_IN_SET('a', 'a,b,c,d,e,f') | |
$query->where('FIND_IN_SET("'.(int) $categoryId.'", a.category)'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM news | |
WHERE id IN (2, 10, 3, 88, 23) | |
ORDER BY FIELD (id, 2, 10, 3, 88, 23) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function getPrev($img,$sfx='-prewXS',$width=150, $height=150,$quility=5,$refresh=false) { | |
jimport( 'joomla.filesystem.file' ); | |
jimport('joomla.image.image'); | |
$prevPath=JFile::stripExt($img).$sfx.'.jpg'; | |
if(JFile::exists( JPATH_ROOT.'/'.$prevPath) && !$refresh) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a').click(function(event) { | |
event.preventDefault(); // Будут отменен переход по ссылке | |
event.stopPropagation(); // Отмена всплытия | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var firstName = 'Tal'; | |
var screenName = 'ketacode' | |
// Уродский способ | |
'Hi, my name is ' + firstName + ' and my twitter screen name is @' + screenName; | |
// Пацанский | |
var template = 'Hi, my name is {first-name} and my twitter screen name is @{screen-name}'; | |
var txt = template.replace('{first-name}', firstName) | |
.replace('{screen-name}', screenName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$image = file_get_contents('http://www.url.com/image.jpg'); | |
2 | |
file_put_contents('/images/image.jpg', $image); //сохраняем изображение на вашем сервере |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="example-class<?php echo ($xyz++%2); ?>"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("input[type=text]").keydown(function(event) { | |
// Разрешаем: backspace, delete, tab и escape | |
if ( event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 || | |
// Разрешаем: Ctrl+A | |
(event.keyCode == 65 && event.ctrlKey === true) || | |
// Разрешаем: home, end, влево, вправо | |
(event.keyCode >= 35 && event.keyCode <= 39)) { | |
// Ничего не делаем | |
return; | |
} |