Skip to content

Instantly share code, notes, and snippets.

<?php
if ($modx->event->name == 'OnWebPagePrerender') {
$_url = parse_url($_SERVER['REQUEST_URI']);
if($modx->resource->isfolder && !preg_match("/\/$/", $_url['path'])) {
$id = $modx->resource->id;
$url = isset($_url['query']) ? $modx->makeUrl($id, '', $_url['query']) : $modx->makeUrl($id);
$modx->sendRedirect($url, ['responseCode' => 'HTTP/1.1 301 Moved Permanently']);
}
}
@Pathologic
Pathologic / gist:f9da96cce9de50872e505ab74a64351f
Created March 15, 2026 11:11
Evo snippets call converter to php
<!DOCTYPE html>
<html>
<head>
<title>Конвертер вызовов сниппетов MODX</title>
<style>
body { font-family: Arial, sans-serif; max-width: 800px; margin: 20px auto; padding: 0 20px; }
textarea { width: 100%; height: 200px; margin-bottom: 10px; font-family: monospace; }
.button-group { display: flex; gap: 10px; margin-bottom: 10px; }
button { padding: 10px 20px; background: #4CAF50; color: white; border: none; cursor: pointer; border-radius: 4px; }
button:hover { background: #45a049; }