Snippet · Mecha CMS

Code snippet collection for developers.

Search Form

Author: Taufik Nurrohman · 458 Views

Tweet

Basic search form.

<form action="<?php echo $site->is === 'page' ? Path::D($url->current) : $url->current; ?>" method="get">
  <?php echo Form::text($config->q, Request::get($config->q)) . ' ' . Form::submit(null, null, 'Search'); ?>
</form>

The search functionality is a native feature of the page extension. By appending a ?q=foo+bar query string to the end of a URL, it will automatically search for pages that contains foo and bar in the file name. This feature does not have ability to search for text within the page file content due to the performance problem on every file-based CMS. This search functionality will also search only for files that are placed within the current directory. So, there is no such thing called recursive search.

0 Comments

No comments yet.