Page 1 of 1

How to write php variable as string

Posted: Sun Feb 06, 2011 12:48 am
by ganesh_dabhade
I want to write the following code in index.php file

Code: Select all

<?php 
$curdir = basename(dirname(__FILE__));
require_once '../template/index.php';
?>
But the problem is when I create the file index.php, it writes as follows.

Code: Select all

<?php 
 = basename(dirname(__FILE__));
require_once '../template/index.php';
?>
the variable is eliminated.
Please help me solve this problem.

Re: How to write php variable as string

Posted: Sun Feb 06, 2011 4:31 am
by social_experiment
ganesh_dabhade wrote:...when I create the file index.php...
Do you refer to 'when i type it in my editor'?

Re: How to write php variable as string

Posted: Sun Feb 06, 2011 5:39 am
by ganesh_dabhade
I want to create one folder say 'newfolder' and also want to create a file called 'index.php' which should contain the code I specified in my above problem.