View multiTV.php
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
@INCLUDE/assets/tvs/multitv/multitv.customtv.php | |
[[multiTV? | |
&tvName=`item_photo_MTV` | |
&docid=`[*id*]` | |
&outerTpl=`@CODE:((wrapper))` | |
&rowTpl=`item_gallery_mini_TPL` | |
&display=`all` | |
]] |
View user info.php
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
$useridmassive = $modx->userLoggedIn(); | |
$userid = $useridmassive["id"]; // Получаем ИД-пользователя | |
[+phx:userinfo=`email`+] | |
$user_data = $modx->getWebUserInfo($userId); //получение массива с инфой о пользователе по id, например $user_data['email'] |
View editedon.php
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
&dateSource=`editedon` &dateFormat=`%d.%m.%Y` | |
<div class="news"> | |
[+date+] | [+longtitle+] | |
<p>[+introtext+]</p> | |
</div> |
View convertDate.php
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
[!convertDate? &MyDate=`[*createdon*]`!] | |
<?php | |
$MyDate= (isset($MyDate)) ? $MyDate: $modx -> documentObject['MyDate']; | |
$type= (isset($type)) ? $type: $modx -> documentObject['type']; | |
$monthes = array('','января','февраля','марта','апреля','мая','июня','июля','августа','сентября','октября','ноября','декабря'); | |
$day = date("j" ,$MyDate); | |
$month = $monthes[date("n",$MyDate)]; | |
$year = date("Y",$MyDate); | |
View parent.php
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 = [*parent*] // в документе MODx | |
[*id:parent=`pagetitle`*] // в документе MODx | |
[*parent:parent=`id`*] // в документе MODx | |
[*parent:parent=`id`:parent=`pagetitle`*] // в документе MODx |
View ChildCounter.php
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
/***********************Как вывести количество документов в папке?*********************/ | |
[[ChildCounter? &docid=`406` &depth=`2` &tpl=`15` &published=`0` &isfolder=`0`]] | |
&dicId - ID сканируемой папки | |
&depth - глубина сканирования | |
&isfolder - Если 1 - вернёт количество папок, если 0 - количество документов НЕ папок. Значения 0 или 1. По умолчанию 0. | |
&published - Если 0 - вернёт количество неопубликованных документов, если 1 - количество опубликованных документов. Значения 0 или 1. По умолчанию 1. | |
&tpl - если указан, то возвращает количество документов с шаблоном id которого равен &tpl |
View truncate.php
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
/**********Как обрезать длину строки?******************/ | |
[!truncate? &text=[*pagetitle*] &len=200!] // в документе MODx | |
<?php | |
$lenf = $len; | |
$order = array("\r\n", "\n", "\r"); | |
$replace = '<br />'; | |
$what = str_replace($order, $replace, $text); | |
if (strlen($what) > $lenf) { |
View formatting_phones.php
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 class="phone-a" href="tel:[[formatting_phones? &phone=`phone1`]]" title="">[!GetField? &docid=`2` &field=`phone1`!]</a> | |
<?php | |
$tv = $modx->getTemplateVar($phone, "",2); | |
$string = $tv['value']; | |
$string = preg_replace('~[^0-9+]+~','',$string); | |
return $string; |
View LastView.php
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
/***************Последние просмотренные*******************/ | |
[!LastView? &mode=`register`!] | |
[!Ditto? &tpl=`last-tpl` &documents=`[!LastView? &mode=`show` !]` &filter=`id,[*id*],2` &hideFolders=`1` &display=`3` &extenders=`nosort`!] | |
<?php | |
$mode = isset($mode) ? $mode : 'show'; | |
$outerTpl = isset($outerTpl) ? $outerTpl : '@CODE:[+rows+]'; | |
$outerClass = isset($outerClass) ? $outerClass : 'last-view'; | |
$rowTpl = isset($rowTpl) ? $rowTpl : '@CODE:[+id+],'; |
View conversion.php
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
/*********Конверсия валют************/ | |
[[conversion? &price=`[*price*]`]] | |
<?php | |
$docid = 2; | |
$kurs = $modx->getTemplateVar('kurs', '*', $docid); | |
$kurs = $kurs['value']; | |
$kurs = str_replace(',', ".", $kurs); | |
$price = $price*$kurs; |