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
<?php | |
if ($modx->event->name != "OnHandleRequest") {return;} | |
$uri = $_SERVER['REQUEST_URI']; | |
if ($uri == '/robots.txt') return; | |
$url = $_SERVER['HTTP_HOST']; | |
$site_url = 'site.ru'; // replace with your domain | |
if ($url != $site_url || !$_SERVER['HTTPS']) { | |
$modx->sendRedirect('https://'.$site_url.$uri, array( | |
'responseCode' => 'HTTP/1.1 301 Moved Permanently') |
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
<?php | |
define('MODX_API_MODE', true); | |
require 'index.php'; | |
$modx->getService('error', 'error.modError'); | |
$modx->setLogLevel(modX::LOG_LEVEL_ERROR); | |
$modx->setLogTarget('ECHO'); | |
if (!XPDO_CLI_MODE) { | |
echo '<pre>'; | |
} |
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
<?php | |
if ($modx->event->name == "OnDocFormSave") { | |
if ($resource->class_key != 'Ticket') return; | |
$introtext = $resource->get('introtext'); | |
$generateIntrotext = $resource->getIntroText($resource->get('content'), false); | |
if (empty($resource->getProperty('disable_jevix'))) { | |
$generateIntrotext = $resource->Jevix($generateIntrotext); | |
} | |
if ($introtext == $generateIntrotext) { | |
$resource->set('introtext', ''); |
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
$('#id').load(location.href+' #id>*',''); |
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
<? | |
if ($_GET['url'] != ""){?> | |
<iframe src="http://docs.google.com/gview?url=http://site.ru<?=$_GET['url']?> | |
&embedded=true" width="100%" height="98%" frameborder="0">Ваш браузер не поддерживает фреймы | |
</iframe><? | |
} else { | |
}?> |
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
<?php | |
//set_time_limit(00); | |
define('MODX_API_MODE', true); | |
require 'index.php'; | |
$basePath = getcwd(); | |
$modx->getService('error', 'error.modError'); | |
$modx->setLogLevel(modX::LOG_LEVEL_ERROR); | |
$modx->setLogTarget(array | |
( |
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 $rows = ID | resource : 'elements' | fromJSON} | |
{foreach $rows as $idx => $row} | |
{$row.image} | |
{/foreach} |
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
.bg { | |
background-image: url('img/img.jpg'); | |
background-repeat: no-repeat; | |
background-position: top center; | |
background-size: cover; | |
height: 100vh; | |
width: 100%; | |
position: relative; | |
-webkit-transition: all 0.4s; | |
-moz-transition: all 0.4s; |
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
<?php | |
// Устанавливаем ТВ параметру mytv значение new у ресурса с id = 15 | |
if ($resource = $modx->getObject('modResource', 15)) { | |
$resource->setTVValue('mytv', 'new'); | |
} |
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
<?php | |
$response = $modx->runProcessor('resource/create', array( | |
'class_key' => 'msProduct', | |
'pagetitle' => 'Товар', | |
'parent' => 55, | |
'template' => 11, | |
'show_in_tree' => 1, | |
//Данные | |
'price' => 100, |
OlderNewer