how to replace included files

Posted on 2005-03-01
Medium Priority
Last Modified: 2013-11-18

I am working on modifying my client's project. I copied the full project folder to my system. It has hundreds of php files and files are included as (example) : include "/var/www/virtual/projectname/folder1/filename.php"

Since I am in windows environment, what is the best strategy to replace all the include statements as:
 include "projectname/folder1/filename.php"

Will : include "projectname/folder1/filename.php" work properly in my Windows system ? This is just for an example, Please note that I have many files that is having include to different files in different folders.

Thanks in advance for any replies.
Question by:sangeetha
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 13435683
get ultraedit.com and do a find replace in files? :) That is the fastest way I usually deal with these issues.

(there is a 30 day trial)

Expert Comment

ID: 13437018

$varPath = "/var/www/virtual/";

include $varPath . "projectname/folder1/filename.php";

Accepted Solution

BGMi earned 280 total points
ID: 13439220
You may download a free editor called "Crimson Editor", with which you will be able to open all your files and replace in all file at once the full path.

Your include statement will work both on Linux and Windows.  You could even write:

include "./projectname/folder1/filename.php";

And that way, you will never have problem on any OS.  An even better way may be using a $_SESSION variable if you are already using variable to specify the fullPath of your project.  But if you plan to do that, your user always have to pass by the "registration" page.  No problem if you are using a principal page like "index.php" in which you do all the include with a "page" like statement.  Anyway !  That's not the real problem, just a tip :-)

Have a nice day !
LVL 20

Expert Comment

ID: 13439518
forward slashing seems to work fine for the most part in my windows enviornment

Featured Post

WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question