Forums › Forums › Search & Filter Pro › conditional search results
- This topic has 6 replies, 2 voices, and was last updated 8 years, 7 months ago by
Anonymous.
-
Trevor(Private) April 4, 2017 at 5:19 pm #101424
Yes. But the code may be complex. As long as you have access to the php page template for the results page, you can use the sf_query array to find the value and use that to conditionally show what you want by echoing HTML to the page.
This thread discusses the technique for accessing the data:
Anonymous(Private) April 5, 2017 at 12:22 pm #101540Hi Trevor, thanks for your reply, I am a little confused though – I’m finding hard to decypher the code from your link and apply it to my case…
website.co.uk/?sfid=132396&_sfm_department=14
Would be my search string, this searches a particular ‘department’, I would like to show div based on this department.
so my code would be somthing like:
if url = ?sfid=132396&_sfm_department=14
echo : “<div>welcome to department 14</div>”
I have found a way to do this with jQuery, the only issue I have with this method though is it looks for a particular url so if I wanted to show for: ?sfid=132396&_sfm_department=1 dpartment 1’s div, it would also show for ?sfid=132396&_sfm_department=11, ?sfid=132396&_sfm_department=12 etc etc as it contains ?sfid=132396&_sfm_department=1
Anonymous(Private) April 5, 2017 at 12:42 pm #101545Hi, I found a better code for triggering the jquery to kick in on the url so its working for 1, 11, 12 differently which is great.
My only issue now is that I can’t execute php code within the jQuery which is why I wanted to do it on the search results page rather than through javascript. What I actually want to hide/show is featured posts dependant on the department searched for. It would be great if I can do this on the search reults template instead of achieving it through jQuery.
: )
Dann
-
AuthorPosts