Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
760 views
in Plugins by
closed by
Suppose that I use tag description plugin, and my tags become information-rich with titles and description snippets.

How can I list tags like question lists? Maybe some of the tags don't have all title and description data, I would like to list those with full needed information (while ignoring those without).

Are there some general ideas to do so?
closed with the note: Solved
by
You need to create Plugin ,
Work with qa-include/pages/tags.php
and you need to create extra field on DB for more infromation about tag .
by
Q2a lists tags based on popularity, and doesn't list tags without questions. I'd like to list them all, and in alphabetical order. I'm looking for some ways to list tags based on the information in qa_tagmetas table, but the data structure there is difficult to pull. Each tag has three records, and some funny records have repeated value like title = title. title=description, title=icon. Very inefficient.

1 Answer

+1 vote
by

NB: I'm using the Advanced Tag Descriptions plugin, so what I'm writing below may or may not apply to vanilla Q2A.

The tag meta information is stored in the table qa_tagmetas in the database, but the way the information is stored is a little convoluted. Each tag has 3 records in that table (icon, title, and description). You can query that table for all tags that have a title and a description like this:

SELECT
  t.tag,
  t.content AS 'title',
  d.content AS 'description'
FROM qa_tagmetas t INNER JOIN qa_tagmetas d ON
  t.tag = d.tag AND
  t.title = 'title' AND
  d.title = 'description'
WHERE t.content IS NOT NULL AND
  d.content IS NOT NULL;

You'd process the query somewhat like this:

$query = "SELECT t.tag, ...";
$tags = qa_db_read_all_assoc(qa_db_query_raw($query));
foreach ($tags as $tag) {
  // Create tag page output here.
  // The fields from the result set can be accessed as
  // $tag['tag'], $tag['title'], and $tag['description']
  // respectively.
}

by
When I asked this question, I expected one single person would answer. Thank you. Btw, I also prepared the worst case, I created a plugin to store tag information in a simple normal table.

Thanks again.
...