Nor am I 🙁 I have done some, but not a lot. My guess, for you, you would need something more like:
global $searchandfilter;
$sf_current_query = $searchandfilter->get(1726)->current_query();
if (!$sf_current_query->is_filtered()) {
// put your javascript here
}
I’m not a developer with JavaScript, but I’ll try.
I have to test with.:
global $searchandfilter;
$sf_current_query = $searchandfilter->get(1726)->current_query();
if ($sf_current_query->is_filtered()) {
// do the loop
} else {
// initialize data with javascript
}
where do I insert the javascript?
for exemple to set a date with the today’s date (_sfm_my_date)
Thanks
The if statement in this thread doesn’t quite work. It partly works insofar as there are no results on initial page load, and if I choose a category or tag then results appear. So far so good. But if I just search for word there are no results at all.
If I remove the if statement then I do get results.
Is if ($sf_current_query->is_filtered()) supposed to trigger if a word has been searched for?
In PHP you need to take the string and modify it. The first thing is to remove the Location: string. So, you use the PHP Search function to find the :, like this:
<?php
//Get a multiple fields values by passing an array of field names
//replace 1526 with the ID of your search form
global $searchandfilter;
$sf_current_query = $searchandfilter->get(15)->current_query();
print_r($sf_current_query);
?>
<?php
//Get a multiple fields values by passing an array of field names
//replace 1526 with the ID of your search form
global $searchandfilter;
$sf_current_query = $searchandfilter->get(15)->current_query();
print_r($sf_current_query->get_fields_html(array(), array('show_all_if_empty' => false)));
?>
Author
Search Results
Viewing 10 results - 321 through 330 (of 374 total)
This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
We also use cookies to store items in your cart as well as allowing your to login on the site.
You can adjust all of your cookie settings by navigating the tabs on the left hand side.
By continuing to use this site, you also agree to our Privacy Policy.
Strictly Necessary Cookies
Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.
*Other cookies used for logging in and cart functions will only be used when you use those features and cannot be disabled.
If you disable these cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.
3rd Party Cookies
This website uses Google Analytics to collect anonymous information such as the number of visitors to the site, and the most popular pages.
Keeping this cookie enabled helps us to improve our website.
Please enable Strictly Necessary Cookies first so that we can save your preferences!