Homepage
About Us
Information
Multimedia
Gaming
Humor
Forums
Past Polls
FAQ
Contact Us
 

Multimedia:
Featuring:
   
 

DragonBallZ.ws Version Z

Your Ad Here

Miscellaneous: PHP Tutorial

PHP is an amazing tool for any website. If you're wondering, it stands for Post Hypertext Peripheral coding. PHP is mostly used in layouts for websites. Before beginning this tutorial, you must know whether your web server supports PHP! Be careful, web servers that support PHP are pretty rare, especially free web hosts. Don't worry, PHP is very easy to learn and doesn't even take that much time.

Step 1: Okay if you're here, then you know that your web host supports PHP. The first thing you must do is create a simple page, with a decent layout that you like. Make sure the layout is organized. For example, the content is in one spot and the navigation is in the other. Now this is the really cool and fun part. Delete all the information from where the content would be, like the news and other main information. Don't delete the navigation menu, or news ticker, or what other things you might have had. Simply delete the spot where all the content would go. Take all that content, and put it on another page and save it. Now you simply have a page with a layout, but no content. Save that layout page as index.php or main.php, or something easy to remember.

Step 2: Now you have an index.php or a main.php, or what you named that layout page. The next thing you have to do is simple. Open your layout page, and insert

<?php include ("$page.extension"); ?>, where the content once was.

So here we have a layout page with <?php include ("$page.extension"); ?> where all the content once was. Next you have to edit that line that you just inserted.

The page in the line stands as a variable. For example, DBGT.com used "dbgt" as their variable. Make sure your variable is easy to remember, as it will be used throughout the whole site. You could use "page" as your variable; there is nothing wrong with it.

The extension part stands for the types of pages you used. For example, your pages could be ".html" or ".shtml". PHP only works with page extensions such as ".html" or ".txt". I believe there are some other ones, but these are the most popular. So go ahead and change all your pages to either ".txt" or ".html" and where extension goes, write the one that you chose. So now, you have something like this:

<?php include ("$page.html"); ?> or
<?php include ("$page.txt"); ?>.

Step 3: Lastly, you must test your ".php" page. Open up your browser and type in the address to the php page. For example:

http://www.your-domain.com/index.php

You should see the layout that you created, but in the content area you should get a PHP error, because the layout page doesn't know where to re-direct! This part is probably the hardest in PHP, but it's still very simple. Remember all that content you deleted from the layout page? You must find out what you saved it as, such as "news.html" or "news.txt", or something else. Now go to the web address bar, and next to index.php, make a ? and type your variable. After that, make an equal sign, =, and write in the name of the page of your content. It might be hard to explain, but let me give you an example. DBGT.com's variable is "dbgt" and their ".php" page is called "index.php". Then, using multimedia as an example, they have it as multimedia.txt. So, your address would look like this:

http://www.dbgt.com/index.php?dbgt=multimedia

That should help to clear things out a bit. You should NOT write the extension in the address. Writing

http://www.dbgt.com/index.php?dbgt=multimedia.txt is a BIG no. Simply write the name of the page.

Now, when you visit that page you should get your ".php" page layout and also the page of information in the content section. That is, when you re-direct the page. PHP might sound a little complicated in words, but once you get the hang of it it's really cool.

You could probably see what PHP is used for now. You could simply edit your layout page, and have a new layout, without even having to edit each and every page in the site! See, I told you it was a great tool.

-Information Produced By: Draton

Back To Top - Return To Homepage

Your Ad Here!

Latest Media
- DBZ Movie #12 & #13
- DBKai Episode 018
- DB:

- DBZ:

- DBGT:

Random Quote
"Well I'm as alive as a dead guy can be!" - Goku

Blank Evolution
DBZ Masters
DBZ Saiyan Chronicles
Z-Rage

BlankEvo Forums
Vote for us!

Website Bio:
Site Creation: January 2009
Webmaster: Majin Gohan
Site Layout: An old friend from DBGT.COM!

Site News: DragonBallZ.WS is moving along and growing gradually, it may be slow, but we are moving at a good steady pace so this site can become a timeless archive for Dragon Ball fans of all generations. We currently have an excellent staff who is bringing you lots of original information and interaction on the site. We're also constantly working on having media up, and having it stay up for as long as possible
If you have any suggestions / comments, please don't hesitate to drop us a line! / Keep Visiting! /

MG_ is getting busier by the day with life among other things. But still has love for the site and Dragon Ball in general. Site maintenance and new informative updates are his priority

Support Us! Please click any of the ads you see on the site to help pay for our server. All it takes is a click, and your free to continue doing what you were before! Thank you!

Support Us:
  
Click Here to Vote!


Support Us by clicking on a Sponsored Ad!