Jump to content

Recommended Posts

OK, I have to directories, Uni1 and Uni2, I want any changes I make in uni1 to also be made in uni 2.

 

So I have I file called index.php in the root of uni1, in uni2, in the root I have a file called index.php with this code.

 

<?php
//First lets find out what file this is
$file = $_SERVER["SCRIPT_NAME"];
$parts = Explode('/', $file);
$file = $parts[count($parts) - 1];

//Now lets list the possible file paths
$root = "../uni1/";
$admin = "../../uni1/admin/";
$converter = "../../uni1/converter/";
$css = "../../uni1/css/";
$db = "../../uni1/db/";
$images = "../../uni1/images/";
$includes = "../../uni1/includes/";
$functions = "../../../uni1/includes/functions/";
$includes = "../../uni1/install/";
$languagefr = "../../../uni1/language/fr/";
$scripts = "../../uni1/scripts/";
$OpenGame = "../../../uni1/templates/OpenGame/";

//Now lets decide the path (This is the only bit that needs editing)
$path = $root;

//Now lets create the entire path
$show = $path . $file

//And finally lets display the file
include '$show';
?> 

 

however when I run it I get this error

 

Parse error: syntax error, unexpected T_INCLUDE in /home/www/uogame.co.cc/uni2/test.php on line 28

 

Line 28 is...

 

include '$show';

 

If anyone can help I would be grateful. From what I can work out my self, the problem is that it doesn't like including a variable.

wow, thansk for the quick responce

 

Thats fixed it

 

The 's where there because before it had brackets and i just changed them, I didn't think there was a difference between ' and "

 

everything inside a single quote ' ' is interpreted literally.  Variables and escape chars like \n for new line will echo out like you meant to write the name, not the value or instruction behind it.  A common use for this is say...giving code examples. 

 

everything in a double quote " " is interpreted figuratively.  PHP will recognize that when you put $blah you mean to put the value of $blah not the name of the variable.  Or if you do like \n PHP knows that you mean to make a new line. 

ok its worked when i tested it with jsut an echo, but when i tried it and put it into allt eh files I got this

 

Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 3840 bytes) in /home/www/uogame.co.cc/uni2/common.php on line 28

 

Dunno if its related but the mysql database is limited to 16mb

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.