Welcome Guest ( Log In | Register)



3 Pages V   1 2 3 >  
Reply to this topicStart new topic
> How To: Make A Simple Php Site, Making one file show up on all pages using php
Albus Dumbledore
post Feb 16 2006, 02:10 AM
Post #1


Hidden Secrets can't be told threw just words. One must feel what the other feels to truely understand...
**************

Group: Members
Posts: 1,523
Joined: 8-January 06
From: Sacramento California
Member No.: 16,756



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...

CODE

<div><b>.:Site Navigation:.</b><br>
- <a href="link here">Forums</a><br>
- <a href="link here">Contact Us</a><br>
- <a href="link here">Employee's</a><br>
- <a href="link here">Affiliates</a><br>
- <a href="link here">Affiliation</a><br>
<b>.:Tutorials:.</b><br>
- <a href="link here">CSS</a><br>
- <a href="link here">HTML</a></div>


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>_<

This post has been edited by Albus Dumbledore: Feb 18 2006, 03:02 AM
Go to the top of the page
 
+Quote Post
apollo
post Feb 16 2006, 09:30 AM
Post #2


Member [Level 1]
****

Group: Members
Posts: 68
Joined: 22-January 06
From: Latvia, Ogre
Member No.: 17,468



Hello. Thanks for tutorial, but it isn`t something special... Anyway, it`s ok!
Go to the top of the page
 
+Quote Post
Tyssen
post Feb 16 2006, 09:38 AM
Post #3



***********

Group: Members
Posts: 1,161
Joined: 9-May 05
From: Brisbane, QLD
Member No.: 6,818



QUOTE(Albus Dumbledore @ Feb 16 2006, 12:10 PM) *

that could be saved as menu.html and you would just have to change FILE EXTENTION to 'menu' and it should show up!

I think you want to clear that statement up cos at the moment it sounds like you're saying you should change the file extension to .menu.
Go to the top of the page
 
+Quote Post
Albus Dumbledore
post Feb 16 2006, 11:08 PM
Post #4


Hidden Secrets can't be told threw just words. One must feel what the other feels to truely understand...
**************

Group: Members
Posts: 1,523
Joined: 8-January 06
From: Sacramento California
Member No.: 16,756



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.
Go to the top of the page
 
+Quote Post
DjLuki
post Feb 17 2006, 03:09 AM
Post #5


Super Member
*********

Group: Members
Posts: 447
Joined: 2-March 05
Member No.: 4,094



that can be done in html only..i dont see how that is php except that ure changing the index.php file thing..
Go to the top of the page
 
+Quote Post
Tyssen
post Feb 17 2006, 06:43 AM
Post #6



***********

Group: Members
Posts: 1,161
Joined: 9-May 05
From: Brisbane, QLD
Member No.: 6,818



QUOTE(DjLuki @ Feb 17 2006, 01:09 PM) *

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.
Go to the top of the page
 
+Quote Post
Albus Dumbledore
post Feb 17 2006, 06:58 AM
Post #7


Hidden Secrets can't be told threw just words. One must feel what the other feels to truely understand...
**************

Group: Members
Posts: 1,523
Joined: 8-January 06
From: Sacramento California
Member No.: 16,756



QUOTE(DjLuki @ Feb 16 2006, 07:09 PM) *

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
Go to the top of the page
 
+Quote Post
Tyssen
post Feb 17 2006, 07:04 AM
Post #8



***********

Group: Members
Posts: 1,161
Joined: 9-May 05
From: Brisbane, QLD
Member No.: 6,818



QUOTE(Albus Dumbledore @ Feb 17 2006, 04:58 PM) *

but i think i am going to also test that out before i edit the post

Sure, check it out.
Go to the top of the page
 
+Quote Post
bladeron
post Feb 17 2006, 11:42 AM
Post #9


Member [Level 1]