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 | |
/* | |
* | |
* vjikTwitter v0.2.1 | |
* Сниппет для вывода ленты статусов из Twitter | |
* | |
* Автор: Предводителев Сергей | |
* Сайт: http://predvoditelev.ru/ | |
* E-mail: [email protected] | |
* |
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 | |
$tvs = $modx->getCollection('modTemplateVarResource', array('tmplvarid' => 2, 'value' => 1)); | |
if (count($tvs) > 4) return 'Найдено больше 4 документов'; | |
foreach ($tvs as $tv) { | |
$res = $tv->getOne('Resource'); | |
$output .= '<p><b>' .$res->get('pagetitle'). '.</b> ' .$res->get('introtext'). ' (' .$res->get('publishedon'). ')</p>'; | |
} | |
return $output; |
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 | |
$modx->user // получение текущего пользователя | |
getOne(); | |
getMany(); | |
$modx->makeUrl($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
<?php | |
if ($views = $modx->resource->getTVValue(3)) { | |
$views++; | |
} else { | |
$views = 1; | |
} | |
$modx->resource->setTVValue(3,$views); | |
return $views; |
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 | |
$user = $modx->user; | |
$resource = $user->getMany('CreatedResources'); | |
foreach ($resource as $res) { | |
$views = $views + $res->getTVValue(3); | |
} | |
return $views; |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
<head> | |
<!-- jQuery --> | |
<script src="//yandex.st/jquery/1.9.1/jquery.min.js"></script> | |
<!-- jQuery cookies | |
* https://github.com/carhartl/jquerycookie/blob/master/src/jquery.cookie.js | |
* http://codernote.ru/jquery/rabotascookiesnajquery/ | |
--> | |
<script type="text/javascript" src="js/jquery.cookie.js"></script> | |
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
/* | |
Code snippet | |
Вывод [[*tv:modifikator]] | |
*/ | |
$text = $input; | |
$arr = explode(',',$text); | |
return $arr[1]; |
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 | |
/* | |
pluginName DisableCache | |
Вешаем этот плагин на событие OnLoadWebDocument | |
*/ | |
global $modx; | |
$modx->documentObject["cacheable"] = 0; |
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_CORE_PATH', 'c:/www/site.ru/core/'); | |
define('MODX_CONFIG_KEY', 'config'); | |
*/ | |
$rootPath = $_SERVER['DOCUMENT_ROOT']; | |
if ($rootPath[strlen($rootPath) - 1] != '/') { | |
$rootPath = $rootPath . '/'; } | |
OlderNewer