nonphixion Posted January 17, 2007 Share Posted January 17, 2007 Hi all,First post here, thank you all for this great resource, it's been of great use over the past few days :) I've tried searching for the subject-mentioned item but it doesn't do well as it just brings back everything with php in it ;)[b]My question is[/b], I have a main page (like most of you :) ) which has a lot of structure (through CSS) and I'd like to keep it as simple as possible when I create a new page. I've seen that some sites use www.domain.com/page.php?do=randompage function to pull up pages which I assume only contain the least information required (i.e. just content). Could someone please be kind enough to explain the structure of this or link to the correct tutorial (I don't know what keyword I need to search for it).Many thanks in advance :) Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted January 17, 2007 Share Posted January 17, 2007 I dont quite understand what you are trying to achieve here, but do=randompage is done by sending a variable through the url, if you wish to use this to point to the name of your css file, do:$cssfilename = $_GET['css'];then you would be able to include your css file by adding its name at the end:test.php?css=design.csssomething like this...Ted Quote Link to comment Share on other sites More sharing options...
metrostars Posted January 17, 2007 Share Posted January 17, 2007 The do= is a URL variableand that value is set to randompage in this example.So all u do it place this code where you want the page to be echoed.It's a bit like an iFrame in PHP<?php $do = $_GET['do'];if($do == "") {$do2 = "main";} else {$do2 = $do;}include $do . ".php";?>That should work sorry if i missed something, UI'm quite busy. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted January 17, 2007 Share Posted January 17, 2007 when you have ?foo=bar in the url that is passing a variable to a script.So in the example case www.domain.com/page.php will receive a variable called 'do' and that var is set to 'random'.Somewhere in the script will probably be a switch statement like this:[code]<?phpswitch ($_GET['do'){ case 'random': // do the random stuff break; case 'this': // do this break; case 'that': // do that break; default: // do this if all other cases unmatched}?>[/code] Quote Link to comment Share on other sites More sharing options...
nonphixion Posted January 17, 2007 Author Share Posted January 17, 2007 Thank you all for the quick response. My apologies for not explaining myself better, should have provided an example:http://www.totalbf2.com/ On the left nav the links will go through the same php file but possibly link to an html one? That's what I'm looking to understand as it seems it's a time saving way of building a site with many pages.I will try out what's been posted to see if it's what I'm aiming for, many thanks again :) (I will revert) Quote Link to comment Share on other sites More sharing options...
linuxdream Posted January 17, 2007 Share Posted January 17, 2007 It's simply used to fill the main content portion of the page around head and footer templates (in the URL you provided anyway). Expanding on what the others were saying. The value of the ?do= is probably a filename or other signifier in the site that contains the main page contents. It's basically an easy way to manage template and content through PHP.For instance, you have your main page:[code]<html><body>Hello everyone!!!! You are now on page:<?php//Used to display main content within template framework$contentfile = $_GET['do'] . ".php";include_once('$contentfile');?><br />Thanks for visiting</body></html>[/code]B Quote Link to comment 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.