Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-06-17 03:30:24

frickinmuck
Member
Registered: 2008-05-01
Posts: 118

Using glz_custom_fields and categories to create a tagging system

Ok, I’m realizing that what I want to do is a bit more complex than what’s being done here, or else I don’t have the sophistication to take this where I need to, or maybe that tutorial is a bit too incomplete for someone who needs a bit more hand-holding like me.

I like the way the above approach essentially enables one to display articles according to a custom field, and I need that functionality, but I need to take it farther. Here’s what I’m hoping to be able to do with this:

1] Output the custom field values (otherwise known as the custom field options, otherwise known as the categories I’ve added in the category tab) as a menu (either as an “option/select” menu or just as a ul) in the sidebar of a website based on what is essentially the parent category (which is also the custom field name). The menu would enable site visitors to sort/view articles based on which menu option they select. For example, if the parent/custom field was “Animals” the menu would have the following options:

Cats
Dogs
Horses
Pigs
Cheetahs
Porcupines

2] A list of all articles that are using the selected custom field option will then display in the main area of the page when the visitor selects that option from the menu on the sidebar of the site. For example, if they clicked on “Dogs” they might get:

How to train a dog to “sit” November 12, 2011
Why I’ve never liked Rottweilers Dec 23, 2011
Canine psychology tricks Jan 4, 2012
The 5 Best Hounds for Life on a Farm Jan 23, 2011

I’m hoping to use this a sort of a tagging system, and would have several such “menus” based on different parameters I want the articles to have. For example, one menu might be “Animals”, as discussed earlier, and another menu might be “Article Type” and have the following options:

Opinion
Instructional
Lists

So, the first article listed above,

How to train a dog to “sit” November 12, 2011

Would appear if you selected “Dog” from the “Animals” menu, and it would also appear if you selected “Instructional” from the “Article Type” list.

Could anyone point me in the right direction? Maybe I’m beginning to confuse myself, but I’m having a hard time getting my head around how best to handle this.

Last edited by frickinmuck (2011-06-17 03:37:11)


The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.

Offline

#2 2011-06-17 11:33:41

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: Using glz_custom_fields and categories to create a tagging system

Uhm. Have you tried rss_unlimited_categories (also a patch)? If cat trees are stable and do not need to be updated by writers, should do what you need. Also smd_tags could be a (more complex, maybe) option. I wouldn’t start with glz_custom_field, that are useful for other purpose, in my opinion.

Offline

#3 2011-06-17 14:33:41

frickinmuck
Member
Registered: 2008-05-01
Posts: 118

Re: Using glz_custom_fields and categories to create a tagging system

There are simply too many tags for that approach to be manageable, unfortunately, but thanks for the suggestion. Since rss_unlimited_categories puts all categories into one list to select multiple categories from, and since there will be several groups of categories, each with potentially dozens of options, it would be extremely frustrating from a usability standpoint. A huge part of the issue is how things work in the back end. Since my client is going to be managing the site himself, and will be regularly adding categories, it needs to be as simple and sensible as possible to manage and organize the tags. Having each list of tags appear in the back end in its own dropdown menu of options in the write tab will be much easier for him to use.

I will definitely look into smd_tags, thanks for the suggestion.

EDIT: smd_tags is an excellent plugin – I can’t believe I’ve never seen it before as I’ve built many Textpattern sites and often dig around for plugins, especially for tagging and things like that.

Sadly it’s not going to work for this part of the project because there are going to be so many tags and groups of tags, but I will definitely be making use of this plugin in other projects. Thanks for the tip!

Just to give you an idea – this is for a media consultant’s site. He will be regularly posting about coverage he’s gotten for his clients. There will be a lot of articles, so that content will need to be sortable/filterable for the user, based on a variety of parameters:

Client (and there will be at least a couple dozen clients)
Media Outlet (there will be dozens of media outlets)
Coverage Type (Television, Print News, Blog, etc)
Issue (a list of topics that are covered)

I want the client to be able to easily add to these lists, and I want it to be super easy for him to select one option from each list to associate with an article he’s writing. In terms of the back end, glz_custom_fields with a script outputting categories to the options in the fields (how I have it set up now) is the ideal solution. All my client will have to do is add a category under the correct parent, and it will appear as an option. Couldn’t be more simple. The only problem is, when I get to the front end, I get lost. I just can’t figure out a sane way to create the menus in the front end and make that content sortable by those fields.

To be really clear: I don’t want people on the front end to be able to select multiple parameters. I want them to be able to sort articles by client OR by media outlet OR by coverage type OR by issue.

Last edited by frickinmuck (2011-06-17 15:11:57)


The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.

Offline

#4 2011-06-17 15:12:05

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: Using glz_custom_fields and categories to create a tagging system

frickinmuck wrote:

Since my client is going to be managing the site themselves, and will be regularly adding categories, it needs to be as simple and sensible as possible to manage and organize the tags.

I think that’s pretty much the classic argument for using Tags vs using Categories. I went down that route some time ago with a client who initially specified a rigid and complex system of categorising his articles. Fortunately he had provided 4 initial articles and when I asked him to categorise them, he couldn’t with 2 of them. I then explained tagging vs categorising to him and sold the notion of Tru Tags to him. He readily appreciated the simplicity of tagging his articles by adding the tag words to the TXP’s keywords field. That’s all he had to do, the Tru Tags system takes care of incorporating new tag words into the system and spewing them out into TXP navigational devices. I can’t compare Tru Tags with Stef’s smd_tags because I haven’t had an opportunity to use that plug-in, but Hey, if it’s by Stef it must be good.

Good luck with your client.

Edit Just read the edit to your last, seems like a Tag Cloud would solve the navigation needs and dispense with the need for rigid categorisation. Look at the tag cloud on the Tru Tags link above and perhaps show it to your client. Arty types like media consultants generally don’t have rigid precise mindsets that do well in a strict categorisation arena.

Last edited by joebaich (2011-06-17 15:22:38)

Offline

#5 2011-06-17 15:25:37

frickinmuck
Member
Registered: 2008-05-01
Posts: 118

Re: Using glz_custom_fields and categories to create a tagging system

The decision to go this route is not driven by my client, it’s driven by my own strategy for the site, and what will be the best way to manage the content. For me this is a content management issue. I want to handle this in the most sensible, organized and user-friendly way.

If tru_tags or smd_tags allowed me to create multiple distinct groupings of tags, so that in the back end there would be a tag select area for client, a separate tag select area for media outlet, etc. I might be able to work with that, but neither do. Both systems just lump all the tags together in one melee of tags, and with the volume of parameters here, it would be incredibly unwieldy to handle things that way. Not only that, but each article will only ever have one client, one coverage type, one issue and one media type assigned to it. With a straight-up tagging system, there is no limit to what can be added – which leaves room for confusion and mistakes.

I recognize that what I’m trying to do blurs the lines a bit between tagging and categorizing, but I know this can be done, and that it will work exactly as I need it to. I just need the tools to build that front end system.

Last edited by frickinmuck (2011-06-17 15:29:52)


The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.

Offline

#6 2011-06-17 15:45:03

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: Using glz_custom_fields and categories to create a tagging system

It’s a fascinating challenge trying to get inside a client’s mind in such a way that, downstream, he will continue to embrace all the coverage, issue and media types and navigational presentations thereof that you line up for him.

Would it hurt or hinder to run him past a Tag cloud? If he likes the notion, think of the grief and angst it could save you and perhaps him.

Good luck with it all. If it was easy they wouldn’t pay us so much.

Offline

#7 2011-06-17 16:06:46

frickinmuck
Member
Registered: 2008-05-01
Posts: 118

Re: Using glz_custom_fields and categories to create a tagging system

Like I said, this isn’t his decision, it’s mine. I’ve been working with him for years, and I know his content inside and out, and I know what he needs. Like most clients, he hasn’t got a clue what he needs. That’s why he hired me. :^)

As I already explained in some detail, a tag cloud would be totally unsuitable for this project. And ultimately I don’t want to get into a philosophical discussion on why I need what I need. Just trust me that I’ve got a grasp on what I need. I’m really just looking for help with a specific task.


The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.

Offline

#8 2011-06-17 17:26:49

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: Using glz_custom_fields and categories to create a tagging system

Oh, I see it better, now.

I did something similar to what you want in this section of this site. I’m using custom field just for the year (anno) dropdown on the right. You could do that for multiple custom field, especially if, as you said, you don’t need to couple them (that value AND that other value), but just to select one value at the time.

This thread pointed me in the right direction. Let me know if it can help you. I could post the code I’m actually using, if you need, but I think the code Aswihart posted is far better, more complex. :)

Offline

#9 2011-06-18 16:35:19

frickinmuck
Member
Registered: 2008-05-01
Posts: 118

Re: Using glz_custom_fields and categories to create a tagging system

Thanks, Zanza – that is exactly what I need. Much appreciated. It would be helpful to see the code you’re using, if you don’t mind, just to see how you’ve adapted it for just one parameter.


The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.

Offline

#10 2011-06-18 18:41:23

frickinmuck
Member
Registered: 2008-05-01
Posts: 118

Re: Using glz_custom_fields and categories to create a tagging system

So, using Zanza’s advice I’ve now got the menus working using the following code:

<form class="coverage-selector" action='<txp:page_url type="request_uri" />' method="get">
<select name="coverage-type" onChange="this.form.submit();">
<txp:if_variable name="coverage-type" value="">
<option value=""> </option>
<txp:else /><option value="">All</option>
</txp:if_variable>
<txp:rah_repeat value='<txp:esq_glzcfvallist fieldname="coverage-type" />'>
<option <txp:if_variable name="coverage-type" value='<txp:rah_repeat_value />'>selected</txp:if_variable> value='<txp:rah_repeat_value />'><txp:rah_repeat_value /></option>
	<txp:rah_repeat_value />
</txp:rah_repeat></select>
</form>

Two issues I’m having, though:

1] I would ideally like to stick with the categories that are being plugged into the glz_custom_field via the script, rather than putting the options manually into the select field for the glz_custom_field. Using esq_glzcfvallist forces me to go back to manually inputting the options into the field. All I’d need to be able to do to stick to using categories is to replace esq_glzcfvallist with a comma-separated list of category names (actually – category titles I guess, not names, since that’s what the value ends up being for the custom field) beneath a certain parent. The problem is, category_list gives a linked list. Is there any other way to output a list of just the category names? I suppose using a query?

2] The other issue I’m having is getting the articles to display on the page. I’m using the following code:

<txp:adi_gps name="coverage-type" quiet="1" />
<txp:if_variable name="coverage-type" value="">
 No articles
<txp:else />
         <txp:article_custom category='<txp:category />' coverage-type='<txp:variable name="coverage-type" />' form="article_listing"  />
</txp:if_variable>

To test it out, and it’s not working. Any suggestions why? If it helps, the current URL structure is:

mysite.com/coverage/coverage?coverage-type=Television

Last edited by frickinmuck (2011-06-18 18:46:06)


The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.

Offline

#11 2011-06-18 18:49:42

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: Using glz_custom_fields and categories to create a tagging system

Not tested by me, but would this help?

<txp:category_list> <txp:category title="1" link="0" /> </txp:category_list>

Last edited by joebaich (2011-06-19 04:32:01)

Offline

#12 2011-06-18 19:11:29

frickinmuck
Member
Registered: 2008-05-01
Posts: 118

Re: Using glz_custom_fields and categories to create a tagging system

Works perfectly, Joe, thanks! Now if only I could get the articles to display I’ll be in business! This is feeling like it’s getting really close…

At the moment I’m having no luck in getting the articles to display. The code I have currently is:

<txp:adi_gps name="client" quiet="1" />
<txp:if_variable name="client" value="">
         <!--if no url queries-->
No articles
<txp:else />
         <txp:article_custom section="coverage" coverage-client='<txp:variable name="client" />' form="article_listing"  />
</txp:if_variable>

When I just use

<txp:article_custom section="coverage" form="article_listing"  />

I get articles appearing (of course), but as soon as I add in the custom field, no articles appear. Any ideas?

A simple

<txp:article_custom section="coverage" coverage-client="Sample Client Name" form="article_listing"  />

Doesn’t turn up any articles, either.

Last edited by frickinmuck (2011-06-18 19:58:42)


The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.

Offline

Board footer

Powered by FluxBB