<?php $query = 'FormIt'; $output = []; $snippets = $modx->getCollection('modSnippet', ['snippet:LIKE' => '%' . $query . '%']); foreach ($snippets as $snippet) { $output[] = sprintf('<p>Snippet <a href="/manager/?a=element/snippet/update&id=%s">%s</a></p>', $snippet->id, $snippet->name); } $templates = $modx->getCollection('modTemplate', ['content:LIKE' => '%' . $query . '%']); foreach ($templates as $template) { $output[] = sprintf('<p>Template <a href="/manager/?a=element/template/update&id=%s">%s</a></p>', $template->id, $template->templatename); } $chunks = $modx->getCollection('modChunk', ['snippet:LIKE' => '%' . $query . '%']); foreach ($chunks as $chunk) { $output[] = sprintf('<p>Chunk <a href="/manager/?a=element/chunk/update&id=%s">%s</a></p>', $chunk->id, $chunk->name); } $resources = $modx->getCollection('modResource', ['content:LIKE' => '%' . $query . '%']); foreach ($resources as $resource) { $output[] = sprintf('<p>Resource <a href="/manager/?a=resource/update&id=%s">%s</a></p>', $resource->id, $resource->pagetitle); } print implode(PHP_EOL, $output);
Поиск кода в шаблонах и чанках
20 июля 2021, 11:19
0 комментариев