MODx/Подключаемые плагины/PHx: различия между версиями

Содержимое удалено Содержимое добавлено
Строка 380:
Создадим модификатор, подобный модификатору ''':love''' из предыдущего примера, но дополнительно дадим ему возможность добавлять к исходной строке значение переданного параметра, если оно было указано.
 
# В Менеджере ресурсов надо зайти в Ресурсы(Элементы) -> Управление ресурсами (элементами) -> Сниппеты
# Go to Resources -> Manage Resources -> Snippets
# Нажать "Новый сниппет"
# Click "new snippet"
# ForВ theкачестве snippetимени nameсниппета we enterзадать "'''phx:love2love'''"
#: For PHx to know about the custom modifier all snippets created for PHx should be prefixed with "'''phx:'''" the string (containing NO spaces) after the prefix will be the actual modifier name. In this case our modifier will be triggered by adding :love to the placeholder like [+myplaceholder:love2+].
# Now we are going to enter the modifier code into the snippet code field. For this example we create it like this:
Строка 388:
<?php
$defaultValue = " because I do love MODx";
if (strlen($options)>0) {
$newvalue = $output . $options;
} else {