Alternative ASP.NET UserControls in PHP?

I developed many ASP.NET web applications in which I used UserControls to control the header and any other common part of the web page. Now I am developing a PHP application, is there anything I can use as an alternative to UserControls ??

How can I implement a similar concept in PHP?

Thanks?

+4
source share
2 answers

The second answer, which is more difficult to explain here, is to create your own UserControl classes. Classes must have the necessary necessary properties and have the RenderHTML () method, which displays the control on the screen.

+2
source

The concept of UserControl does not explicitly exist in PHP, although you can encapsulate the functionality you need in the file and use the include () function to place it on your pages wherever you want.

<html> <head> <title></title> </head> <body> <?php include('header.php'); ?> <?php include('pageBody.php'); ?> <?php include('footer.php'); ?> </body> </html> 

Please note that Smarty provides a much better separation of processing and rendering and will make this type of thing super smooth.

+1
source

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


All Articles