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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 17

Thread: Question

  1. #1
    New Coder
    Join Date
    Apr 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Ok, so I'm using

    Code:
    <?php  
        
     if(isset($page))   {  
         include($page.'.php');  
      } else {  
         include('maps.php');  
      }    
     
    ?>
    this script.

    and this

    Code:
    <a href="http://www.air.urlq.net/index.php?id=main.php">here</a>
    is how I link to other pages.

    What I want to do is instead of having index.php (afetr www.air.urlq.net)
    Code:
    <a href="http://www.air.urlq.net/index.php?id=main.php">here</a>
    I'd like to have something that means 'the current page'

    E.G

    I have two designs. www.air.urlq.net/test.php and www.air.urlq.net/pinkndex.php

    When on the pink design if you click a link to main.php it will go to www.air.urlq.net/index.php?id=main.php

    So it changes back to the orange design

    I COULD change all the links that i will have in the future (i aint finished the site yet) to www.air.urlq.net/pinkndex.php?id=main.php

    But this will takes ages and I'll have to update two seprate page evrytime i update. So what I really need is a php term (or summit ) that i can put www.air.urlq.net/[HERE]?id=main.php
    That will mean 'the current page]

    Any Ideas?

    Very much appriciated
    Rich
    Last edited by AirGuitar; 04-27-2004 at 06:59 PM.

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Welcome here!

    I didn't realy understand what you want to achieve nor do i understand the logic behind these filenames in the querystring, but to do this
    that i can put www.air.urlq.net/[HERE]?id=main.php
    That will mean 'the current page]
    you can use
    $_SERVER['PHP_SELF'] to get the curent files url
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #3
    New Coder
    Join Date
    Apr 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, thanks

    but what is it? www.air.urlq.net/$_SERVER['PHP_SELF']?id=main.php

    ? that doesnt seem to work.

    Thanks for helping me

  • #4
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No. You can build such an url like

    echo ('<a href="' . $_SERVER['PHP_SELF'] . '?id=main.php" title="whatever">next page</a>');

    But the $_SERVER['PHP_SELF'] is always the filename of the page the link is in then. I don't know what you are trying to do here.

    You can not change the displayed url simply with PHP. You need to use mod-rewriting or something. The are other possebilitys but i'm not going to post about them for obvious reasons.
    Last edited by raf; 04-27-2004 at 10:15 PM. Reason: missing closing quote
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #5
    New Coder
    Join Date
    Apr 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    http://www.air.urlq.net/pinkndex.php

    Code:
    <html>
    <title>hi</title>
    </head>
    
    <body>
    <p align="center">bogus</p>
    <p align="center"> echo ('<a href="' . $_SERVER['PHP_SELF'] . '?id=main.php" title="whatever">next page</a>);
    </body>
    
    </html>


    is that right, i doesn't work

  • #6
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you need to put your code in PHP tags

    PHP Code:
    <html>
    <title>hi</title>
    </head>

    <body>
    <p align="center">bogus</p>
    <p align="center"><?php echo ('<a href="' $_SERVER['PHP_SELF'] . '?id=main.php" title="whatever">next page</a>'); ?>
    </body>

    </html>

  • #7
    New Coder
    Join Date
    Apr 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    lol, I am very very n00b at php

    I'll test it now, ty for you help raf and missing score
    Last edited by AirGuitar; 04-27-2004 at 08:52 PM.

  • #8
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Everyone is new once

  • #9
    New Coder
    Join Date
    Apr 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts


    Ok, I feel im getting really close to the result i want, and you guys are great helping me

    When i click the link (www.air.urlq.net/pinkndex.php, it doesnt change to the text on main php, www.air.urlq.net/main.php


  • #10
    New Coder
    Join Date
    Apr 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Could it be the way the link is written, is wrong?

  • #11
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Could be. I haven't got a clue what you want to do.
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #12
    New Coder
    Join Date
    Apr 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    AHHHH_WOOOOO_HOOOOOOOO

    yea! THANK YOU SO MUCH, i dno what i did, but it works GREAT NOW

    You guys have been fantastic

    Thank you sooo much



    what i've achieved is the ability to change bewteen multipal designs and for users to be able to stay with that design through out their stay

    This probably isn't the right way to go about it, but it works great.

    Raf, missing-score, you've been vvvvv helpful, can't thank you enough

  • #13
    Regular Coder
    Join Date
    Apr 2004
    Posts
    164
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    Reading this thread, I havent got a clue whats going on!

    What do you want to do?

    Why dont you make 2 sub directorys and have a site in each?

  • #14
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    AirGuitar,

    Glad you got it running.
    If you wan't the user to choose a design, but use the same content inside each design, then dynamically setting the stylesheet would probably be a better sollution.
    Here's a recent thread about that http://www.codingforums.com/showthread.php?t=37489
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #15
    New Coder
    Join Date
    Apr 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hm, don't have a clue bout style sheets.

    Oh, 1 quick question

    <?php echo ('<a href="www.air.urlq.net/pinkndex.php?id=(current content).php"

    What would that be


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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