About me Domain Credits Way out Refresh My blog My host Credit

updates

October 01, 2018 ♥ v23 layout (Halloween theme!) September 07, 2018 ♥ v22 layout ♥ 8 backgrounds/patterns ♥ 4 textures ♥ 20 gradients ♥ 4 banners ♥ 40 colors ♥ 2 photoshop tutorials ♥ 4 miscellaneous tutorials April 03, 2018 ♥ v21 layout ♥ 10 backgrounds/patterns ♥ 14 textures ♥ 10 gradients ♥ 50 colors December 17, 2017 ♥ v20 layout ♥ new blog entry ♥ 6 gradients ♥ 6 banners ♥ 6 colors November 03, 2017 ♥ v19 layout ♥ new blog entry ♥ 10 textures ♥ 10 gradients (new category!) ♥ 2 banners ♥ 10 colors ♥ revamped links & pages July 16, 2017 ♥ new layout (v18) ♥ new blog entry ♥ 6 backgrounds/patterns ♥ 8 premade banners ♥ 10 color schemes (revamped) May 25, 2017 ♥ new layout (v17) ♥ new blog entry ♥ 16 color schemes ♥ 1 photoshop tutorial ♥ 1 miscellaneous tutorial

resources

Terms Back pats Banners Textus Colors HTML Tuts CP Tuts Ps Tuts PHP Tuts Misc. Tuts
affies

welcome

Welcome to Sasha's gfx corner Skyrose, here to provide quality resources since May 2014; take a look, read the Terms, grab whatever you like and enjoy. <3

chat with me

PHP Include

The title makes it sound bad, but PHP Include is actually quite easy.
There are in fact no special skills required for it, all you need is a good HTLM/CSS/PHP editor - personally, I suggest one of the below. But let's start with the instructions.

Firs thing is you have to do is to make - or to download - an HTML page; when you open it with your chosen editor, you'll notice the page will have the following structure.

<!DOCTYPE html>
<html>
<head> --> this and the above make the header in all HTML pages
<title>page title</title> --> the page title (only modifiable between > and <)
<link href="stylesheet.css" rel="stylesheet" type="text/css" /> --> link to stylesheet </head> --> this closes the page's header

<body> --> this starts the page content (elements to be visible must be between body and /body)

<div id="navigation">navigation here</div> --> the site links will be here

<div id="content">content here</div> --> all the content will be here

</body>
</html> --> the last two elements close the page


The above is how any basic HTML page is built, and you start from that to create PHP Include.

Now put the HTML page you have above aside for a moment and, with your chosen editor, create three php files and call them head.php, foot.php and index.php.

The first file, head.php, is where the HTML page's header goes; you simply copy the code on your HTML page and paste it on the file. For the file to work, the code has to look like shown here below.

<!DOCTYPE html>
<html>
<head>
<title>page title</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
</head>

<body>

<div id="navigation">navigation here</div>

<div id="content">


Now you do the same copy and past routine with the second file, foot.php; final code has to look like below.

</div>

</body>
</html>


Now, open the index.php file and paste the following code twice, on both page top and bottom.

<?php include(''); ?>

You then insert head.php and foot.php in the brackets' empty spaces, until code looks like shown below.

<?php include('head.php'); ?>

content here

<?php include('foot.php'); ?>


Now, you just have to insert your content between the two php snippets - where my example says 'content here'.
There, PHP Include is done.

I alomst forgot: the file names are not mandatory; as long as you match the parts I showed you to your files names, you can rename the three files to whatever you want.

NOTE :: To have your full site done with PHP Include, you just have to copy the index.php for how many times how are your pages and edit the spaces between the php snippets with your content.