Copy Reference function inserts domain/relative-path

Hello,

i don't know why but my phpstorm (7.1.3) suddenly inserts domain.com/assets/images/icon.png instead of assets/images/icon.png when i use the "copy reference" function. I use the codigniter framework - perhaps it has to do with that? Is there any setting  i can adjust related to the copy reference function in php storm?

I have a base href set in my header templates, so the relative path would be invalid. But the problem also occurs in my body template and there's no base href inside.


Greetings
Michael

8 comments
Comment actions Permalink

Do you mean that the path includes a leading slash, making the reference relative to server root? https://youtrack.jetbrains.com/issue/IDEA-119445 is fixed in PHPStorm 8...

0
Comment actions Permalink

Perhaps it'S because my project does not point into the document root?

I have a project and inside that project i have multiple websites.

This is the structure i got right now.

Projectname
     - Domain1
     - Domain2
          index.php
          -assets
               - images
                    -icon.png
          -system
          -application
               -views
                    template.php

If i use the copy reference function for the file icon.png then phpstorm pastes Domain2/assets/images/icon.png. Normally it pasted assets/images/icon.png. Now it suddenly adds Domain2 to the beginning of the relative path. But then the relative path is invalid because it would lead to the folder Domain2/.... But the index.php is already inside the folder Domain2.

0
Comment actions Permalink

Hi there,

Reference is done relative to the project root (content root?). Since "Domain2" is ordinary folder in the project, it is included in the reference.

0
Comment actions Permalink

Ok - in understand.

But how can i manage 2 different Domains within one Project? My problem is, that the different domains share some data. They also use a few of the same mysql tables. If i create one project for each domain and assign the content root to the document root of this domain i have all the time to open a second instance or project of phpstorm to have access to the files of domains2.

0
Comment actions Permalink
If i create one project for each domain and assign the content root to the document root of this domain i have all the time to open a second instance or project of phpstorm to have access to the files of domains2.

Could you please clarify this moment a bit (preferably with screenshots)?

0
Comment actions Permalink

In fact the project root points to /var/www/ on the server. Inside /var/www/ i have 3 Folders - Domain1.com  - Domain2.com - Domain3.com. Each of these Folders is a document_root.



Attachment(s):
phpstorm.jpg
0
Comment actions Permalink

I do not see any "content roots" here: you have a folder ("...\MyProject") and 3 folders inside it ("Domain1.com" ...)

Content Roots in IDE terms is something different.

Try this one:
1) Open your project for Domain1.com (or create new one if it does not have it). Basically "...\MyProject\Domain1.com" should be the project root.
2) Go to "Settings | Directories" and add "Additional Content Root" -- point it to "...\MyProject\Domain2.com". Save changes and exit Settings screen

Now you should have project with 2 "roots"

Check if Copy Reference behaves any differently.

0
Comment actions Permalink

That's it - additional Content Root!

Thanks a lot!

0

Please sign in to leave a comment.