Thanks for this awesome extension, Mark. It eliminates the need to use the query tag in most of my uses.
However, I get an SQL error when I try the SQL insert method. Attempting this on a “survey” weblog, I’m trying this.
{exp:weblog:entries weblog="{my_weblog}" surveyverified="yes" AND sql1="(" survey_city1="Edmonton" sql2=" OR " survey_city2="Calgary" sql3=")" orderby="survey_ward" sort="asc" status="Published" category="9" disable="trackbacks|pagination|member_data"}
It works perfectly fine if I get rid of the SQL inserts and split up this into two exp:weblog:entries calls, eg. one for Edmonton and one for Calgary. But, what I would like to do is get every survey entry except the ones for Edmonton and Calgary. So ultimately I want to say survey_city=”!=Edmonton” and “!=Calgary”.
Any idea what I might be doing wrong? The parentheses seem logically placed to me. Thanks again, Mark…
Oxygen,
Try this:
{exp:weblog:entries weblog="{my_weblog}" surveyverified="yes" AND sql1="(" survey_city__1="Edmonton" sql2=" OR " survey_city__2="Calgary" sql3=")" orderby="survey_ward" sort="asc" status="Published" category="9" disable="trackbacks|pagination|member_data"}
I’m still trying to figure out the best way to do multiple instances of the same field, but the latest version of the extension calls for two underscores then a digit.
Hi again Mark, would you mind having a quick peak at my question on page 8 ot this thread please. I’m desperate for a solution! Many thanks
Could you suggest a work around in the meantime? This is my particular issue
Thanks Mark
Hmm, I can’t see to get this to hook in. Running EE 20070627 + v218 of the plugin, I’ve tried to enable/re-enable, and I’ve added the hooks into mod.weblog.php.
My test case is a very simple:
{exp:weblog:entries weblog="sermons" limit="5" sermon_speaker="xxx"}
But the “xxx” is ignored, all rows are returned, and the SQL trace doesn’t show it being added in as a condition.
This is probably something stupid, but are there are any other debug steps I can take?
@Mikee Bee - For this I usually just place a conditional within my category listing. Of course you’re still pulling in all the categories, and for large category groups this isn’t ideal, but I usually work with groups of 30 or less. Something like this:
{exp:weblog:categories…} {if custom-field=='value'}{category_name}{/if} {/exp:weblog:categories}
@Sam123 - If you’re comfortable with PHP then you could go into the extension and place a var_dump('test');
at the top of the modify_sql()
method. Then if you see test you know the extension is running. A few things to check: (1) are you sure sermon_speaker is the exact name of the custom field? (2) Have you tries any other fields? (3) Can you turn on template debugging, is the correct weblog:entries tag shown within the template debugger? (4) Can you turn on SQL debugging, does INNER JOIN appear anywhere within the SQL debugging?
Here is a full explanation of what I’m trying to do
http://ellislab.com/forums/viewthread/56558/
Does that clarify things?
So, if I understand correctly you’re trying to get all categories with entries that have custom-field-xx set to ‘yes’. Is that correct? If so then this is way out of the scope of this extension. I did offer a query though over here: http://expressionengine.com/…
I’m still trying to figure out the best way to do multiple instances of the same field, but the latest version of the extension calls for two underscores then a digit.
{exp:weblog:entries weblog="{my_weblog}" surveyverified="yes" AND sql1="(" survey_city__1="Edmonton" sql2=" OR " survey_city__2="Calgary" sql3=")" orderby="survey_ward" sort="asc" status="Published" category="9" disable="trackbacks|pagination|member_data"}
The above worked and the above also worked when I used negatives (“neither Edmonton nor Calgary”). Awesome. Perfect. Thanks Mark!
Thanks Mark, template debugging helped. I can see the modify_sql method being called.
There’s no INNER JOIN present in the SQL, and I’ve tried using a number of different custom fields.
Debugging the PHP I’ve noticed that when I check the contents of this array (lines 159-166)
$SESS->cache['mh_cfields']
It contains about 25 numbers which look like ID’s.
Therefore this test is failing:
if(isset($SESS->cache['mh_cfields'][$key]))
Because $key is the name of the tag parameter (ie. ‘sermon_speaker’). This seems to be the problem.
Any ideas?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.