How to create a field that links to a category

  • Published by
    George Papadakis
  • Last modified
    28 October 2013
  • Up to date
    Yes
  • Profile concerned
    End user
  • Since Version
    1.5.6
  • Voting
    Average rating
    2 votes
    • 1
    • 2
    • 3
    • 4
    • 5
  • Favourites
    303 How to create a field that links to a category /documentation/tutorials-english/71-fields-usages-tips-joomla-plugin/303-how-to-create-a-field-that-links-to-a-category.html

You can create a field (J1.7+) that displays a category select box in item form and a link to the category at frontend views.

1. Create a select field

2. enable Use SQL Query

3. as Field elements enter

1
SELECT id AS value, CONCAT(REPEAT('-',level),' ',title) AS text FROM `# __categories` WHERE level>0 AND extension='com_content' ORDER BY lft


NOTE above remove space from # __

4. enable Remove space

5. as Frontend Display
select "value" instead of "text"

6. as value prefix enter:

1
<a href="http:://mysite.com/index.php?option=com_flexicontent&view=category&id=

7. as value suffix enter:

1
" alt="Display category">Some text</a>