View Full Version : Question

04-27-2004, 06:52 PM
Ok, so I'm using


if(isset($page)) {
} else {

this script.

and this

<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)
<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'


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 :D) that i can put www.air.urlq.net/[HERE]?id=main.php
That will mean 'the current page]

Any Ideas?

Very much appriciated

04-27-2004, 08:04 PM
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

04-27-2004, 08:10 PM
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 :D

04-27-2004, 08:25 PM
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.

04-27-2004, 08:36 PM


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



is that right, i doesn't work

04-27-2004, 08:41 PM
you need to put your code in PHP tags :)


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


04-27-2004, 08:43 PM
:eek: lol, I am very very n00b at php

I'll test it now, ty for you help raf and missing score :thumbsup: :D

04-27-2004, 08:45 PM
Everyone is new once :)

04-27-2004, 08:52 PM

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

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

:eek: :D

04-27-2004, 10:04 PM
Could it be the way the link is written, is wrong? :rolleyes:

04-27-2004, 10:16 PM
Could be. I haven't got a clue what you want to do.

04-27-2004, 10:28 PM

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

You guys have been fantastic :D :thumbsup:

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 :D

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 :D

04-27-2004, 10:33 PM
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?

04-27-2004, 10:46 PM

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

04-28-2004, 10:40 PM
Hm, don't have a clue bout style sheets.

Oh, 1 quick question :D

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

What would that be :D :confused:

04-28-2004, 11:33 PM
What is
(current content)
supposed to be ?

04-28-2004, 11:34 PM
main.php maps.php anypage.php

It's the content of the page, inserted with this script