1

Working for joomla component development, Joomla provides us many of the functionality for free like sorting, pagination, validation, categorization etc. But when I look at DB tables of components there are some default fields. I know the use of most of them but what are the use of following fields?

  • Ordering
  • state
  • checked-out
  • publish_up
  • publish_down

now state can store 0 1 2 -2 values to know the status of current record then why Joomla use publish_up and publish_down and ordring

What are the use of these, what are we deprived of if our component's DB table don't have these fields? How do they work and why are they needed?

3

All these fields are optional.

  • ordering - the ordering of your items in the table which can be used to display items in defined order
  • state - the state of your item. For example in CMS it is: -2 for trashed, 0 for unpublished, 1 for published and 2 for archived items.
  • checked_out - stores the user_id who currently is editing an item. Useful when you do not want to allow several users to edit the same item in the same time. Often is used together with checked_out_time which stores the time when an item was checked out.
  • publish_up - the date and time when to publish an item (change the state to published)
  • publish_down - the date and time when to unpublish an item (change the state to unpublished)

If you will use them then CMS will handle common operations on them automatically. For example in JTable class (/libraries/joomla/table/table.php) you will find different methods which handle processes connected with these fields, for example: reorder(), checkIn(), checkOut(). The same you can find in the Models.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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