[Help] Webpages from database? menu

Shout-Out

User Tag List

Results 1 to 7 of 7
  1. #1
    AndreasG7's Avatar Member
    Reputation
    10
    Join Date
    Dec 2007
    Posts
    143
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Help] Webpages from database?

    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.

    {Display DB of sites is the thread, for reference}

    Thanks in advance

    [Help] Webpages from database?
  2. #2
    AndreasG7's Avatar Member
    Reputation
    10
    Join Date
    Dec 2007
    Posts
    143
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    138 views
    and not one reply!

    Come on?

  3. #3
    inzenir's Avatar Member
    Reputation
    9
    Join Date
    Aug 2009
    Posts
    52
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, there are more ways. I'll show you what's the simplest, some will be true code, some will be pseudo code.

    Links should be done like this:

    HTML Code:
    <a href="./index.php?display=main">Main</a>
    <a href="./index.php?display=pictures">Pictures</a>
    <a href="./index.php?display=news">News</a>
    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

  4. #4
    AndreasG7's Avatar Member
    Reputation
    10
    Join Date
    Dec 2007
    Posts
    143
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've already got PHP +SQL news and a lsit of the sites
    the sites online sometimes, Introduction seeeeee
    Just wanted a page for each website...

  5. #5
    inzenir's Avatar Member
    Reputation
    9
    Join Date
    Aug 2009
    Posts
    52
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

    Hope that helps at least a bit :P

  6. #6
    AndreasG7's Avatar Member
    Reputation
    10
    Join Date
    Dec 2007
    Posts
    143
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ha I only really wanted to because I thoguht it would make us seem more... proffesional lol.. in that business we need it...

    (BTW like the site? ;D)

    Thanks for your help, Im still learning PHP

  7. #7
    inzenir's Avatar Member
    Reputation
    9
    Join Date
    Aug 2009
    Posts
    52
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

    Sfings 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.

    Battle Lords 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:

Similar Threads

  1. [HELP]please read database problem
    By Kazard123 in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 06-15-2008, 01:42 PM
  2. Help with weird database problem
    By Xeneth in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 01-15-2008, 01:17 PM
  3. [help] Update Old Database to work for 2.3
    By jokerjokes in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 12-11-2007, 07:19 AM
  4. [help]Account error (Database error)
    By freshfish in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 10-29-2007, 09:28 AM
  5. A little Help plx from a PRO
    By Desus in forum WoW ME Questions and Requests
    Replies: 3
    Last Post: 06-07-2007, 12:14 PM
All times are GMT -5. The time now is 10:46 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search