Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search page error #3

Closed
kodersha opened this issue Oct 16, 2018 · 0 comments
Closed

Search page error #3

kodersha opened this issue Oct 16, 2018 · 0 comments

Comments

@kodersha
Copy link

Hello.
I have this error on my search page.

kirby cms debugger

templates/search.php:

<?php snippet('header') ?>
    <form>
        <input type="search" name="q" value="<?= esc($query) ?>">
        <input type="submit" value="Search">
    </form>
    <ul>
        <?php foreach($results as $result): ?>
            <li>
                <a href="<?= $result->url() ?>">
                    <?= $result->title()->html() ?>
                </a>
            </li>
        <?php endforeach ?>
    </ul>
<?php snippet('footer') ?>

controllers/search.php:

<?php
return function($site, $pages, $page) {
    $query   = get('q');
    $results = page('blog')
               ->index()
               ->visible()
               ->fuzzySearch($query, 'title|text');
    $results = $results->paginate(20);
    return array(
        'query'      => $query,
        'results'    => $results,
        'pagination' => $results->pagination()
    );
};

How can I fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants