ATTENTION!! ... We just launched this forum recently, so not much is on it yet. JOIN TODAY!

Converting HTMl to PHP

Everything that has to to do with html/css programming
Post Reply
User avatar
PixelinkMedia
Site Admin
Posts: 47
Joined: Mon Apr 08, 2019 2:20 pm
Contact:

Converting HTMl to PHP

Post by PixelinkMedia » Sat May 04, 2019 10:08 pm

People who strictly use HTML files, often are reluctant to use PHP, because they don't know how to use PHP.
However, what they fail to realize, is that all you have to do is change your "index.html" extension to index.php, and still use it as HTML. You don't need to know the PHP language.

The reason that this a a great strategy is, because you can use PHP to create a real basic template with just one line of code.
Unlike HTML, there is no easy way to create a template unless you use a framework, or something like Dreamweaver.

For Example:
We only need one line of code to create a template. What this does is when the index.php loads, it will also load the header.php
And so, what ever is in the header.php, now becomes part of the index.php. What is cool, is you can do this many times, even within CSS DIV's.

Just using two files for example (index.php & header.php)
Here is the code for each.

INDEX.PHP CODE:

Code: Select all


<!DOCTYPE html>
<html lang="en">
<head>
<link href="css/stylesheet.css" rel="stylesheet">
<title>My Website</title>
</head>
<body>

<!-- HEADER -->
<?php require("header.php"); ?>

</body>
</html>


HEADER.PHP (is an include file, not a page that is linked to)

Code: Select all


<div id="headerWrapper">
    <div id="headerLogo" ><a href="index.php" target="_top"><img src="image.png"  alt="My Image" title="My Image Description"/></a>
    </div>
</div>



Don't be afraid to convert your HTMl to PHP, it liberated me from HTML limitations!!!!
My Site: Pixelink Media • Windows 7 • 10G RAM • NIV-GForce GT 640 Graphics Card
Affinity (Designer/Photo/ • CorelDraw • Blender • HitFilm • Saola (web animation/interactive) • MagicaVoxel
Lazarus (Free Pascal) • .NET Framework (discontinued for now) • PHP • Html/CSS • Javascript • mySQL/SQLite
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest