I deleted page.tpl.php file from my current theme, and noticed that all content is still rendering in my Drupal site with a little difference in structure. What is the real use of this file? Can we have any alternative or a replacement for this file?
page.tpl.php file is used to render your page body content (i.e. content inside
<body> tag). Below is one line description of file on api.drupal.org.
Default theme implementation to display a single Drupal page.
If Drupal is not able to find page.tpl.php file inside your theme, then it will use one of the following file:
If you're using version control system like GIT, Bitbucket, etc. you can revert your file from last commit. If not you will need to create new file and do necessary changes
All tpl are in /modules/system.
So if your theme miss one template, drupal take one of them inside this directory.
There are two things here
It matters when you have a separate
page.tpl.php file, Drupal will consider this layout.
The content would still be rendered because it uses the default template from Drupal core.
If you include (page.tpl.php) in your current theme folder, it would override the default (page.tpl.php) template.
Some useful links: