Jump to content

dynamic page & URL


Who8MyFish

Recommended Posts

So I have been avoiding this for some time but it seems I can dodge this no longer haha. I need to be able to create pages dynamically and give each page it's own URL. I'm not really looking for a lesson here but if someone could point me in the direction of some reading materials or at least tell me what i should be looking for I could probably find them myself.

 

Let me explain...

 

So I built a site for a chain of antique malls in the mid west. I built a page for managers and vendors so they could easily upload images and post items they are trying to sell to the companies web site.

 

I use a SQL database and a WHILE LOOP to display the contents of the database on the main page and am currently trying to incorporate a Facebook "like" button for each and every item on the page.

 

Currently every item listed in the database is displayed on Shopping.php

I need the server to be able to create a page with a unique address for each item in the database so that the "like" buttons don't all link back to the Shopping.php page.

 

What I am imagining is something like "/Shopping.php?item=0001" that will link to a page dedicated to that one single item.

 

Thanks for your time.

Link to comment
Share on other sites

The easiest way to do it is to fill a template with the data retrieved by the server.  That's how the pros do it.  Stores like Amazon don't have individual pages for each item they sell.  Rather, they have a generic template which they fill with a particular item's info.

 

shopping.php?item=0001 should essentially be something along the lines of (most general psuedo-code possible):

 

if isset($_GET['item']))
{
   // query database for item based on the GET value passed in.
   // include item template, which will anticipate and display that info
}

 

That said, you'd probably be better off using a MVC framework for this, which would help automate and organize the process for you while making everything more extensible in the long run. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.