Hmm, that seemed to be a problem with my .htaccess file: by adding php_flag display_errors on, to .htaccess in the root of the site, I get that error for every page. Have tried a couple of other ways to get htaccess to show PHP errors and they all have the same effect.
Any ideas? Thanks for your help and sorry if I’m missing something obvious - been staring at my screen for a long time now!
Yeah that’s just an error with your htaccess - never mind.
Could you let me know what version of PHP and MySQL you are running?
Also, have you considered that your zip decompressor might have corrupted the plugin file? Maybe you could check the plugin file with something like BBEdit’s Zap Gremlins, or just scan the code for odd looking characters…
Thanks
Mark
Yeah it was - I was using pretty standard stuff I thought, but 1&1 didn’t like it. I also just remembered that 1&1 defaults to PHP4 unless you tell it to use PHP5. Have fixed that, and your plugin now appears fine in the list! (Although now the rest of my site’s stopped working, but I think that’s something to do with PHP, not your plugin.)
Thanks for your help - sorry to miss such an obvious one!
Mark, here is a worthwhile addition to allow for querying against multiple weblogs:
// limit to a weblog?
if ($weblog !== '*')
{
// Added by Brian Litzinger
if(substr($delimiter, $weblog))
{
$weblogs = explode($delimiter, $weblog);
$sql_conditions .= "AND (";
foreach($weblogs as $wb)
{
$sql_conditions .= "wl.blog_name = '{$DB->escape_str($wb)}' OR ";
}
$sql_conditions = substr($sql_conditions, 0, -4);
$sql_conditions .= ")";
}
else
{
$sql_conditions .= "AND wl.blog_name = '{$DB->escape_str($weblog)}'";
}
}I’ve been trying to use this with the {if no_results}{/if} tag, but can’t seem to get it to work - I’ve tried putting the no_results tag in the search_fields tags, and in the weblog tags, but neither seems to return a result.
Is there a way to get that to work, or is it not compatible with no_results?
@SierraBravo That’s great, thank you! I’ll add it to the next version.
@Frank Harrison no_results will work, but will get overwritten if exp:search_fields is wrapped by another tag. Try using an embedded template for the tag, and inside that embed the exp:weblog tag.
Eg, {embed="inc/search_fields" search_words="my search word"}
{exp:search_fields search:title="{embed:search_words}" search:cat_name="{embed:search_words}" search:tags="{embed:search_words}" operator="OR" weblog="products" parse="inward"}
{embed="inc/product-search-results" search_results="{search_results}" categories="{embed:categories}"}
{if no_results}
Sorry, no matches were found for ‘<em>{embed:search_words}’</em>.
{/if}
{/exp:search_fields}This looks very useful. I added SierraBravo’s multiweblog code and it gets me closer to what I’m trying to accomplish but I still have an issue. I have multiple weblogs that I’m trying to pull entries from as I’ve detailed in this thread.
What I have so far is:
{exp:search_fields search:ee_body="not IS_EMPTY" search:body="not IS_EMPTY" operator="OR"
weblog="nh_ee|nh_main|nh_obits" parse="inward"}
{exp:weblog:entries entry_id="{search_results}" dynamic="off" limit="25"} <a href="http://{page_url}">{title}</a>
{/exp:weblog:entries}
{/exp:search_fields}which is close but I’m getting results even when “body” field is empty.
This is a query someone else wrote that does what I want:
{exp:query sql="select d.entry_id
from exp_weblog_data d inner join exp_weblog_titles t on d.entry_id=t.entry_id where d.weblog_id in
('10','11','12') and (ASCII(d.field_id_50) > 0 OR ASCII(d.field_id_55) > 0) And t.status='open' order by
t.entry_date desc LIMIT 0,26;" backspace="1"}{entry_id}|{/exp:query}but I was hoping to simplify it using a plugin. Is this beyond what you intended for this?
Hey Mark
This is a great plugin and is currently working well for me. However, I’m just wondering whether you can advise me as to how I might do the following:
I’d like to pull out entries that ‘contain’ what’s in my search:title parameter, limit them to 500 and if there are less than 500 results, output whatever’s left (up to the 500 limit) with search:title=”title4”. Is that possible?
My current code which works great is:
{exp:search_fields search:title="title1|title2|title3" weblog="my_weblog" parse="inward"}
{exp:weblog:entries entry_id="{search_results}" weblog="my_weblog" dynamic="off" limit="500"}
Output here
{/exp:weblog:entries}
{/exp:search_fields}Many thanks,
Jim
Hi Jim
I think you could go about this two ways.
You could search for all 4 titles, set a limit of 500, and use a conditional within the exp:weblog:entries loop to attach a css class to rows where the entry title matches ‘title 4’; then use jquery (or your library of choice) to select these rows, remove them from their positions within the list, and bolt back on to the end of the list.
If you didn’t want to rely on client side javascript, I think your best approach (and the one I would take) would be to write a small plugin to do the same thing in PHP. This is how you could do it:
Hope that makes sense 😊
Hi Bluebloc
think of it as a way to filter entries in very specific ways using the exp:weblog:entries tag, rather than as a replacement or enhancement of the search module. Take a look at my site here: http://dev.lefroybrooks.com/, notably the product section.
All of the ‘searching’, form filtering, tagging, the live search etc make use of the plugin in one way or another.
Hi Mark,
Thanks for posting that link. The question I had was really to do with passing the search_words input to the search results template. On your site you are using the following code:
<form id="livesearch" action="/products/search/" method="post">
<label for="livesearch_words" accesskey="2">
<input id="livesearch_words" name="search_words" type="text" value="" title="Product search..." />
<button type="submit">Go</button>
</label>
</form>I assume that the input named “search_words” is passed to your products/search results template. Are the results generated using code similar to the below?
{exp:search_fields search:title="{embed:search_words}" search:cat_name="{embed:search_words}" search:tags="{embed:search_words}" operator="OR" weblog="products" parse="inward"}
{exp:weblog:entries entry_id="{search_results}" dynamic="off"}
<a href="http://{page_url}">{title}</a>
{/exp:weblog:entries}
{/exp:search_fields}Or do I need to post the “search_words” in another way?
Thanks again.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.