Banner
Site
:: Home
:: Forums HOT
:: Credits
:: Staff
:: Users
:: Join Staff
:: SayBox Rules & Info
:: Link Us
:: Awards
:: ShrimPedia

Interactive
:: Submit
:: Forums HOT
:: Topsites
:: Gallery
:: Oekaki HOT

FMA Main
:: About
:: Books
:: Scans
:: Calendars
:: Covers
:: Festival

Anime
:: Introduction
:: Episodes
:: Characters
:: Voice Cast
:: Quotes
:: Music
:: DVDs
:: Movie
:: World Wide Dubs

Manga
:: Introduction
:: Hiromu Arakawa
:: Volumes
:: Chapters
:: Characters

Games
: GBA
:: Straying Rondo
:: Sonata of Memories
: NDS
:: Dual Symphony
: PS2
:: Broken Angel
:: Crimson Elixir
:: Girl Who Succeeded God
:: Dream Carnival
: Other
:: coming soon

TCG
: General
:: Rules
:: Decks
: Card Listings
:: Base Set
:: EX1: Blood & Water
:: EX2: Artificial Human
:: EX3: Alchemist's Gate
:: Promo Cards
:: Secret Rares

Fans
:: Fan Listings
:: Icons
:: Fanart
:: Fanfics
:: Color Bars
:: Other Fun Stuff
:: Friend Only Banners

Media
:: Music
:: Wallpapers
:: Animated GIFs
:: Photoshop Brushes
:: Winamp Skins
:: Mood Themes
:: ROMs

Real World
:: Meaning of the Sins

Webmasters
:: Webmaster Tips
:: Free Layouts
:: Color Chart
:: Scripts
:: Tutorials
:: LJ Layouts

topsites
JK.Net Top50
PPN Top 50



links
FM-A.com
« ? Hagaren # »
« ? Steel Bonds # »
Official Site
fm_alchemist
fullmetal_info
Using PHP to make Your site Dynamic
By JKaizer

With normal HTML, if you wanted to add a link to the sidebar, you would have to do it on every page, and it's tedious work. That's where php comes into play.

I don't really get that one code everyone seems to use, and I got one of my own.

First, make sure you have a php compliant webhost. That's defiantly important. =p

Okay, I'll make up a quick little webpage.

Code:

That code there will give me this page. It's a simple layout

Now, as my site grows bigger, and I have 20 differnet content pages, it's gonna become a pain to add in a link to the sidebar. I'd have to edit all 20 pages, just to add that one link. And what happens when I want to add yet another? I have to edit all 20 pages again.

That's where PHP comes in.

I can turn the above single file into 3 seperate ones, and it'll make my updating life very easy. I'm gonna break it down into three files, "layout1.php", "index.php", and "layout2.php".

On all my pages, everything up to where the main content begins is the same.

Code:

That's on all my pages, so I'm gonna use php's include function. I take all that out and make it a new file, labelled "layout1.php".

Then, I go back to index.htm and rename it to index.php. The .php at the end tells the webserver that there is php coding in there.

So, at the moment, index.php is looking like this:

Code:


I'm gonna add
PHP Code:


to the front of the file. What the include function does is... well, include. It'll take all the code from layout1.php and stick it into index.php. So if I were to look at the source of index.php, I would see this Code:

The exact same thing as what it looked like before I took out the beginning stuff and put it in layout1.php.

Now, like the beginning bit, the end bit is the same throughout all my pages. So I'll take this bit here, and put it in a new file labelled layout2.php
Code:

Now I can go through all my pages and replace the code with the php includes (remember to rename the files to content.php instead of content.html) and soon enough, my site will be completely dynamic, easily changable.




latest releases
anime: Ep39 Dub
Latest

manga: Ch54 Trans
Latest

movie: TV RAW
Latest


affiliates
Affiliate
spacer
Affiliate
spacer
Affiliate
spacer
Affiliate
spacer
Affiliate
spacer
Affiliate
spacer
Affiliate
spacer
Affiliate
spacer
Affiliate
spacer
Affiliate
spacer
Affiliate
spacer
Affiliate
spacer
Affiliate
spacer
Other Affiliates
Apply

shoutbox

other stuff
Couter
Get Firefox!
Layout Designed by: Arbromon 2005-2006