2

I had already created some custom components in the past and how it is, at the beginning you cannot understand all things in detail. But with continuing always new question arise.

Could someone explains when to use edit.php in Joomla layout views and when to use default.php instead? What is the difference?

1 Answer 1

2

If you follow the standard conventions, edit.php will be used for the form layout that allows you to edit an item, and default.php will be used for viewing an item as well as viewing a list of items.

Typically in Joomla, you will see two types of view folders: singular and plural. The plural version (let's call it "articles"), will just have a default.php file that will render a list of articles. The singular version ("article" this time), may have both the default.php and edit.php or could just have edit.php. (Sometimes the default isn't implemented.) If both exist, the default.php file would render the article information to be viewed but not edited. The edit.php file would render the form allowing you to edit the article.

2
  • Great David. Iam asking this question, because iam facing a problem with my cancel button in my default.php, which is a form with some input fields aswell a save and cancel button. There are some required fields in my form. When i use the cancel button, the form validation informs me to fill out these fields. Could it be a result of using the default.php layout?
    – Perino
    Commented Dec 26, 2014 at 15:59
  • @Perino Nope. That's a separate question though, so open a new question about the cancel button/form validation and I'll pop over there and respond. Commented Dec 26, 2014 at 16:05

Your Answer

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

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