Page 1 of 1

How to link to files in a directory?

Posted: Thu Mar 23, 2006 4:56 pm
by davidprogramer
Ok. The following would work but I can't pass globals this way:

Code: Select all

<a href=modules/League/includes/file.php></a>
This however is what I need:

Code: Select all

<a href=modules.php?name=League&file=includes/file.php&variable=value></a>
or something similar, how would I go about doing this?

Posted: Thu Mar 23, 2006 5:06 pm
by feyd
You're trying to include a file based on URL variables?
Useful Posts wrote:• Proper use of $_GET with includes: $_GET and include

Posted: Thu Mar 23, 2006 5:11 pm
by davidprogramer
no, I mean, well...maybe...

I am trying to pass variables in an URL to a different page, and $GET them on the destination.

I can't use include(file.php) because I still wont be able to pass variables.


This:

Code: Select all

echo "<td nowrap><center><a href=javascript:popUpPermissions('modules.php?name=League&file=includes/clan_hq/edit_permissions.php&rank=$i')>[ Edit ]</a></center></td>";
doesnt work.

Posted: Thu Mar 23, 2006 5:19 pm
by feyd
You can "pass" variables to another script you include.

Code: Select all

// one.php
$foo = 'hi!';

include 'two.php';

Code: Select all

// two.php

echo $foo;

Posted: Thu Mar 23, 2006 5:26 pm
by davidprogramer
But it is going to be a popup, it wont be in the same page.

Posted: Thu Mar 23, 2006 5:49 pm
by feyd
modules.php can include "edit_permissions.php" passing any other variables it has along with it. That's what it appears you're building. However I'd recommend not being able to pass directory tree information in the query.. maybe a coded name or something.

Posted: Thu Mar 23, 2006 5:55 pm
by davidprogramer
Yeah, I'll encrypt all the variables. My only problem is getting the variables from page1 to popuppage2. :? If I include it, wouldnt that just put popuppage2 inside page1?

Posted: Thu Mar 23, 2006 6:03 pm
by feyd
You're not including it on the current page. You're including the file on the page the popup will call, modules.php.

Posted: Thu Mar 23, 2006 6:22 pm
by davidprogramer
Now im confused lol. The popup wont call any other pages. I am going to put scripts on the popup. The scripts will depend on one variable passed from the first page. I sort of understand what you are saying, but how would I include the page and get the variable without running the page that the variables are on?

Posted: Thu Mar 23, 2006 6:28 pm
by feyd
your popup is referencing a page, modules.php. It's being sent a get variable "file" that references another page.

Posted: Thu Mar 23, 2006 9:51 pm
by davidprogramer
maybe i dont understand what you mean by include. The only include I know is :

Code: Select all

include("file.php");
which would call file.php, but would also run it right there on the spot.

Is this the same include you are talking about?