Forum

Thread tagged as: Question, Add-on-development

JQuery in runtime.php

Hi all, working on developing an app to interpret and show XML posts.
So far, it's working as expected. However, I'm just bringing in a search functionality. The issue is that when using the search functionality to search the DB and retrieve results, the get_recent_listings functionality still displays recent listings (I guess that should have been expected).

Is it going to cause problems if I include some JQuery in <script> tags within the search function in runtime.php to hide the recent listings when the function is run?

Thanks, Harry

Harry Ray

Harry Ray 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What's get_recent_listings ? I don't think that's part of Perch.

It's not, it's a function in this app that works much like the perch_blog_recent_posts function in the Perch Blog - should possibly have mentioned that.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ah right, I see what you're saying.

That doesn't sound like a good solution. Your code is doing the work to generate the results, outputting them and then doing more work to hide them from the browser. That's no good.

You're better to control it from the page. Only call perch_recent_listings if there's not a search being performed.