Flash / AS

Blend / WPF
ASP.net / PHP

Photoshop

Forums
Blog

About

 


FlashComponents
  Galleries
  Slideshows
  Menus
  Design & Effects
  Audio & Video
  User Interface
  Templates

 

 

 

 

 
Using Includes with PHP
         by Jubba

Introduction
This tutorial is just a down and dirty explanation on how to use the include() function in an attempt to make your PHP code-writing life a little easier. Basically the include() function includes the file placed inside the parenthesis as the argument inside of your main file. I use this a lot when I am connecting to a database over multiple files. I keep all of my connection variables in my include file and call them throughout my main scripts. Kind of like this:

Include file: include.php
<?
// This is my include file
$dbHost = "localhost";
$dbUser = "root";
$dbPass = "";
$dbName = "MyDataBase";
?>

This is the file that I name include.php Its the one that I will be placing inside of my main scripting files. Then all you need to do to place your information inside of your file is one small line of code:

Main file:
<?
include("include.inc");
// The rest of my code would go here...
// and here...
// and here...
// and here...
// and here...
?>

Now there is another function similar to this, require() the only difference between them is that require() returns a fatal error and stops the script from executing. Include() doesn't do that; the script continues to run even if the file that you are including contains some type of an error. I know that this tutorial didn't cover 100% of the bases. It was just a simple explanation. If you would like more info you can check out PHP.net or feel free to ask on the forums in the Server-side Scripting Forum.

Jubba

 


kirupa.com's fast and reliable hosting provided by Media Temple. flash components
The Text Animation Component for Flash CS3
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.
Check out our high quality vector-based design packs! Flash Effect Components

Flash Templates
CSS Templates
Dreamweaver Templates

flash menus, buttons and components
Digicrafts Components The best flash components ever!
Entheos Flash Website Templates Free Flash Page Flip
flash components Buy and sell FLAs at Ultrashock!
Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com create flash slideshow as easy as 1,2,3
Learn how to advertise on kirupa.com