1

I want to dump tags by order from the #__tags database table, but there is no order column in the structure, though there is ordering capability in the tags component.

I've viewed the relevant files from com_tags in reference to ordering, but I have not been able to define the logic to apply to my query statement.

SELECT p.alias,p.title,t.title AS tagname  
FROM #__content p,#__tags t,#__contentitem_tag_map m 
WHERE m.tag_id = t.id 
AND m.content_item_id = p.id 
AND p.catid = 27 
ORDER BY t.tagorder ASC //this column not included in table

I don't see any column that handles ordering. How can I get the ordering as arranged in the component's tags view page?

4
  • Looks like the Joomla's Pizza, Bugs and Fun event needs to pour a bit of attention into: docs.joomla.org/Tables Aug 25, 2020 at 22:44
  • 1
    I do not endorse the use of old-school comma-joins. (Although there is no loss of performance or integrity in your style, there is a fringe case for others to be aware of.) Your query will be easier to read with the verbose JOIN ... ON syntax. What kind of special ordering do you want? Are you not happy to use usort() in php? Aug 25, 2020 at 22:46
  • @mickmackusa usort() would be fine if I had given values to work from. None of the columns of the #__tags table are applicable since they do not represent the sorted order as displayed in the HTML view in the admin table. I need to pass the sorted output to a file in the admin template, and able to have that data rearrange dynamically when I change the tags' sort order. The file is not for distribution, so the "old-school comma-joins" will suffice. If you prefer it rewritten for this forum, I'll do so.
    – Nadal
    Aug 26, 2020 at 0:10
  • 1
    No, no, I don't need you to rewrite anything. I am just making an observation. Aug 26, 2020 at 0:14

1 Answer 1

2

Use column lft to order by the tag component's ordering.

The tags use nested ordering like the menu table - for a post that discusses nested ordering see Ordering Joomla menus in code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.