Search query question

tubeman
Posts: 534
Joined: Sat Mar 02, 2013 11:33 am

Re: Search query question

Post by tubeman »

Get a page with no results, instead of showing no results can we show some random galleries on page?
admin
Site Admin
Posts: 37202
Joined: Wed Sep 10, 2008 11:43 am

Re: Search query question

Post by admin »

if ('<!--TOTAL_ITEMS-->' == 0) {

JS redirect to /?force_template=random_galleries

}


ща course you need to create random_galleries template
Don't forget to run script update
tubeman
Posts: 534
Joined: Sat Mar 02, 2013 11:33 am

Re: Search query question

Post by tubeman »

How do I do a Js redirect?
admin
Site Admin
Posts: 37202
Joined: Wed Sep 10, 2008 11:43 am

Re: Search query question

Post by admin »

there are a couple of ways to do it

https://lmgtfy.com/?q=How+do+I+do+a+Js+redirect%3F
Don't forget to run script update
tubeman
Posts: 534
Joined: Sat Mar 02, 2013 11:33 am

Re: Search query question

Post by tubeman »

If a search query returns only for example 5-6 galleries, is there anyway to just add random galleries on the same page after those 5-6 galleries?
admin
Site Admin
Posts: 37202
Joined: Wed Sep 10, 2008 11:43 am

Re: Search query question

Post by admin »

yes, but it'll add a lot of load


if ('<!--TOTAL_ITEMS-->' < 5) {

<thumb ....

}
Don't forget to run script update
tubeman
Posts: 534
Joined: Sat Mar 02, 2013 11:33 am

Re: Search query question

Post by tubeman »

I was just using 5-6 as an example number here, as you know it could be 2 or maybe even 10 depending on the results of the search. Basically after we have the results (could be 0, 2 or even 20) just add X amount of random galleries on the same page. Any way to achieve this without adding too much load on the server?
admin
Site Admin
Posts: 37202
Joined: Wed Sep 10, 2008 11:43 am

Re: Search query question

Post by admin »

JS redirect, iframe include and so on

Do not add random thumbs into the same template
Don't forget to run script update
tubeman
Posts: 534
Joined: Sat Mar 02, 2013 11:33 am

Re: Search query question

Post by tubeman »

Is there anyway to achieve this in sphinx? Then issue with the js redirect method and iframe is that if a search query has a few results by redirecting to another template it won't show the relevant results if we have any.
admin
Site Admin
Posts: 37202
Joined: Wed Sep 10, 2008 11:43 am

Re: Search query question

Post by admin »

relevant? you said you needed random
Don't forget to run script update
Post Reply