pappakaka Posted February 14, 2011 Share Posted February 14, 2011 I'm sorry if this maybe is an obvious understanding for you, but i can't understand one thing with URL's. If i create my page called "index.php" and put it in a folder called "folder" then the URL in the address bar would be: http://www.website.com/folder/index.php But then i deside to add a few more pages with like next and previous links to scroll through them. I put those pages in a folder called "pages" within the folder "folder". Now the URL's would something look like this! http://www.website.com/folder/pages/page1.php http://www.website.com/folder/pages/page2.php etc... Thats the only way i know URL's are created and look like. But now too my question.. This is a few URL's i've seen on a site and every URL leeds to a new page but there is no slashes indicating new folders? How do you do that? Here is some examples of how the URL's could look like: http://www.website.com/index.php http://www.website.com/index.php?p=new http://www.website.com/index.php?p=new&page=121 http://www.website.com/merge.php http://www.website.com/merge.php?id=20381 And every URL was a comnpletly new page? Quote Link to comment https://forums.phpfreaks.com/topic/227625-how-do-the-urls-work-do-they-use-php/ Share on other sites More sharing options...
cyberRobot Posted February 14, 2011 Share Posted February 14, 2011 Links like http://www.website.com/merge.php?id=20381 tend to be used for database driven websites. The page "merge.php" is used as a shell which loads the page content using the "id" variable. Quote Link to comment https://forums.phpfreaks.com/topic/227625-how-do-the-urls-work-do-they-use-php/#findComment-1174026 Share on other sites More sharing options...
floridaflatlander Posted February 14, 2011 Share Posted February 14, 2011 It's -http://www.website.com/folder/index.php <- your main page for the folder (if you have one) -http://www.website.com/folder/page1.php -http://www.website.com/folder/page2.php and so on You (or at least I do) build these types with a get statement and guery -http://www.website.com/index.php?p=1 -http://www.website.com/index.php?p=2 PS as cyberrobot said, pages like -http://www.website.com/index.php?p=1 pull info from the database Quote Link to comment https://forums.phpfreaks.com/topic/227625-how-do-the-urls-work-do-they-use-php/#findComment-1174027 Share on other sites More sharing options...
trq Posted February 14, 2011 Share Posted February 14, 2011 This is the basics of dynamic content. Generally, you pass data through the url, this data is used within the page then to identify some content (generally stored in a database) and display it. A simple example. <?php if (isset($_GET['id'])) { $id = $_GET['id']; } else { $id = 1; } echo "This is page number $id<br />"; echo "Click <a href='?id=" . $id+1 . ">here</a> to see page number " . $id+1; Quote Link to comment https://forums.phpfreaks.com/topic/227625-how-do-the-urls-work-do-they-use-php/#findComment-1174029 Share on other sites More sharing options...
pappakaka Posted February 14, 2011 Author Share Posted February 14, 2011 Oh, ok now i see. Thank you! Will try to do a test website like that.. Quote Link to comment https://forums.phpfreaks.com/topic/227625-how-do-the-urls-work-do-they-use-php/#findComment-1174032 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.