Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New Coder
    Join Date
    Apr 2007
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    file.php?page=whatever

    Hi,

    Im noticing quite a bit of websites have urls like index.php?page=23241

    Is this an example of a database driven website? Ive tried searching google for this page=whatever method but dont know how to word the search. What is this method called?

    Also, I see some where there is a content area, when you click another link that area changes but the areas around it seem to stay exactly the same like header , side menu + footer. What is this method? Include?

    Thanks for any info you can provide to help me

    Thanks

  • #2
    Regular Coder GSimpson's Avatar
    Join Date
    Aug 2006
    Location
    New Zealand
    Posts
    268
    Thanks
    9
    Thanked 0 Times in 0 Posts
    doesn't have to be database but could very well be. And yes it could very well have the variable in the url (?id=34343) and then going include($id);

    It is a very smart way of doing things. Much better for the manager aswell.

  • #3
    Regular Coder croatiankid's Avatar
    Join Date
    Jan 2006
    Posts
    665
    Thanks
    1
    Thanked 12 Times in 12 Posts
    Those are most often $_GET variables.

  • #4
    New Coder
    Join Date
    Apr 2007
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes, I like the looks of it very much. Tidy and professional looking.

    Which method do you use? Im going to be making a basic introductory website for a company soon and just looking at ways i could build it. Which way would you guys do it?

    I think ill do that index.php?page=about

  • #5
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Quote Originally Posted by mike_tw View Post
    yes, I like the looks of it very much. Tidy and professional looking.

    Which method do you use? Im going to be making a basic introductory website for a company soon and just looking at ways i could build it. Which way would you guys do it?

    I think ill do that index.php?page=about
    If you wanna keep all the content in the same page, this method may be suitable

    PHP Code:
    if($_GET['page']=='home')

    Code:
    <div class="content">
    HOME CONTENT
    </div>
    PHP Code:
    }
    else if((
    $_GET['page']=='about')

    Code:
    <div class="content">
    ABOUT CONTENT
    </div>
    PHP Code:
    }
    ...............
    ..............
    else

    Code:
    PAGE ERROR
    PHP Code:

    Last edited by abduraooft; 06-07-2007 at 10:10 AM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #6
    Regular Coder GSimpson's Avatar
    Join Date
    Aug 2006
    Location
    New Zealand
    Posts
    268
    Thanks
    9
    Thanked 0 Times in 0 Posts
    yep that's good. Or....
    Code:
    $mypage = "sources/" . $_GET['page'] . ".txt";
    include($mypage);
    your directory could look like:

    index.php
    style.css
    sources/
    home.txt
    about.txt

    and so on, so on. But that's just cause I don't like having a lot of coding.
    Last edited by GSimpson; 06-07-2007 at 12:26 PM.

  • #7
    New Coder
    Join Date
    Apr 2007
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    could i still use html tags in that .txt file? For images and such

  • #8
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,469
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    PHP Include simply takes whatever file you want to include and sticks
    it in the same spot as the "Include" ... all text verbatim. So, you can use
    html, css, whatever. This all happens on the server before your page is
    sent to the user.

  • #9
    Regular Coder croatiankid's Avatar
    Join Date
    Jan 2006
    Posts
    665
    Thanks
    1
    Thanked 12 Times in 12 Posts
    It looks "cool", but the thing is, it's actually much better to use a / architecture. This puts keywords in your URL (for SEO), and is human-readable.

  • #10
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,469
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    Have a main page (index.php), and then, all other pages can
    be one dynamic PHP script, example: page.php?p=2 or page.php?p=13

    Those variables will determine which "includes" will be used for
    the content of the pages. See example below ... mouse-over the
    links in the menu, notice the URL. The actual menu can also be a
    PHP script, so you only need to edit one file if you add more navigation
    items (and the navigation script is also a PHP include).

    http://www.palosantodesigns.com/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •