This file contains hidden or 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
| <?php | |
| define('ROOT', MODX_BASE_PATH); | |
| define('EX', 'jpg,png,gif,jpeg,doc,xls,zip,pdf'); // Через запятую имена расширений (нижний регистр) | |
| $folder=isset($folder) ? $folder : "assets/images/"; // папка назначения стыренного контента | |
| if(!is_dir(MODX_BASE_PATH.$folder)) mkdir(MODX_BASE_PATH.$folder); | |
| // Функция траслита | |
| function rus2translit($string) { | |
| $converter = array( | |
| 'а' => 'a', 'б' => 'b', 'в' => 'v', | |
| 'г' => 'g', 'д' => 'd', 'е' => 'e', |
This file contains hidden or 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
| <?php | |
| $chunk = 'tpl.msdfcMsg'; | |
| $discounts = array( | |
| '100000' => '10%', | |
| '150000' => '15%', | |
| '200000' => '20%', | |
| ); | |
| krsort($discounts); | |
| reset($discounts); | |
| $actionKey = 'msdfc_action'; |
This file contains hidden or 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
| <?php | |
| define('MODX_API_MODE', true); | |
| require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/config/config.inc.php'; | |
| require_once MODX_BASE_PATH . 'index.php'; | |
| if (XPDO_CLI_MODE) { | |
| $file = @$argv[1]; | |
| $fields = @$argv[2]; | |
| $update = (bool) !empty($argv[3]); |
This file contains hidden or 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
| const d = | |
| [{ | |
| "caption": "Слайд", | |
| "fields": [{ | |
| "field": "image", | |
| "caption": "Изображение", | |
| "inputTVtype": "image" | |
| },{ | |
| "field": "title", | |
| "caption": "Заголовок" |
This file contains hidden or 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
| чтобы получить вот такой html код | |
| <a href="tel:8800260000">8(800)260-00-00</a> | |
| я делаю так | |
| <a href="tel:{$_modx->config.phone | tel}">{$_modx->config.phone}</a> | |
| где в переменной $_modx->config.phone содержится номер «8(800)260-00-00». | |
| tel — это сниппет, со следующим кодом | |
| <?php |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Слайдер на flexBOX</title> | |
| <meta name="description" content="Слайдер на flexBOX"> |
This file contains hidden or 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
| <?php | |
| //Привязывать к событию OnFileManagerUpload. | |
| $currentdoc = $modx->newObject('modResource'); | |
| foreach($files as $file) | |
| { | |
| if($file['error'] == 0) | |
| { | |
| $pathInfo = pathinfo($file['name']); | |
| $oldPath = $directory.$file['name']; | |
| $newPath = date("Y-m-d-h-s-").$currentdoc->cleanAlias($pathInfo['filename']).'.'. $pathInfo['extension']; |
This file contains hidden or 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
| Решение для магазина miniShop2. Проверялось на версии ms2 2.1.8-pl3, MODX Revo 2.3.1-pl. | |
| Простой способ делать зависимость цены доставки от общей суммы заказа. | |
| 1. Создаем файл (myDeliveryHandler.class.php) в каталоге /core/components/minishop2/custom/delivery/ | |
| 2. Получается файл c путем /core/components/minishop2/custom/delivery/myDeliveryHandler.class.php | |
| 3. Копируем содержимое в файл myDeliveryHandler.class.php | |
| 4. Теперь добавляем в настройки системы новый ключ. Я добавляю в настройки контекста. | |
| 5. Ключ - ms2_delivery_cost_free_1 . Цифра «1» - это ID способа доставки. В значении указываем нужную сумму. | |
| 6. У каждого способа доставки указываем класс-обработчик myDeliveryHandler. |
This file contains hidden or 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
| #MODX requred pdoTools, phpthumbon, jevix | |
| <!--<?xml version="1.0" encoding="utf-8"?> | |
| <rss xmlns:yandex="http://news.yandex.ru" | |
| xmlns:media="http://search.yahoo.com/mrss/" | |
| xmlns:turbo="http://turbo.yandex.ru" version="2.0"> --> | |
| <channel> | |
| [[!pdoResources? | |
| &tpl=`turborss.item` | |
| &limit=`100` |
This file contains hidden or 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
| 1. Установка MODx. Плагины: Ace, Collections, pdoTools, FormIt, phpThumbOn, TinyMCE / CKEditor, translit, MIGX, AutoTemplate. | |
| Настройки: | |
| Раздел: Дружественные URL | |
| Транслитерация псевдонимов: russian; | |
| Использовать дружественные URL: Да; | |
| Строгий режим дружественных URL: Да; | |
| Проверять на дублирование URI во всех контекстах: Да; | |
| Использовать вложенные URL: Да; | |
| Не забудьте также переименовать ht.access в .htaccess в корне сайта. | |
| Раздел: Панель управления |
NewerOlder