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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Search not working


Go to End


28 Posts   8098 Views

Avatar
bettsaj

Community Member, 46 Posts

16 August 2011 at 7:22pm

Hi,

For some reason the search function isn't working... Is there a module I've got to install or is there a function I need to enable in SS?

URL to the site is..

www.christinafrench.com

Kind regards,

Andy

Avatar
Invader_Zim

Community Member, 141 Posts

16 August 2011 at 11:05pm

Edited: 16/08/2011 11:18pm

Hi,

check if you have this line in your /mysite/_config.php:
FulltextSearchable::enable();

and if you have this in your template where the search form should appear:
$SearchForm

Cheers

Edit: Don't forget to rebuild the database by visiting http://yoursite.com/dev/build after adding Fulltext... to your _config.php
Edit2: This link might also help: http://doc.silverstripe.org/sapphire/en/tutorials/4-site-search

Avatar
bettsaj

Community Member, 46 Posts

17 August 2011 at 3:43am

Still not working.... I've added FulltextSearchable::enable(); where you said it should be.. I've also checked the template page.ss which now looks like this

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

		<% base_tag %>
		$MetaTags
		<link rel="shortcut icon" href="/favicon.ico" />

</head>
<body>

<div id="Wrapper">
	<div id="Header">
	    $SearchForm
		<h1><span>Christina French</h1>
        <p class="tagline">Artist & Tutor</p>
        <input type="text" class="search" value="Search" />
    </div>
    <div id="Nav">
    	<% include Navigation %>
    </div>
    
    
    $Layout
    <div class="clear"></div>
    
    
    <div id="Footer">
    	<% include Footer %>
    </div>
    
</div>

</body>
</html>

Any ideas why it's still not working?.. Cache has been flushed 3 times now,

Regards,

Andy

Avatar
DesignerX.com.au

Community Member, 107 Posts

17 August 2011 at 5:36pm

Hi,
i am not sure if i can help, but try plasing the $SearchForm just under the <body> & test it, it may be conflectiong with something else above it in the code!!.. give it a try..

.... For now, i Need your help!!.. i saw your website, What gallery did you use (Gallery page).. i really need it.. Can you give me the link to that module..

Thank you

Avatar
bettsaj

Community Member, 46 Posts

19 August 2011 at 11:35pm

Thanks for your advice... I'll give it a try.

regarding the gallery you can find it here

http://www.silverstripe.org/imagegallery-module/

Avatar
DesignerX.com.au

Community Member, 107 Posts

20 August 2011 at 5:16am

thank you.. i am using the gallery now.. its the best.. but i need to get it to do the following:
if there is ONLY one album, Do not show albums list!!
can it be done..

Avatar
bettsaj

Community Member, 46 Posts

4 September 2011 at 5:40pm

Anybody have any ideas what I may be doing wrong with this search issue?

What page do I place the $SearchForm line?... I've currently placed it in:

mysite/themes/wine/templates/page.ss

It's currently the first line after the body tag

Avatar
martimiz

Forum Moderator, 1391 Posts

4 September 2011 at 9:30pm

The reason it doesn't work, is that your searchform isn't a form at all. it's just a simple textinput without any submit action:

	<div id="Header">
	    <h1><span>Christina French</span></h1>
        <p class="tagline">Artist &amp; Tutor</p>
        <input class="search" value="Search" type="text">
    </div>

so for some reason placing $SearchForm in your template seems to only return that single field. How is your searchform created? Did you create a SearchForm() method yourself, or use some custom template?

Go to Top