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

Search not working


Reply


28 Posts   3727 Views

Avatar
wilsonStaff

Community Member, 142 Posts

14 September 2011 at 2:10am

Hi Martimiz, i dont get it, dont be surprised. The Galerie Page is acting differently, i agree, but the other pages are acting as different, mean THEY DONT SHOW results OR dont use PAGE_RESULTS.SS template, neither GalleryPage.ss or Page.ss

So i guees its not relevant to look at those pages as different entites. But i may be wrong.

Let me recap, point by point :

-> Page.ss uses Page.php

-> GaleriePage.ss uses GalleryPage.php

/******** GALLERYPAGE.PHP *********/

<?php
/**
* Defines the HomePage page type
*/

class GalleryPage extends Page {
static $db = array(
);
static $has_one = array(
);
}

class GalleryPage_Controller extends Page_Controller {

}

function results($data, $form){
$data = array(
'Results' => $form->getResults(),
'Query' => $form->getSearchQuery(),
'Title' => 'Search Results'
);
$this->Query = $form->getSearchQuery();

return $this->customise($data)->renderWith(array('Page_results', 'Page'));
}

/******* END OF GALLERYPAGE.PHP ************/

-> Both those pages should use Page_results.ss template as - - return $this - - should do.

But its not!

I left that comment <!-- THIS IS PAGES RESULTS --> into Page_results.ss template, and i DONT see that comment when i look at the source code of the HTML page produced when i click on the serch button.

This is the problem.

Thanks for your help!

Avatar
wilsonStaff

Community Member, 142 Posts

14 September 2011 at 2:13am

First of all: afaik you can definitely empty the silverstripe-cache directory, no problem, no instability, as long as it's writable, it will rebuild itself automatically.

- - -

I dont see any silverstripe-cache directory of any kind. I remember i used to create one to have the credentials correct, but i didnt install SS on the server i am working on, the owner did. I took it from there.

Thanks!

Avatar
martimiz

Forum Moderator, 1105 Posts

14 September 2011 at 2:37am

Point is: the result() function does render your page (because the page is rendered differently after submit) - so it just doesn't want to use your Page_results.ss template...

I would make sure that's not a caching issue. If you can, create the silverstripe-cache directory in your site root, and make it writable. SilverStripe will automatically use it and refresh the cache.

Avatar
wilsonStaff

Community Member, 142 Posts

14 September 2011 at 3:00am

Edited: 14/09/2011 3:01am

You wrote: Point is: the result() function does render your page (because the page is rendered differently after submit)

Not exactly!
Pages using Page.ss (all of site's but one) are rendered the same way before/after the SEARCH click.
Pages using Gallery.ss (only one page on the site) is rendered differently. Maybe because the jQuery stuff.

- - -

You wrote: I would make sure that's not a caching issue. If you can, create the silverstripe-cache directory in your site root, and make it writable. SilverStripe will automatically use it and refresh the cache.

Did that:
- created a silverstripe-cache folder
- did a ?flush=1 on pages created with Page.ss and Gallery.ss
- i can see that the silverstripe-cache folder is now populated with a bunch of templates/cache/manifest stuff

Still nothing...... same results i.e no results!!!!!

This is getting very... lets say, irritant.

Avatar
martimiz

Forum Moderator, 1105 Posts

14 September 2011 at 5:22am

You might be wrong there... One more: try moving Page_results.ss from the /templates/Layout/ directory into the /templates/ directory. Then do (again)

http://intranet.college-st-paul.qc.ca/fr/home/SearchForm?Search=soccer&action_results=Go&flush=1

See if this gives you the results (even unstyled)...

Avatar
wilsonStaff

Community Member, 142 Posts

14 September 2011 at 6:46am

I am at work as we speak. Be home tonight.

Will try that fix (i thought of that before, just didnt have the guts to try!).

- -

Could you tell me where i should look at if its not working? I am on a tight schedule, and you prolly wont be online when i try.

Martimiz, many thanks!

Avatar
martimiz

Forum Moderator, 1105 Posts

14 September 2011 at 8:48am

Try the option I gave you. If that gives you some results-like output, it might be that your .../templates/Page.ss doesn't use the Layout directory at all (look for the existence of $Layout in those templates).

If that's the problem, the fastest way to repair it will be to take the contents of the Page.ss, copy the contents of your Page_results.ss into them on the right location, then save that combination as .../templates/Page_results.ss, and again do the

http://intranet.college-st-paul.qc.ca/fr/home/SearchForm?Search=soccer&action_results=Go&flush=1

If this is not the solution, I'm afraid have no more ideas for the moment, at least not from where I am...

Avatar
wilsonStaff

Community Member, 142 Posts

14 September 2011 at 9:15am

$Layout

I dont remember putting any $Layout into the template (and i understand it should be there as its the way to call Layout templates) and i dont remember seeing that i should do so into the Silverstripe Search tutorials ive followed.

It may be there also and i couldbe wrong. Or not there and one has to think/know about it.

- - -

Now, where to put $Layout ?

In which template: Page.ss or Layout/Page_results.ss?

Once in the right template, where? In the #div i want the results to to appear?

If i have two .ss templates (Page.ss and Gallery.ss), i should place it into both templates? (Id think so).

Again, thanks!