Page 2 of 3

Re: Search query question

Posted: Sat Jan 11, 2020 1:30 pm
by tubeman
Get a page with no results, instead of showing no results can we show some random galleries on page?

Re: Search query question

Posted: Sat Jan 11, 2020 1:36 pm
by admin
if ('<!--TOTAL_ITEMS-->' == 0) {

JS redirect to /?force_template=random_galleries

}


ща course you need to create random_galleries template

Re: Search query question

Posted: Sat Jan 11, 2020 1:38 pm
by tubeman
How do I do a Js redirect?

Re: Search query question

Posted: Sat Jan 11, 2020 1:47 pm
by admin
there are a couple of ways to do it

https://lmgtfy.com/?q=How+do+I+do+a+Js+redirect%3F

Re: Search query question

Posted: Sat Jan 11, 2020 2:12 pm
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?

Re: Search query question

Posted: Sat Jan 11, 2020 2:14 pm
by admin
yes, but it'll add a lot of load


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

<thumb ....

}

Re: Search query question

Posted: Sat Jan 11, 2020 2:31 pm
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?

Re: Search query question

Posted: Sat Jan 11, 2020 2:33 pm
by admin
JS redirect, iframe include and so on

Do not add random thumbs into the same template

Re: Search query question

Posted: Sat Jan 11, 2020 9:44 pm
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.

Re: Search query question

Posted: Sun Jan 12, 2020 5:42 am
by admin
relevant? you said you needed random