Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

How does 'search' function work?

Go to End

15 Posts   1259 Views


15 March 2013 at 10:53am Community Member, 10 Posts

Our website manager left the company and I temporarily manage the website. I add content and perform some simple functions. But today I found out that 'search' function does not work. It does not even show 0 results, just appears blank. It worked perfectly fine just couple of days ago. What could have happened? Is there a way to fix it? Please help.


16 March 2013 at 3:19am Forum Moderator, 1091 Posts

A white screen usually means the page request is generating a server error of some kind, and the first thing to do is get some output on that error. There are a couple of ways you can approach this.

You can temporarily(!) put your site in developer mode by adding the following to you mysite/_config.php


then go back to your search results and see if your white screen now reports the error. If it's still blank, here ar some links that might help:

If you have access to your server logs, that might help too. Once you find out the error, post it here.


16 March 2013 at 4:55am Community Member, 10 Posts

Thank you very much for your response Martimiz

The search function didn't work all yesterday's evening (tried a few IPs), so this morning I was determined to fix it (thanks again for your tips), but to my surprise, it worked fine again. Don't know what was that. Will keep tracking anyway...


27 March 2013 at 11:16am Community Member, 10 Posts

Grr, not working again. Second day in a row...

Can you please help to find out where Director::set_environment_type("dev") is located. Remember, I am not a web developer...just need to keep website alive for a while.


27 March 2013 at 10:26pm (Last edited: 27 March 2013 10:30pm), Forum Moderator, 1091 Posts

If you really don't know anything about webdesign, php code and such, this might be a bit tricky, and you might want, to find someone who does... Changes made to SilverStripe files can lead to serious problems if you don't know what you're doing. Especially on a production site...

Maybe contact someone who can check the server logs for you to find out if there are any (PHP) errors reported around the time your siearch failed.

But if there's no other way and if you have access to the files of the SilverStripe installation (on the server or via a console), find the file mysite/_config.php and copy the code I gave you to the bottom of that file, then save.

Remember to remove it again, once you're finished, because it leaves SilverStripe a bit more open than it should! Tell us if this works to get you some sort of error message...

[EDIT] maybe send me the url of your website...


2 April 2013 at 11:19am Community Member, 10 Posts

Thanks again Martimiz, I got full access but still couldn't find the file...I mean it should be there, but it isn't 'file' in my understanding of files, there is a black window with codes, and I don't want to mess with it.

Now it turned out that the problem is likely to be with Google Search, so I upgraded our account to Business ($100 a year), they gave me a code that I need to embed to the website. This is what instruction says: "Copy the following code, and paste it into a <div> element in your site's <body> section, where you want the search results to render".

There is one problem, there are no <div> s on our website. The best thing I could do is add the code to HTML editor, but it did not even save it. Like, nothing was added.

If I could only use this code, I would at least check if the problem is with Google Search or not. in Google CSE all results are shown correctly, so it is likely that the problem is with adding the code to the website. Can anyone help me with this?

Also, how can I send private messages on this forum?


2 April 2013 at 10:34pm Forum Moderator, 1091 Posts

That black window with code could very well be the file you want, but I can understand you not wanting to mess with that. Unfortunately adding some code 'to the HTML' as your provider suggests won't be any easier :(

So first: sending private messages isn't an option on this forum, but you can click link in the post of the person you want to approach, to view their account. They may have entered a public e-mail address that you can use.

For now, if your site still has that problem, why don't you post a link to it, on the slight chance that we can find out something more. But I'm afraid you might need someone that knows a bit more about SilverStripe to help you. Is the person that left the company no longer available for some advice?


3 April 2013 at 5:54am Community Member, 10 Posts

Thanks Martimiz

That's the problem. The person who was in charge said that it is do with Google Site Search (not with SilverStripe) and I need to upgrade the account. So I did. It did not help. He then told me to copy the code to HTML window. Did not help either. Google wants me to add the code specifically under <div> and we don't have it. This is the website

Thanks again!

Go to Top