Base page or wizard base page or nested wizards?

I have a site with two main pages: one for a single-column layout and one for a two-column layout. They are embedded in the main page, which provides a common header and footer.

I have the functionality that I want each of the content pages to have; Should I:

  • create a base class for the page and inherit it inside my content pages or
  • to create a base class of the main page and inherit inside one of my levels of the nested main page?

Ultimately, I want the content pages to have access to the connection object and to the configuration object that I want to create each time the page loads.

+2
source share
3 answers

Master pages should only be used for layouts, in my opinion.

If you want to do work such as creating connections, do it in the base class.

However, it is important that you do not create a database connection at the beginning of your page and do not close it at the end. You must open and close connections when performing separate requests. This allows you to work effectively with the connection pool.

In addition, I would not put a connection of any type on the page itself, since you want to separate your capabilities from the layout as much as possible.

+4
source

, , .

- .

+1

Source: https://habr.com/ru/post/1723649/


All Articles