Frage

how can I develop a multipage website? should I develop all other linked pages in same way I created the homepage? I am intending to develop a PHP website for a store and I wanna link each products to their individual pages. but since there are lots of products its kinda tedious to create individual pages each product.

SO Instead of creating many different pages for each product can I create one dynamically changing page and use it for all the product links?I mean can I create a single page whose basic layout will always remain the same but only few content will change in accordance to the selected product.

War es hilfreich?

Lösung

You can implement a single page, lets call it product.php. Then you can use theGET method to dynamically call the page. It would look like this product.php?id=1 where id=1 is the primary key of the product in a MySQL table. And you could fetch various products just changing the id in url.

Andere Tipps

Yes, you can do that; its very common to create a page that dynamically changes.

For example, you can create a php file that takes care of the header portion of the site, then simply call it within your index.php page as so:

<? show_header(); ?> 

Take a look at this website to get started! http://www.techiwarehouse.com/engine/d3bf2317/Building-Dynamic-Web-Pages-with-PHP

The site i provided is great to start playing with PHP, it provides good information with easy to follow steps.

Another great resource is the IBM PHP PDF: http://www.ibm.com/developerworks/linux/tutorials/l-php/l-php-pdf.pdf

Finally my personal favorite, "Practical PHP & MySQL" PDF: http://utopia.duth.gr/~stavtran/vivlia/PHP_and_MySQL.pdf


Its also worth noting that there are Content Management Systems out there (CMS) such as Joomla, Worpress which are very easy and powerful, a lot of these CMS's allow for plugins which will make your life so much easier. If your goal is to simply have a solid working e-commerce website that sells products and you don't really wish to do hardcore php,mysql,javascript,css,html,jquery coding ;-)

Content Management Systems

  1. http://wordpress.org/
  2. http://www.joomla.org/

You can create multipage PHP website using following method:

1) Create a folder and name it “my_first_php_website”.

2) Create following folders in your “my_first_php_website” folder.

“images”, “includes”

3) Create following folders in “includes” folder.

“css”, “js”

4) Create following files in “my_first_php_website” folder.

-> “index.php”, “header.php”, “footer.php”, “sidebar.php”, “nav.php”, “404.php”, “about.php”, “functions.php”

Create following file in “css” folder.

-> “style.css”

Put your website logo in “images” folder.

-> “my_website_logo.png”

5) Now follow step by step tutorial to create your first website using PHP.

Source: Web Designer Tricks

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top