...

View Full Version : Question



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


<?php

if(isset($page)) {
include($page.'.php');
} else {
include('maps.php');
}

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

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

Any Ideas?

Very much appriciated
Rich

raf
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

AirGuitar
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

raf
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.

AirGuitar
04-27-2004, 08:36 PM
http://www.air.urlq.net/pinkndex.php



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



:confused:

is that right, i doesn't work

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


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

AirGuitar
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

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

AirGuitar
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

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

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

AirGuitar
04-27-2004, 10:28 PM
AHHHH_WOOOOO_HOOOOOOOO

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

:D

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

cragllo
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?

raf
04-27-2004, 10:46 PM
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

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

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

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

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


<?php
$id=basename($id);
if(!$id)
include("mypage.php");
else
include($id);
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum