Back to SiteSearch Support

el_profi21331
el_profi21331

Hi, when I paste the code from your doc into my Search results page, I get:

Parse error: syntax error, unexpected 'title' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

Any help appreciated.

OFFLINE
OFFLINE

What code are you referring to exactly? What version of PHP are you running?

el_profi21331
el_profi21331
title = "Search results"
url = "/search"
...

[searchResults]
resultsPerPage = 10
showProviderBadge = 1
noResultsMessage = "Your search did not return any results."
visitPageMessage = "Visit page"
==
<h2>Search results for {{ searchResults.query }}</h2>

{% component 'searchResults' %}

If I leave out the code part I can access the resultpage but with no search results.

PHP Version 7.1.0-5+deb.sury.org~xenial+1

I am running rainlab.blog and imported 200 blog posts so there should be some search results obviously. Rainlab.blog "provider" is enabled in settings. The search term is not displayed too.

Last updated

OFFLINE
OFFLINE

And you are inserting this into a normal cms page? Are you removing the ...? This looks more like a problem with your setup than a problem with the plugin, to be honest.

You can check out this demo theme with a working installation of the plugin: https://github.com/OFFLINE-GmbH/oc-snipcartshop-theme/blob/develop/pages/search.htm

el_profi21331
el_profi21331

Yes I am playing around with the cms pages. As mentioned before I get the search page with my html alright (no search results or display of the search terms though) if I omit everything above "==". It seems as if the code is rendered as php which consequently results in the error. Honestly I don't like the mix of twig with this kind of ini-settings / variable declaration in the header anyway. If errors like these occur after a few hours of testing october is not for me (sorry to say that because it really looks nice). I prefer coding with plain laravel then. Thanks for your help.

OFFLINE
OFFLINE

Have you tried adding the component via the backend and not via your text editor/IDE? This way you can make sure your syntax is correct. Also, make sure that you don't send any htm/html files to the php parser in your web server config!

1-6 of 6