In the old field & in the new Tag Tab?
I asked this question in the Solspace Forum: http://www.solspace.com/forums/viewthread/396/
But I don’t see any solution.
What should I do to replace this old code:
{if my_old_custom_field_for_tags}
Keywords: ...Tag module code here...
{/if}
Once you go through the harvesting exercise, the custom field isn’t needed anymore. I have deleted it without obvious ill effects.
Harvesting has no relation to this problem.
Because “Keywords:” is outside the Tag Module v.2 code.
If I delete IF AND I have no tags in the custom field in an entry, the entry will show:
Keywords:
(with no tags)
I wrote about that in the Solspace forum: http://www.solspace.com/forums/viewreply/1560/
My bad.
I can’t find a functional equivalent in the docs for 2.0, but then I’m a notoriously poor reader of manuals.
Creative use of the query module will do the trick – create a query to count the number of tags for the given entry_id and use the result for the conditional.
It should also be possible to write an extension that provides a variable like tag_count.
Thanks a lot!
Now I see that is not my personal problem, that is an issue connected with Version 2.
So, any solution in such a situation is temporary only.
I agree with:
I guess we will have to wait until the Solspace people come up with a {no_tags} variable or something similar.
So, I choose to enter tags twice now than to reprogram the system (now and after developing the new parameter).
Here’s a workaround using the query module:
{exp:query sql="SELECT COUNT(entry_id) AS tag_count FROM exp_tag_entries WHERE entry_id = '{entry_id}' "}
{if tag_count}
Tags: (do whatever)
{/if}
{/exp:query}
I’ll see if this can be done as an extension so that no changes to the template are required – other than perhaps renaming the variable used in the conditional.
Another very interesting solution:
{exp:tag:tags entry_id="{entry_id}" type="weblog" limit="1"}Keywords: {/exp:tag:tags}
Here’s a simple plugin that seems to do the trick for me.
{if {exp:tagcount entry_id="{entry_id}"}}
Tags: (whatever)
{/if}
Clumsy code, but you get what you pay for. I’m sure the Solspace folks can find a better solution.
Does anybody know how to avoid the need of passing in entry_id as a parameter?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.