How To: Make A Simple Php Site - Making one file show up on all pages using php
Albus Dumbledore
Feb 16 2006, 02:10 AM
I have looked all over the site and could not find anything that was like this simple, or just like this at all..
For some people i know that you are using a basic HTML site...and having a big menu if you want to add somthing you have to go into every one of the pages and add or remove or edit what you want to do, but with somthing verry simple all you would have to do is edit one file, and all of the pages that have the PHP script on them would suddenly change to what that one file is.
So to start off if you are planning on using this little tirck, the page that you are putting the code on must be a .php page, so instead of 'index.html' it would be 'index.php' this changes none of the aspects of the page except for the fact that you can put php scripts in the page now, if you are unsure how to do this simply open the file in the editing program you use and when it asks what you want the name to be put 'THENAME.php" and it will be saved as a .php file..
now to the script...wherever you want the content of that one file to show, you will need to put this code
CODE
<?php include("FILE NAME.html"); ?>
you simply need to replace the FILE NAME with the name of the file in which you want to show. and if it is in a different directory put DIRECTORY/FIILE NAME instead...simple eh..
but now, for the file that you want to put on the pages...all you need to do is make a normal html file or any other file that you have that you want to include with the content, so if you want it to be a menu for example...
that could be saved as menu.html and you would just have to change FILE NAME to 'menu' and it should show up! just be sure that the file extention is .html *edit* edited it per Tyssen's post, now it DOES NOT have to be a .html file, i have tested it out and it works so that way you dont need to use .html, you can also use any other ones such as .php....who woulda guessed lol..thanx tyssen
well that is about it! my thanx to Phillip, aka webmaster_2006 for clearning up the matter of the page HAVING to be .php, for me!
*edit* edited it per Tyssen's post of clearing it up, thanx! it did mix it up a little>_<
thanx, Tyssen, i retyped a few things and hopefully it is clear now,
@ apollo, im sure that people who are making sites and dont use somthing like this and are just now finding out about somthing like this think differently, if you had 30 pages on your site all with a menu and you wanted to add one bloody page...would you want to go through and change all 30?
it may be a small thing compared to what else they may be able to do but i am sure some of the noobs find it allot more usefull than going through all of their files and changing it like i said above.
that can be done in html only..i dont see how that is php except that ure changing the index.php file thing..
You can't do PHP includes with HTML. By the way Albus, your file doesn't have to have an .html extension, it can be whatever you want - .php, .asp, .txt, .inc. The page that calls the include, rather than the include separately is what gets parsed, so it doesn't matter what format the include is in.
that can be done in html only..i dont see how that is php except that ure changing the index.php file thing..
well my friend calls it php, and call it php so i just called it php, we called it php because of the
CODE
<?[b]php[/b] include("FILE NAME.html"); ?>
php in the code needed to make it work.
@Tyssen, ok thanx, i believe you but i think i am going to also test that out before i edit the post because the person who taught me said it has to be a .html, if it works that way i will change it and if it does i will tell the person who told me, lmao..also if it is true thanx for advancing my knowledge in php :-D
i tryed to make my own php site, but it was too dificult, so i made it in html and take php forum, from phpbb.com. it is very nice forum, but i saw it almost everiwhere.
hmmn. I have seen a similar tutorial, somewhere in google. you sure, this is yours?
Notice from jlhaslip:
Tutorials in this Forum have a Review Process. Part of the review includes checking for plagarized material. Another part is to know the member, their ability and how they handle their account and whether they are capable of writing materials at the level indicated by the Tutorial they present. Please don't accuse any member of copying without support for your claim. Thanks.
This tutorial is ok but it's too simple I think and nothing so special for it.. but if you first hear about PHP and website making with PHP maybe it's something that can give a idea anyone.. Nice things but still i think it's way too simple.. sorry but thats the way it is.. ok nice tutorial and hope to see more of your tutorials
Think that we have written a program, and some codes are wrong. We can go back to compiler and
change the code, and compile again. But I will show you how to correct our mistakes without using
the compiler. Let's start: I have written a program in Delphi. Let's see my mistake. I
have created a form like this. After this I wrote the codes in the Compare Button click as
below. CODE 1. procedure TForm1.ComparebuttonClick(Sender: TObject); 2. var
3. a,b:integer; 4. begin 5. a := StrToInt(EditA.Text); 6. b :....
Hello. I am BuBBaG. You can call me Bubba for short. I'm going to show you how to make an
Ultimate Game List. First off, we need to make a database, we are going to call this database
`my_db`, leave out the `'s. Inside that database we will need to create a table
called `ugl'(Ultimate Game List, duh). To make the table, simply enter this in the Syntax.
CODE CREATE TABLE ugl ( System char(50), Game char(50), ) In the
above code, it is stating we are creating a table called ugl, with two columns, System, and Gam....
JavaScript is very handy at making forms, allowing for much more customization and easier ways to
send data. So making Login forms using JavaScript may seem to many to be a very feasable idea.
However, JavaScript is very bad at protecting Passwords, as since the passwords are not encypted and
the whole JavaScript code is in the page, a person could just view the Page Source and find out
everything. Even if you use an external JavaScript, it would still be poor as the file name for the
external JavaScript would still be revealed. But I have an answer! There is a rela....
The quickest way to get a password protection system up and running is to use a Prompt box in
JavaScript that has a title like "Enter your Email Address". Only you and the relevant users know
what the password should be, could even be one each, that can be sorted out at the next page then
pass the "input" directly through the url by changing the .href, like
http://www.iSource.net.nz/users/?leTmeIn= The page that then processes this should also check for
the referring page, and three fails from an IP if you like the php (the next page): CODE
<?php // processdo....
Description Learn to create easy to edit content-only pages with php. By parsing your layout into
your pages, you can reduce file sizes and files will become much neater. Try it out Ok, lets
start by creating a file called template.php. CODE <?php
//--------------------------------- //Layout top section //---------------------------------
$top = <<< html <!-- include HTML header code here --> <body>
INSERT CODE FOR [b]TOP[/b] OF LAYOUT HERE. html;
//--------------------------------- //Layout bottom sec....
Hi - ill show you how to make a simple style sheet that will be embedded into your site. OK make
sure your site is set up already (like the standard tags) To start and end off a stylesheet you
need to do the following CODE <style type="text/css"> </stlye> Ok
lets start CODE <style type="text/css"> p { font-family: "Tahoma";
font-size: 9; color: "red"; } </style> So when you come to put in
CODE <p>Hi!</p> The text will appear red and will be in Tahom....
Recently, I had a need to make a FTP client, since our webhosting FTP server was kind of exotic, and
very restrictive, and most of uploads, even though they reach 100% would crash... File would be
uploaded to a server, but FTP clients just froze upon completion, waiting for the 226 (OK) from FTP
server... So, I had to make my own, one who would not wait for 226, but instead, watch the file
pload progress... This tutorial is not fuly complete, in the sense that it does not offer COMPLETE
FTP client functionality (for example, I ddn't write the code for FTP download, ....
ok part three now which covers the precusions setup of the small song i built for this tutorial.
the nesecery files can be downloaded here the image below is included in the precusions folder as
it mught not be entierly visable within this post so shold you need it its there also the images
purpose is to enable you to see what i am refering to within this tutorial lateron. now what i
have done above is blackd out every pattern that has nothing to do with the precusion. so the
patterns displayed in light grey are the only patterns i will be refering to. ok lets b....
Installing an AEF Forum on the Trap17 Server Preparation for Installing the AEF Forum
The following items are required for the installation of the packaage onto your site: 1. - a copy
of the AEF Forum zip package from http://anelectron.com/download.php 2. - a MySql Database 3. - a
Database User 4. - a password for the Database User 5. - Privileges allowed for the Database User
The details for ensuring that you have all of these items are as follows: 1. - a copy of the AEF
Forum zip package from http://anelectron.com/download.php . Simply browse to t....
This is a simple tutorial on a way to set up a bookmarking system on your Wii with greater stroage
than the Favorites. It is more complicated than the Favorites and requires manual URL typing. Well
let's dive on in. Items Required Nintendo Wii Internet Channel 3 Empty Favorites Internet
Connection An account on a social bookmarking site I will be using delicious as an example.
delicious Ok, if you do not have an account, read on. If you do have an account, go to the
{account} section. Ok, first you need to register an account. This can be done by clicki....
Create a google seach result page embed within your site page. It is easier to create
web page that embeded the google search result in it. The first step is to go to google apply an
account for the google ad-sense. After that login to you account and choose the create ad-seach
option. Most of time the google search box give all we have the great and powerfull seach ability.
But, have you think every time users get seach with it. They do redirected to another page that is
not within you site. It is easier to create web page that embeded the google sea....
This is pretty simple but very useful if you don't want people to swear. We will be using
str_replace for this. CODE <?php str_replace ("curseword,
"replacemet"); ?> Thats pretty simple, just fill in the curse word and the
replacement, and then repeat... heres what it would look like full size: CODE <?php
str_replace("swear", "replacement"); str_replace("swear",
"replacement"); str_replace("swear", "replacement");
str_replace("swear", "....
I've been working on my Resume for months now. Here is a summary of what I've learned: 1.
Avoid referring to yourself via 1st person or 3rd person terms. Rather than saying "I started this
job in" just say "Began job in"... Employers expect Resumes to be professional and avoid reference
to oneself; and instead speaking in an impersonal tone that presents
achievements/skills/experience/education without personalization. Avoid words like "I", "my", "he",
"she", etc. Leave out personal pronouns and only use the action words/verbs. This also includes
your Ob....
Link: http://www.jlhaslip.trap17.com/samples/misc/ajax/index.html Check that out. The first page
has information and the second and has the actual example of its use with sample CSS code. I find
that when you visit a site which has a slow server and attempt to view 'large' Image files,
it is pretty boring to sit and stare at a blank screen, so this little snippet of code can be used
to give the visitor something to see to indicate that the image is being downloaded. I built a
small animated gif that sits in the background of the space allocated for the image....
Ok, for this tutorial i am only going to show you how to add updates to your site simply by storing
the information into a text file, and then displaying it with predefined formatting... OK lets get
down to business... Lets start out by making a PHP file and call it mycms.php put this code at
the top of the page. What this will do is allow us to edit the selected update when it comes time
and show and hide the add an update field and validate the form.. <script
language="javascript"> function ShowHide(id1, id2) { if (id1 != '') expMenu(id1)....
Im back again with what i think it would be an interesting tutorial for all of you guys who wants to
take flash out of the web and make really cool interactive CDS. First of all if all of you are
thinking right now: "this dude is wrong for making interactive cds you have to use macromedia
Director", well you are right macromedia director it's used to build interactive cds and dvds
among other things, but you can also make interactive cds with Flash, the thing is: if you want to
make a simple interactive CD you can totally do it with flash, of course Director brings ....
This tutorial shows how to transfer file of any size using winsock control. - Open VB; - Select
standard exe; - Press Ctrl + t to show the add component window; - Select winsock control and
microsoft common dialog; - Add one winsock control in the project; - Name it winsock1; - If you want
to add chat then add another winsock and name it winsock2; - Insert another winsock object if you
want to add chat also; - Add a microsoft common dialog box; - Name it cd; - We will use this
winsock1 object to transfer the file and winsock2 for chat; ------------- The basic idea : ....
I'm sure many of you out there have used phpBB at some point. To those who enjoy running forums
and online communities, specifically supporting phpBB, I am about to tell everyone how to restore
the forums database from one website, to another. This is presuming you do not have any mods or
hacks installed. Some of you may find this information useful. Here is the scenario: Let's say
you have forums running phpBB version 2.0.17 (currently the latest one). You have decided that you
want to move your forums to a whole new URL and provider, and as an added bonus, ch....
**** This tutorial will show you how to put files into .rar Archive and pass worded (if wanted)
**** What You Will Need Before continuing you will need a couple of thing, first of all you
need WINRAR , which is a very powerful archive manager. It can reduce size for you email
attachments, decompress RAR, ZIP and other types of files downloaded from the internet. You can get
winrar at http://www.rarlabs.com The other thing is that make sure your using Windows XP because
this is what I used to make this tutorial. I think it works with any other windows not....
Over the course of the summer I have tried hard to install a shoutbox into a new forum I was
developing. I went to the Invisionalize forums and found several mods for shoutboxes, but none of
them seemed to work. I first tried to install the D-Shoutbox, but upon this first try, I was
unsuccessful. Eventually, after much frustration, and trying other mods, which didn't seem to
stack up to Dean's features, I was determined to make it work. For some, editing your files (to
the newbie that is) can be difficult, with everything looking like a foreign language (basi....
This tutorial is meant for people that are dealing with problems while coding their site at 100% of
width. Important notice: Some people has JavaScript disabled, so they will not be able to load CSS
file (take this in account when creating your website). How this script works. In the HEAD of your
HTML document will apply this command, so variable.js file will be load at start: CODE
<script type="text/javascript" src="variable.js"></script> In
browser JavaScript file variable.js is loaded. This Javascript file consist of this para....
WAP Site Tutorial : How to Make A Wap site? Before We begin.. Defination from the
Web about Wap. QUOTE WAP is an open international standard for applications that use
wireless communication . Its principal application is to enable access to the Internet from a
mobile phone or PDA .A WAP browser provides all of the basic services of a computer based web
browser but simplified to operate within the restrictions of a mobile phone. WAP is now the
protocol used for the majority of the world's mobile internet sites, known as WAP sites ....
I've seen a tutorial on here and no offense but it was horrific, this is the real way you do a
404 Error Page. Make a file called: htaccess.txt Open it up and put this: CODE ErrorDocument
404 /myerrorpage.html You will need to change myerrorpage.html to whatever your page is called.
Also when you upload this file to your server you need to rename it to: .htaccess Yes, the dot is
before the words. You need to do this on the server because on Windows you cannot do that!....
Did you taking too much time to access your favorite sites? Probably the problem is on the server
used by those sites. To make sure that is the problem, use Windows PING facility. Ping is a small
program, which sends a 32-bit signal to the Web site server. Next, Ping record the time needed by
the server to answer it. To activate Ping: Click on the Start-Run menus, type command, and then
click OK. Type PING "site name" in the MS-DOS prompt window, for example PING www.yahoo.com. In a
moment, the result will appear on the screen. A result less than 300ms is normal spee....
I have included my coded file with this... Ok here is the code. CODE // //Create login area,
replace the phpBB2 in /phpBB2/login.php with your forum's //directory // <form
action="/phpBB2/login.php" method="post" target="_top"> <table
width="25%" cellspacing="2" cellpadding="2" border="0"
align="center"> <tr> <td align="left"
class="nav"><a href="/phpBB2/index.php" class="nav">Prank Place
Forum Index</a></td>....
In this tutorial, I'm going to show you how to test your PHP pages without the Internet or
uploading the files to your trap17 server. This tutorial is similar to doom's, but the links he
provided does not work, so I decided to make my own tutorial with working links. The program that I
will be using for this tutorial is called XAMPP . XAMPP is a modification of the popular Apache
server, and I'm using XAMPP because of its simplicity to install as well as maintain. The
current version of XAMPP is 1.4.13 and it has the following bundled in the download: QUOT....
Hello all, A little bit back I decided to make a quiz scriptjust out of no where lol. However it
doesnt do anything special but I am going to make an email mod for it so that it will email results
to your email address. So here is the basis of it. INSTRUCTIONS: Open a new page in your text
editor and paste in the following code. CODE <?php $qid = "Quiz ID-00"; ?>
<html> <head> <title><? echo "Gamers Pub $qid";
?></title> </head> <body> <p><h3><? echo "....
Hello all, Here is an easy Emailer or Contact system that allows visitors or members of your site
to email you just by filling out a form. So here is what you need to do to set it up. First open up
a new page in your text editor and paste in the following code. CODE <?php $Name =
$_POST['Name']; $Subject = $_POST['Subject'];
$Email = $_POST['Email']; $Site =
$_POST['Site']; $Message=$_POST['Message'];
$align = $_POST[....
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE
forum, Create your own topics, Ask Questions, track topics, setup
subscriptions & notifications and Get a Free Website w/ Email and FTP.