Наверх

Поиск кода в шаблонах и чанках

<?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);


0 комментариев

    Авторизация

    через сервис Loginza:


    Шаблоны MODX

    1 2 Дальше »

    Объектная
    модель
    MODX