Download the PHP package offline/oc-site-search-plugin without Composer

On this page you can find all versions of the php package offline/oc-site-search-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package oc-site-search-plugin

SiteSearch Plugin for OctoberCMS

This plugin adds global search capabilities to OctoberCMS.

Available languages

You can translate all contents into your own language.

Currently supported content types

Multilingual contents via RainLab.Translate are supported.

Support for more plugins is added upon request.

You can easily extend this plugin to search your custom plugin's contents as well. See the documentation for further information.

Get native support for your plugin

If you are a plugin developer and wish to have native support for your contents in SiteSearch please submit a pull request for your search provider or send us a copy of you plugin so we can create the provider for you.

We cannot add support for every plugin but will add any plugin that has a notable project count on the October Marketplace.

Components

searchResults

Place this component on your page to display search results.

Usage example

Create a search form that sends a query to your search page:

Search form

Important: Use the q parameter to send the user's query.

Alternatively you can also use the searchInput component described below to generate this form for you.

Search results

Create a page to display your search results. Add the searchResults component to it. Use the searchResults.query parameter to display the user's search query.

Example css to style the component

Modify the query before searching

If you want to modify the user's search query before the search is executed you can call the forceQuery method on the searchResults component from your page's onStart method.

Change the results collection before displaying

You can listen for the offline.sitesearch.results event and modify the query as you wish.

This is useful to remove certain results or change the sort order.

Properties

The following properties are available to change the component's behaviour.

resultsPerPage

How many results to display on one page.

showProviderBadge

The search works by querying multiple providers (Pages, Blog, or other). If this option is enabled each search result is marked with a badge to show which provider returned the result.

This is useful if your site has many different entities (ex. teams, employees, pages, blog entries).

noResultsMessage

This message is shown if there are no results returned.

visitPageMessage

A link is placed below each search result. Use this property to change that link's text.

searchInput

Place this component anywhere you want to display a simple search input with "search as you type" capabilities.

Usage example

Add the searchInput component to any layout, partial or page.

Example css to style the component

Properties

The following properties are available to change the component's behaviour.

useAutoComplete

If this property is enabled, a search query will be executed as soon as the user begins to type.

autoCompleteResultCount

This many results will be displayed to the user below the input field. There will be a "Show all results" link the user can click that takes her to a full search results page if one has been specified via the searchPage property.

showProviderBadge

The search works by querying multiple providers (Pages, Blog, or other). If this option is enabled each search result is marked with a badge to show which provider returned the result.

This is useful if your site has many different entities (ex. teams, employees, pages, blog entries).

searchPage

The filename of the page where you have placed a searchResults component. If a user clicks on the "Show all results" link it will take him to this page where a full search is run using the searchResults component.

Add support for custom plugin contents

Simple method

To return search results for you own custom plugin, register an event listener for the offline.sitesearch.query event in your plugin's boot method.

Return an array containing a provider string and results array. Each result must provide at least a title key.

Example to search for custom documents

That's it!

Advanced method

If you need a bit more flexibility you can also create your own ResultsProvider class. Simply extend SiteSearch's ResultProvider and implement the needed methods. Have a look at the existing providers shipped by this plugin to get an idea of all the possibilities.

When your own ResultsProvider class is ready, register an event listener for the offline.sitesearch.extend event in your plugin's boot method. There you can return one ResultsProvider (or multiple in an array) which will be included every time a user runs a search on your website.

Advanced example to search for custom documents

Settings

You can manage all of this plugin's settings in the October CMS backend.

Rainlab.Pages

No special configuration is required.

Rainlab.Blog

Make sure you select your CMS page with the blogPost component as the blog post page in the backend settings.

You can access a post's published_at date in your search results via {{ result.meta }}.

Feegleweb.Octoshop

Make sure you set the Url of product detail page setting to point to the right url. Only specify the fixed part of the URL: /product. If your products are located under /product/:slug the default value is okay.

Jiri.JKShop

Make sure you set the Url of product detail page setting to point to the right url. Only specify the fixed part of the URL: /product. If your products are located under /product/:slug the default value is okay.

You can access an article's price in your search results via {{ result.meta }}.

Indikator.News

Make sure you set the News post page setting to point to the right url. Only specify the fixed part of the URL: /news/post. If your products are located under /news/post/:slug the default value is okay.

RadiantWeb.ProBlog

Make sure you set the Url of blog post page setting to point to the right url. Only specify the fixed part of the URL: /blog. If your posts are located under /blog/:category/:slug the default value is okay.

ArrizalAmin.Portfolio

Make sure you set the Url of portfolio detail page setting to point to the right url. Only specify the fixed part of the URL: /portfolio/project. If your detail page is located under /portfolio/project/:slug the default value is okay.

VojtaSvoboda.Brands

Make sure you set the Url of brand detail page setting to point to the right URL. Only specify the fixed part of the URL: /brand. If your brand detail page is located under /brand/:slug then insert only /brand without the slug parameter.

CMS pages (experimental)

If you want to provide search results for CMS pages change the enabled setting to On.

You have to specifically add the component siteSearchInclude to every CMS page you want to be searched. Pages without this component will not be searched.

This feature works best with simple pages that include components, but don't rely on url parametres or other variables (like a page number). CMS pages with dynamic URLs (like /page/:slug) won't be linked correctly from the search results listing.

If you have CMS pages with more complex dynamic contents consider writing your own search provider (see Add support for custom plugin contents)

Tailor

SiteSearch has first-party support to search in your Tailor content. You have to add a new siteSearch section to each blueprint you want to be searched.

All configuration values are optional, but it makes sense to set at least one searchFields value so the plugin has something to search through.

Custom URL Resolver

Instead of specifying pageName and urlParams settings, you can set a custom URL resolver. This is useful if you want to have full control over generating the target URL of your search results.

You can provide any callable as a string, like a static method on your app's Provider class, for example.

The callable will receive the following arguments:

Example implementation

Overwrite default markup

To overwrite the default markup copy all files from plugins/offline/sitesearch/components/searchresults to themes/your-theme/partials/searchResults and modify them as needed.

If you gave an alias to the searchResults component make sure to put the markup in the appropriate partials directory themes/your-theme/partials/your-given-alias.


All versions of oc-site-search-plugin with dependencies

PHP Build Version
Package Version
Requires composer/installers Version ~1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package offline/oc-site-search-plugin contains the following files

Loading the files please wait ....