Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

how to replace included files

Posted on 2005-03-01
4
Medium Priority
?
190 Views
Last Modified: 2013-11-18
Hai,

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.
0
Comment
Question by:sangeetha
4 Comments
 
LVL 5

Expert Comment

by:aksteve
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)
0
 

Expert Comment

by:vochkarik
ID: 13437018
Try

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

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

Accepted Solution

by:
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 !
0
 
LVL 20

Expert Comment

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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
These days socially coordinated efforts have turned into a critical requirement for enterprises.
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…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

564 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