We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Should I enter tags twice in Tag v.2.0 ?

Development and Programming

sigork's avatar
sigork
155 posts
17 years ago
sigork's avatar sigork

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}
       
elwed's avatar
elwed
151 posts
17 years ago
elwed's avatar elwed

Once you go through the harvesting exercise, the custom field isn’t needed anymore. I have deleted it without obvious ill effects.

       
sigork's avatar
sigork
155 posts
17 years ago
sigork's avatar sigork
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/

       
sigork's avatar
sigork
155 posts
17 years ago
sigork's avatar sigork

Maybe I need to use PHP to solve this problem and to use the Tag Tab only?

       
elwed's avatar
elwed
151 posts
17 years ago
elwed's avatar elwed

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.

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
17 years ago
Lisa Wess's avatar Lisa Wess

See this post on the solspace forums.

       
sigork's avatar
sigork
155 posts
17 years ago
sigork's avatar sigork

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).

       
elwed's avatar
elwed
151 posts
17 years ago
elwed's avatar elwed

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.

       
sigork's avatar
sigork
155 posts
17 years ago
sigork's avatar sigork

Another very interesting solution:

{exp:tag:tags entry_id="{entry_id}" type="weblog" limit="1"}Keywords: {/exp:tag:tags}

http://www.solspace.com/forums/viewthread/396/#1595

       
elwed's avatar
elwed
151 posts
17 years ago
elwed's avatar elwed

That’s a good one, but I hope these kinds of workarounds aren’t needed as of Tag 2.0.10 😉

       
elwed's avatar
elwed
151 posts
17 years ago
elwed's avatar elwed

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?

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.