Who8MyFish Posted June 7, 2011 Share Posted June 7, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/238698-dynamic-page-url/ Share on other sites More sharing options...
KevinM1 Posted June 7, 2011 Share Posted June 7, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/238698-dynamic-page-url/#findComment-1226607 Share on other sites More sharing options...
matthew9090 Posted June 7, 2011 Share Posted June 7, 2011 there is a tutorial: part 1 part 2 part 3 Quote Link to comment https://forums.phpfreaks.com/topic/238698-dynamic-page-url/#findComment-1226610 Share on other sites More sharing options...
Who8MyFish Posted June 7, 2011 Author Share Posted June 7, 2011 epic. Thanks guys this is exactly what I'm looking for. Quote Link to comment https://forums.phpfreaks.com/topic/238698-dynamic-page-url/#findComment-1226625 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.