Pagesetter : order search results by...  Bottom

  • Hi everyone !

    I would to sort search results by differents ways.

    Today, when I do a research in Pagesetter publications, publications are order by pubtype:asc and title:asc but I would like to choose how order my results.
    For exemple I would like that first pubtype is TID 4, the second : TID 5, third : TID 26 etc...
    and in the same time, I would like that PID from TID 4 are order by title and PID from other TID, ordered by publishDate:desc

    I seek during a long time in template pagesetter_search_results.html how to do that but without result :(

    Did anybody has ever tryed to do that or know how I can do it ?

    Thanks a lot for your help !!!





    edited by: Starguezer, Aug 07, 2007 - 05:50 PM
  • You can make your own search templates if you want to, I did something similar a long time ago
    http://www.pagesetter.net/index.php?module=Pagesetter&func=viewpub&tid=4&pid=63
    to find the initial set-up

    on www.filmfreak.be you can see more of that, on top [let's take the Dutch version] type in the search box e.g. 'Harry Potter', then a list will come up

    TID1 = Biosreviews
    TID8 = DVD Review
    TID18 = Downloads

    Otherwist I guess you'll have to hack pnsearch...

    - Igor
  • You may also modify pnuserapi.php file.
    Find:
    ORDER BY $titleColumn";

    and change to:
    ORDER BY pg_publishDate DESC";

    if you want to display titles descending by publish date.
  • Thanks Videokid !

    I will try your solution soon, when I will have more time.
    But if I understand well, I have to had same field's name in every TID if I whant to search in all TID no ?
    Because I would like use the same search box to serach into news, products, Films details... but I haven't got the same field's name for every TID icon_confused

    Arthun : tanks for your answer but the problem is that I whant to order by publish date for some TID but by title for other...
  • Actually no, but it surely makes it easier... otherwise more pnvarcleanfrominput [or assign them to a string] will be in order.
    Experience learned me not to make things more complicated as it is... If you have a field 'Text' for an actor, or for a movie, just use that for every TID, you only have to search in 'Text' for every TID.

    You do have a lovely site!

    - Igor
  • Ok, thanks for your help.

    I've seen your site and I really like your search box. Is it possible that you send me it by mail with your template ?
  • I've found the solution ! icon_cool

    It is not very nice but it works !

    To display TID in good order, rename it like that :
    "1 - Fiche de séries"
    "2 - News"
    "3 - Chroniques"
    "others"
    because results are ordered by TID title.

    After, in pagesetter_search_results.htm (I don't remember the name file, I'm at work and I can't verify), do an "if else" to rename TID.

    Something like that :

    Code

    <!-- [if results[tid] == 4]-- >
    My TID Title
    <!-- [elseif results[tid] == 5]-- >
    My Other TID Title
    <!-- [else] == 4]-- >
    <!-- [results[title]]-- >
    <!-- [/if]-- >


    Code is not really that but the idea is here ;)

    And after to order results by title:desc for tid 4 and by publishDate for others TID, do an other "if else" in pnuserapi.php file (at the bottom AFIR) where the is SQL request.

    Code

    if (tid == 4)
    {
    do SQL request and order results by
    title:asc
    }
    else
    {
    do SQL request and order results by publishDate:desc
    }


    And that's ok !

    If somebody whant more explication, don't hesitate to send me a PM ;)


    But know I've got one more question :
    How can I display online 5 first results of each TID and a link : "display all results of this TID" at the end of each TID group ?

    for exemple, search result :

    Quote


    TID 4
    - 1 result of tid 4
    - 2 result of tid 4
    - 3 result of tid 4
    - 4 result of tid 4
    - 5 result of tid 4
    link : see other results of TID 4

    TID 5
    - 1 result of tid 5
    - 2 result of tid 5
    - 3 result of tid 5
    - 4 result of tid 5
    - 5 result of tid 5
    link : see other results of TID 5

    TID 6
    - 1 result of tid 6
    - 2 result of tid 6
    - 3 result of tid 6


    And the link return to a page with all result of the TID.

    I'm not sure to be clear... icon_confused

This list is based on users active over the last 60 minutes.