Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View vasia123's full-sized avatar

Vasily Krakovetsky vasia123

View GitHub Profile
@vasia123
vasia123 / gridtv.class.php
Created February 17, 2017 19:53
Инструкция по созданию TV для табличных данных динамического размера в Modx Revolution.
<?php
if(!class_exists('GridTVRender')) {
class GridTVRender extends modTemplateVarInputRender {
public function getTemplate() {
return $this->modx->getOption('core_path').'components/gridtv/tv/input/tpl/gridtv.tpl';
}
public function process($value,array $params = array()) {
}
}
}
@vasia123
vasia123 / YMLexport2.php
Created September 9, 2016 09:01
YML export for miniShop2
<?php
$siteName = $modx->getOption('siteName', $scriptProperties, $modx->getOption('site_name')); // Имя сайта
$companyName = $modx->getOption('companyName', $scriptProperties, $modx->getOption('site_name')); // Компания
$bid = $modx->getOption('bid', $scriptProperties, 10); // Цена за клик
$siteUrl = $modx->makeUrl($modx->getOption('site_start'), '', '', 'full'); // Ссылка на главную страницу сайта
$descTpl = strip_tags($modx->getOption('descTpl', $scriptProperties, '[[+description]]')); // Шаблон для описания товара, без html
$paramCurrency = $modx->getOption('paramCurrency', $scriptProperties, 'RUR'); // Валюта
$paramDelivery = $modx->getOption('paramDelivery', $scriptProperties, true); // Доставка, по умолчанию - да. Можно указать имя параметра.
//////////////////////////////////////////////////////////////////////////////
@vasia123
vasia123 / packages.php
Last active July 25, 2023 09:24 — forked from govza/packages.php
Автоматическая смена провайдера
<?php
// provider id => array of packages
$listPackagesToInstall = array(
1 => array( // standart modx provider
'sdStore'
, 'translit'
, 'SanitizeUpload'
, 'TinyMCE'
, 'FormIt'
@vasia123
vasia123 / gist:6962883
Last active December 25, 2015 10:39 — forked from Fi1osof/gist:4986826
Just translated comments for the method of adding items to the context menu. List of menu items listed in the line 13. Taken from article http://community.modx-cms.ru/blog/research/9846.html
<?php
switch($modx->event->name){
case 'OnManagerPageInit':
$JS = <<<JS
<script type="text/javascript">
Ext.onReady(function(){
// Get a tree
var tree = Ext.getCmp('modx-resource-tree');
@vasia123
vasia123 / gist:4233238
Created December 7, 2012 13:20
Разбор большого XML файла с помощью PHP
<?php
// convert http://webi.ru/webi_articles/big_xml.html to class
class webi_xml
{
var $webi_depth; // счетчик, для отслеживания глубины вложенности
var $this->webi_tag_open; // будет содержать массив открытых в данный момент тегов
var $this->webi_data_temp; // этот массив будет содержать данные одного тега
@vasia123
vasia123 / update.sh
Created October 22, 2012 17:47
Ubuntu 10.04 (nginx + php5-fpm): Update MODx 2.2
#!/bin/bash
echo "Enter username"
read USERNAME
##############
echo "Updating MODx"
cd /var/www/$USERNAME/www/
@vasia123
vasia123 / addsite.sh
Created October 22, 2012 17:47
Ubuntu 10.04 (nginx + php5-fpm): Install MODX 2.2 including user, virtual host, database
#!/bin/bash
# MySQL root password
ROOTPASS="password"
TIMEZONE="Europe/Moscow"
MYSQLPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12`
SFTPPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12`
##############