Search code examples
phphtmlcssdrupaldrupal-7

Can I write my own HTML code in Drupal?


I learned to build websites a few months ago purely with HTML and CSS. I already made some sites and what I like the most is that you can really determine how the site looks like. Now, I found that if you make 1 simple adjustment in the layout, you have to copy the code into all the pages. I don't have a template which automatically upgrades when making a suggestion. So I started to learn Drupal and I am working my way around themes. But I don't seem to understand how you can customize themes. When I 'Inspect elements' in Google Chrome, I can clearly see the HTML-code of that template, but in my folders I can never find the file that contains that HTML-code. All I can see is .php files with code like 'if (...) than'. So, no clear HTML-codes like header. I have searched and searched on Drupal and the internet and I just can't seem to grasp the idea. I know Drupal uses PHP and MySQL, but it also says you have to have a good understanding of HTML, but I don't see where you use HTML.

Is it possible to write your HTML-code in a file and let that be your template? E.g.: I want a header and footer that is the same on all pages and let that be my template.

Some help for a newbie on Drupal :)?


Solution

  • Its is absolutely possible to do so. You can simply override the page.tpl.php file and write your custom HTML structure in that file. This will render your structure (example: header and footer in your case)in all the pages uniformly.

    Moreover if you are want to do only for front page you can override the file using following naming convention

    page--front.tpl.php

    This file will have its effect limited to front page only. Similarly you can override the other files as per usage.