Adding custom columns/fields to Joomla article


Today we will learn how to add more columns/fields to Joomla *_content table. At first we should have to add a column in *_content table.
Run in for instance phpMyAdmin.
ALTER TABLE `jos_content` ADD `test` VARCHAR( 255 ) NOT NULL

Edit administrator/components/com_content/models/article.xml add:

In the first params section for instance below the access entry. Add var $test = null; to libraries/joomla/database/table/content.php
Now add $form->set('test', $row->test); to editContent() in administrator/components/com_content/controller.php
The result is that you now have a new field called test that can be used in various ways to display a separate text that is not a part of the article.

Advertisements