Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7
  1. #1
    Senior Member toadeny's Avatar
    Join Date
    May 2003
    Location
    Wellington, New Zealand
    Posts
    188
    Member #
    1426
    just wondering, i have seen a site a while back, wish i knew the address still, that had pages like linked like this

    ......./index.php?pageid=10

    or something like that. does anyone know how i could do this, bascially a standard page that when u click on a link whatever it is , goes to
    index.php&pageid=10 or something like that. I dunno, i guess this is done by a database or by using ifs and else statements ?

    can anyone suggest me a code, or show me a site for this ?

    cheers

  2.  

  3. #2
    Senior Member skrlin's Avatar
    Join Date
    Apr 2003
    Location
    Illinois
    Posts
    562
    Member #
    1063
    You can do it through either a database (which php offers functions to access many) or through a switch or if/else statements.

    Here's an example of what you are refering to, something I put together a couple weeks ago (still not done, but that's beside the point) and is done through a MySQL db:

    http://www.skrlin.com/Testing/new/site/prac.php
    - Brian

  4. #3
    Junior Member Cinders117's Avatar
    Join Date
    Mar 2003
    Location
    Kent, OH
    Posts
    19
    Member #
    833
    yeah, you can use a database, or includes and stuff.
    you could build your template and have include files and then have like
    include "page$pageid.php"; and that'd get all the info to fill in that page
    or from a DB
    "select * from table_name where pageid='$pageid'"
    I found the article about building database driven sites by Kevin Yank of Sitepoint.com very helpful

  5. #4
    Senior Member james's Avatar
    Join Date
    May 2003
    Location
    Melbourne, AUSTRALIA
    Posts
    364
    Member #
    1352
    OK, one implementation is, you have the pages you want to index...

    about.html, contact.html, help.html, etc then in php:

    PHP Code:
    $PagesArray = array("","about.html""contact.html""help.html")

    if (
    $pageid == 0)
      
    //Do home page
    else {
      echo 
    '<script lang="javascript">window.navigate("';
      echo 
    $PageArray($pageid);
      echo 
    '"); </script>';

    Which should generate (for pageid=1)
    <script lang="javascript">window.navigate("about.html"); </script>

    Which should automatically redirect the user to the about.html page.
    James H
    Home Page · Mars Page · www.fihsf1.net (formerly www·fihs·net)

  6. #5
    Senior Member james's Avatar
    Join Date
    May 2003
    Location
    Melbourne, AUSTRALIA
    Posts
    364
    Member #
    1352
    A better way, which as a side effect will hide the html pages is:

    PHP Code:
    $PagesArray = array("","about.html""contact.html""help.html")

    if (
    $pageid == 0)
      
    //Do home page
    else {
      require_once 
    $PagesArray[$pageid];

    This will read in the page as a whole.

    You'll need to do some checking of $pageid. First if (!isset($pageid)) $pageid = 0;, then if ($pageid>3) $pageid = 0;.
    James H
    Home Page · Mars Page · www.fihsf1.net (formerly www·fihs·net)

  7. #6
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    toadeny, if your problem has been resolved, you should reward the TD you offered in this thread or cancel the offer if it hasn't. Don't leave the reward outstanding.

  8. #7
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    Some problems can still be resolved. Some people may search google for something and find a thread that they can answer. I noticed when looking at one of my posts this morning that somebody just registered to answer my 1 question then has never posted again.
    JR


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:50 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com