I quite often see websites which are like:
index.php?12
well I was wondering how the hell to do this?
Because I don't really feel like making a new page for every new website I create in my portfolio, and I think if it did it automatically it would save me a lot of time...
I was just wondering how to go about this.
Also I tried asking on PHP freaks but they aren't very useful to PHP newbs.
{[Only registered and activated users can see links. ] is the thread, for reference}
Thanks in advance
Donate to remove ads, get your "DONATOR title, and get access to the MMOwned community's elite Shoutbawx.
Now, i suppose you have divided page into several <div>s where menu and stuff will be displayed.
Now, you see those "display" in the links, eh? Now we'll catch those in php
PHP Code:
if (isset($_GET['display'])) //we don't want to get warnings in php :P $display = addslashes($_GET['display']); //we don't want broken pages because someone decided to change the URL manually :P else $display = "";
switch($display) //here we take proper page from the database called "pages" { default: $query = 'SELECT * FROM pages WHERE name = "main"'; break; case "main": $query = 'SELECT * FROM pages WHERE name = "main"'; break; case "pictures": $query = 'SELECT * FROM pages WHERE name = "picture"'; break; case "news": $query = 'SELECT * FROM pages WHERE name = "news"'; break; } $result = mysql_query($query); $row = mysql_fetch_array($result); //now we simply take stuff from database array and put to HTML form echo '<div class="header">HEADER STUFF</div>'; echo '<div class="menu">'.stripslashes($row['menu']).'</div>'; echo '<div class="content">'.stripslashes($row['content']).'</div>'; echo '<div class="footer">FOOTER STUFF</div>';
Now, if you want to put your page to database you'll still need to know some HTML stuff. And adding news to your web page would still require aditional HTML and PHP forms.
That was the most simple template that would have to be updated a lot to be really useful in RL. For my news scripts require another database table where news are stored, because usually you need news title, date, content, some links and more to make an "article".
Pictures and galleries, for those i've used 2 database tables. One with stored gallery names and other with indexed pictures, in another script i've used 3, one for names and information about gallery, pictures were indexed in special folders, so i didn't need one for that and 2 more tables for comments and ratings.
Making a web page isn't all that easy as it seems, specially if you want job well done.
If you require more help, well, just post, i think i'll be quite regular visitor in this section :P
I've already got PHP +SQL news and a lsit of the sites
the sites online sometimes, [Only registered and activated users can see links. ] seeeeee
Just wanted a page for each website...
well, yet as far as i see you actually just said it the wrong way :P Such pages don't store information in the database, but on separate pages, those are simply included when needed. What's the good thing of that? Well, basically you can have header and footer at the same exact place in the code all the time.
The other way is the standard that page is named like news.php, index.php and stuff, but have included header and footer. No big difference and i make pages as i please, sometimes this way sometimes that way. Including header and footer instead of including the page might be easier to update as you only have to change menu (which is usually stored in separate file) and add a file. If you have pages named via $_GET (?page=something) then you have to update main page, usually index.php, menu AND you have to add another page.
well, the page is well, good start to begin from. The only thing i would change is that intro loading. If you want to be professional, your pages have to load fast, not that i have to wait 1 minute on 5MB connection for a lousy animation of water and agree terms in front.
[Only registered and activated users can see links. ] was my latest work. It took me a month to build it and half a year of waiting for designs to come on the end more or less i re-designed those on my own. It's in Slovenian language, so i'm not sure you understand it, but it's fast, it has innovative gallery, it's easy to upgrade. Well, it has everything a club would need.
About colors, don't ask me, club owner wanted those :P
Now, for the design and professionalism. Make a decision, If you're good with designing pages but you dislike the programming part, or it's your weak spot, try to sell designs only, and don't give a shit about programming. Why would you like to be busy with something that limits your creativity, leave that to those who prefer programming than design.
[Only registered and activated users can see links. ] may one day actually become a game. I'm a programmer and you can see that on the first sight, my design is, i'll say minimalistic, other will say lame. The register and stuff works, ATM fighting doesn't i'm more or less spending my time on making the admin panel fast and efficient. But that's not important, what important here is, well, i don't really bother myself with design as i know it'll be bad In same way someone that's not a programmer shouldn't bother himself with programming. Ask someone to do it, or pay him, but don't waste your time if you have more important stuff... On the other hand...
If you would like to learn programming, well, i have two wonderful pages for you:
[Only registered and activated users can see links. ]
[Only registered and activated users can see links. ]