Jump to:

23487 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Search not working

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

Page: 1 2 3 4
Go to End
Author Topic: 3571 Views
  • wilsonStaff
    Avatar
    Community Member
    142 Posts

    Re: Search not working Link to this post

    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!

  • wilsonStaff
    Avatar
    Community Member
    142 Posts

    Re: Search not working Link to this post

    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!

  • martimiz
    Avatar
    Forum Moderator
    1086 Posts

    Re: Search not working Link to this post

    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.

  • wilsonStaff
    Avatar
    Community Member
    142 Posts

    Re: Search not working Link to this post

    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.

  • martimiz
    Avatar
    Forum Moderator
    1086 Posts

    Re: Search not working Link to this post

    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)...

  • wilsonStaff
    Avatar
    Community Member
    142 Posts

    Re: Search not working Link to this post

    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!

  • martimiz
    Avatar
    Forum Moderator
    1086 Posts

    Re: Search not working Link to this post

    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...

  • wilsonStaff
    Avatar
    Community Member
    142 Posts

    Re: Search not working Link to this post

    $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!

    3571 Views
Page: 1 2 3 4
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.