Tag Archive for 'Pages'

Web Development: Trick to write your web pages.

This is a beginners level article for those who have recently started web development. If you are already pretty good at including pages to another then this article isn’t for you you can skip it :).

What we are about to learn here can also be done in HTML frames, but Frames generally a not-so-good reputation in the web development world. Not that frame is bad, it just isn’t as efficient. Frames basically connect two pages together, put them together and then print them out to the user. Also the code for frame is longer, and complicated as compare to what I am going to cover here. <hi>

The reason to why I wrote this article is because I have been questioned a lot lately regarding how to reduce the stress of writing all those html codes in web pages. Therefore a great way of doing is using a simple php code. PHP (Hypertext Preprocessor) is a scripting language that gives programmers the ability to write dynamic pages as well as dynamic content for a website. Ofcourse to use PHP code your host/server must have php installed (Not a big problem now adays, almost a lot of host comes with php installed).

Lets say you have a Header.html that covers the header content of the web page, such as banner, top navigation and perhaps ads. And you have Footer.html that is basically your navigation menus and footer notes. The best method to use is the simple php code. You do not need the knowledge of PHP to do the following, I’ll explain how the code works but it is not required, as long as you use it properly.

  1.  
  2. <?php
  3.  include ("Header.html");
  4. ?>
  5. Your Page content here.
  6.  
  7. <?php
  8.  include ("Footer.html");
  9. ?>

Then if you view your page, it will automatically show the header and footer files. If you want this work you must save your pages as .php file not .html.

What the code above does is it uses a php function called include which basically includes the content of another file within the current file. It takes one parameter and that is a string of the file’s path. If the header file was inside a folder it would be something like this: incldude (”FolderName/Header.html”); and remember to put the brackets as well as the semicolon. And end the php script tag with ?> so the program can understand your code.

Bookmark this article! [?]

TechnoratiDiggDel.icio.usNewsvineFacebookBlogmarksFurlBlinkbitsBlogLinesYahooDiigoSlashDotBuddymarksGoogleFarkRedditStumbleUpon