SKYR0SE DOT COM

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

updates

June 18, 2024
♥ v28 layout
♥ 4 textures
♥ 4 gradients
♥ 12 colors

January 02, 2024
♥ v27 layout
♥ 8 backgrounds/patterns
♥ 8 textures
♥ 6 gradients
♥ 2 banners
♥ 4 colors
♥ misc. tuts changes

November 11, 2023
♥ v26 layout
♥ 40 colors
♥ colors revamp

September 25, 2023
♥ v25 layout

April 14, 2020
♥ v24 layout
♥ 12 textures
♥ 4 gradients
♥ 2 banners
♥ 4 colors

October 01, 2018
♥ v23 layout (Halloween theme!)

Navigation

Back pats Banners Textus Colors Gradients

HTML Tuts CP Tuts Ps Tuts PHP Tuts Misc. Tuts

chat with me

Affiliates

PHP Dynamic Include

This is, in my opinion, a bit easier and difficult than the normal PHP Include: easier in the code, and harder in the links.
As for the normal PHP Include, you start with an HTML page - for references to that part, use my PHP Include tutorial.

Once you have the HTML page, put it aside for a moment and, with your chosen editor, create four php files - one more than the classic include - and call them head.php, foot.php, index.php and main.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>


Here is where Dynamic PHP Include differs from common Include: the main.php will in fact have no php snippets, but only the site content - like this.

CONTENT GOES HERE, ETC.

The index.php file will be even more different (and completely different from the classic include's).
Since it's very complicated also for me to copy and paste all index file code here, just download the file called home.php and rename it to index; don't touch anything on that file but the lines I'm gonna indicate you, or you'll end up messing it up and it'll no longer work.

The first line you have to touch is where it says what I show below.

// THIS WAS EXPLAINED IN PHP Includes
include ("head.php");

You change only where it says 'head.php', renaming it head, top or whatever your header file is called.
Then you search where it says the following.

$include = 'main.php';
include ($include);

That is the link it uses to find your content pages.
Last, you go where it says what you see below...

// THIS WAS EXPLAINED IN PHP Includes
include ("foot.php");

...and change only where it says 'foot.php' - to whatever your footer file is called.
The file names are not mandatory; as long as you match the parts I showed you to your files names, you can rename the four files to whatever you want.

Now comes the hard part, meaning the links...which is not that hard once you remember their construction, shown below.

<a href="index.php?page=page name">link name</a>

Always remember to put the index.php?page= before the page's actual name and not to add the *.php suffix; if you forget these rules, the links won't work.
There, the Dynamic PHP Include is done.

NOTE :: To have your full site done with PHP Include, you just have to copy the main.php for how many times how are your pages and fill them with your content.

© Sasha • 05.2014 // Hosted by BS // v28 Ana Beatriz Barros // Design :: FH // Photos :: MF // Powered by CN // Admin :: CP - CMS