Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

How To: Make A Simple Php Site


22 replies to this topic

#1 Albus Dumbledore

    Nothing ventured, nothing gianed

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1,563 posts
  • Gender:Male
  • Location:Sacramento California
  • Interests:Allot of things, websites, coding, photography, my future
  • myCENT:73.26

Posted 16 February 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
<?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...

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

Edited by Albus Dumbledore, 18 February 2006 - 03:02 AM.


#2 apollo

    Member [Level 1]

  • Kontributors
  • PipPipPipPip
  • 68 posts
  • Location:Latvia, Ogre
  • Interests:Sports, Sun, Friends, Travel, Computers and much more.

Posted 16 February 2006 - 09:30 AM

Hello. Thanks for tutorial, but it isn`t something special... Anyway, it`s ok!

#3 Tyssen

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,161 posts
  • Location:Brisbane, QLD

Posted 16 February 2006 - 09:38 AM

View PostAlbus Dumbledore, on Feb 16 2006, 12:10 PM, said:

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.

#4 Albus Dumbledore

    Nothing ventured, nothing gianed

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1,563 posts
  • Gender:Male
  • Location:Sacramento California
  • Interests:Allot of things, websites, coding, photography, my future
  • myCENT:73.26

Posted 16 February 2006 - 11:08 PM

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.

#5 DjLuki

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 447 posts

Posted 17 February 2006 - 03:09 AM

that can be done in html only..i dont see how that is php except that ure changing the index.php file thing..

#6 Tyssen

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,161 posts
  • Location:Brisbane, QLD

Posted 17 February 2006 - 06:43 AM

View PostDjLuki, on Feb 17 2006, 01:09 PM, said:

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.

#7 Albus Dumbledore

    Nothing ventured, nothing gianed

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1,563 posts
  • Gender:Male
  • Location:Sacramento California
  • Interests:Allot of things, websites, coding, photography, my future
  • myCENT:73.26

Posted 17 February 2006 - 06:58 AM

View PostDjLuki, on Feb 16 2006, 07:09 PM, said:

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
<?[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

#8 Tyssen

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,161 posts
  • Location:Brisbane, QLD

Posted 17 February 2006 - 07:04 AM

View PostAlbus Dumbledore, on Feb 17 2006, 04:58 PM, said:

but i think i am going to also test that out before i edit the post
Sure, check it out.

#9 bladeron

    Member [Level 1]

  • Kontributors
  • PipPipPipPip
  • 66 posts
  • Location:mumbai, india
  • Interests:chess

Posted 17 February 2006 - 11:42 AM

hey thx for that handy tip

i m used to editing every html file which i wanted to add a link or so but now there is no need to do that,
thx to your tutorial!

may be i should start learning php now..........:huh:

#10 tade

    Newbie [Level 1]

  • Kontributors
  • Pip
  • 15 posts

Posted 17 February 2006 - 02:51 PM

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.




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users