www.webdeveloper.com
Results 1 to 8 of 8

Thread: Too Many Files

  1. #1
    Join Date
    Feb 2003
    Location
    Aberdeen, Washington, USA
    Posts
    1,859

    Exclamation Too Many Files

    If you go to:

    http://kd7pyo.infinitypages.com/

    You will see that I have links in the upper right hand part of my page and they go to different pages of my site. I was wundering if it was possible to make it so you have a script with pre-defined info for each page and a div. What I want is when the user clicks on a link they will not go to a different page but, what will happen is the main content will change and nothing else. Just like div replace or something. You will have the pre-defined info for each page so like you will have a div for each page and when they click on one of the links it will exchange the content of the index for the content of the div the link is linked to. Ask me if you need any more details so you can get what I want. Is this possible? Please help.

    (Edit: I moved this from JavaScript to here. I want to do this with PHP.)

  2. #2
    Join Date
    Feb 2003
    Location
    Aberdeen, Washington, USA
    Posts
    1,859
    Here is something so you can get my idea better:

    <div#1=The content for page one go's here.>
    <div#2=The content for page two go's here.>

    The script would take what is on the page and replace it with one of the div's above. There would be a place on the page with place holders so the script knew where to put the div content. The links on my page would be linked to the php so the link would be like:

    <link#1=div#1>

    So say if you clicked the link that sayed "Home" and I wanted it to display div#1 for link "Home" then what would happen is it would take the content of div#1 and put it on the page within the place holders. I hope that helps you guys so you can help me! I'm sure you already figured it but the peices of code above do not work, oveously. Please see if you can help me out here. Thanks.

  3. #3
    Join Date
    Jun 2003
    Posts
    61
    Place this were you want the content:


    PHP Code:
    <?php

    $page
    [1] = "The content for page one go's here";
    $page[2] = "The content for page two go's here";

    print(
    $page[$id]);

    ?>

    Make your links like this:

    <a href="index.php?id=1">page 1</a>
    <a href="index.php?id=2">Page 2</a>

  4. #4
    Join Date
    Feb 2003
    Location
    Aberdeen, Washington, USA
    Posts
    1,859
    Code:
    <?php
    
    $page[2] = "The content for page two go's here";
    $page[3] = "The content for page three go's here";
    
    print($page[$id]);
    
    ?>
    <html>
    <head>
    <title>Test Page</title>
    </head>
    
    <body>
    Welcome to our page.<br>
    <a href="test.php?id=2">Page 2</a>
    <a href="test.php?id=3">Page 3</a>
    </body>
    </html>
    The code above is what I currently have. I changed the script a bit. I want the user to see "Welcome to our page" when they first enter that page and then when the click one of the links the "Welcome to our page" is replaced with the contents of whatever link they click on. Right now it just adds the contents of the links to the beginning of the "Welcome to our page" message. Here is the link so you can see what I'm talking about: http://kd7pyo.infinitypages.com/test.php. Thank you.
    Last edited by Jick; 07-04-2003 at 03:38 PM.

  5. #5
    Join Date
    Jun 2003
    Posts
    61
    Code:
    <html>
    <head>
    <title>Test Page</title>
    </head>
    
    <body>
    
    <?php
    
    $page[1] = "Welcome to our page";
    $page[2] = "The content for page two go's here";
    $page[3] = "The content for page three go's here";
    
    if(!$id) $id = 1;
    
    print($page[$id]);
    
    ?>
    
    <a href="test.php?id=2">Page 2</a>
    <a href="test.php?id=3">Page 3</a>
    
    </body>
    </html>

  6. #6
    Join Date
    Feb 2003
    Location
    Aberdeen, Washington, USA
    Posts
    1,859
    Ohh thanks. It works now. I had one more question. Is it possible to remove the (?id=2) it adds to the end of the url? Before I click on a link it looks like this: (http://kd7pyo.infinitypages.com/test.php) but after I click on one it looks like this: (http://kd7pyo.infinitypages.com/test.php?id=2). Is there any way to fix this? Thanks for your help!

  7. #7
    Join Date
    Jun 2003
    Posts
    61
    Then you would have to use a form and have images as links or something instead. (I think). The script have to know witch text to show, and the only way to send the variable with a link is to place it in the url.

  8. #8
    Join Date
    Feb 2003
    Location
    Aberdeen, Washington, USA
    Posts
    1,859
    If anybody understands my question please help me out! I want it to show: (http://kd7pyo.infinitypages.com/test.php) and not: (http://kd7pyo.infinitypages.com/test.php?id=2). I'm sure there is a way to remove the thing on the end of the url and it still do what I need, but I'm just not sure. Thanks for any help anybody can provide.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles