Using Eclipse for PHP Developers Version: 3.0.2 (latest Zend download)
What I want to do, is to exclude some single .xml / .html files from validation. Seemed to be straight forward.
SO " https://stackoverflow.com/a/5288496/356726 " says to use Project / Properties / Validation, but I do not have this menu item.
SO " How to exclude specific folders or files from validation in Eclipse? " refers to Window / Preferences. I checked through the sections in order to find the exclude sections, but I was unable to locate it. I can set project specific settings, but where do I exclude single files?
What do I miss? I am sure it is pretty simple.
Project Properties:
Window / Preferences:
This worked for me (Eclipse Indigo, Java project):
project -> right click -> Properties -> Validation
check Enable project specific settings
XmlValidator: check Manual, check Build, click "..." for Settings
Add Exclude Group, select it
Add Rule -> Folder or file name -> select file you want to ignore
refresh project (or close and open)
This instruction assumes the button Add Exclude Group in step 4 is enabled. However, in my case the button was disabled. I don't know the reason but I discovered following workaround:
4a. Add (empty) Include Group
4b. Open file PROJECT_HOME.settings\org.eclipse.wst.validation.prefs
4c. Edit key vals/org.eclipse.wst.xml.core.xml/groups - change 07include00 to 07exclude00 near the end of string
4d. Refresh project, open project properties again
Related
I use Eclipse with PDT, Version: Mars.2 Release (4.5.2).
I have a folder called "var" in my PHP project that I would like to exclude from build, so I excluded it in Build Path using var/**. Though, even then, it still give me errors in this folder after doing a clean/build. I also tried var/, var/* and all combinations of those. Nothing do it, Eclipse still validate those files. Those are temporary files, so it's really annoying to have the IDE working for nothing on those files.
Buld Path is for PHP validator excludes. You have couple options:
Exclude from workspace. Right click on level up dir (project) -> Properties -> Resource -> Resource Filters.
Create excludes inside project -> validation page.
Mark dir as library. When is part of build path, right click on it -> Use as library folder.
I use PSR-2 for code styling my code.
When I inspect a file using Codesniffer most of the times I get the following error.
332 | ERROR | [x] Expected 1 newline at end of file; 0 found
It's obvious how to fix this. What I need to know is if PhpStorm has a way to add the 1 newline at end of file
I already loaded the predefined style from Settings -> Editor -> Code Style -> PHP -> Set From -> PSR-1/PSR-2 and also used the Reformat Code to change the CS accordingly.
Everything is fixed except from the new line. Am I missing something?
You already have two answers for how to turn it on for ALL file types in IDE (in short: Settings/Preferences | Editor | General -> Ensure line feed at file end on Save).
In modern version (2020.3) that option has been reworded a bit. Now it says Ensure every saved file ends with a line break
To do this for .php files only you can do the following:
Install EditorConfig plugin (if you do not have it installed yet). In modern versions it is already bundled and enabled by default.
Create .editorconfig file in your project root (or whatever folder that would be where you want to apply such style -- it will be applied to files in this folder and below). If you have one already -- open and inspect it
Add rule for *.php files only -- property to use would be insert_final_newline
An example:
[*.php]
insert_final_newline = true
Links:
EditorConfig site
List of supported proerties
someone said picture speaks louder :D
you will need to tick the Ensure line feed at file end on save box
In PhpStorm preferences go to:
Editor > General
Check the box "Other: Ensure line feed at file end on Save."
Just realize this affects all code files you edit in PhpStorm, not just PHP files.
Under Settings: Editor > General click Ensure line feed at file end on save is checked.
It will add a new line to EVERY file (.js, .css, .html), but it's the only way I've found, and it's a small hit for allowing PSR-2.
I know how to exclude meta and log files from index inclusion but in my application's composer.json I have both Guzzle and Goutte listed as dependencies. Goutte includes a goutte.phar which in turn contains the source code for Guzzle. So when I go to use autocompletion I get this:
Is there anyway to exclude a *.phar file (or any specific PHP file for that matter) from the PHPStorm indices?
Right click on that file and select mark as -> excluded?
From the docs :
In the Project tool window, select the required .phar archive and choose Exclude phar from project on the context menu of the selection.
otherwise you can add *.phar to Settings -> Editor -> File types -> Ignored files and folders
or alternatively to Settings -> Directories -> Exclude files
I have a project with some php and html files. URL for this project, for exmaple, - mysite.com
I need to create a subdomain for content, that will be moved to CDN: assets.mysite.com
Now, during development time, all files for subdomain are stored in a subfolder of my project /home/user/phpstormprojects/mysite/assets
In my html/php files I need to specify full path to my assets
html://assets.mysite.com/mybest.png
Of cource I want autocompletion and other features to work well.
So I need to set up phpstorm smth like "assets.mysite.com" = "/home/user/phpstormprojects/mysite/assets"
Could I do it?
I am using PhpStorm 7.1.3
Ensure your cursor has highlighted the project name.
At the menu on top select "File" then "New" then "Directory".
Name your directory. It will go under the project name (see step 1).
Right click on the new directory then select "Mark Directory As" a
pop-up will appear giving you the option to mark the new directory
as "Resource Root".
Put whatever directories you want inside it. PhpStorm will rename all references to them in your code.
I'am new to SVN, and I can't find a solution to make "after commit" update a specific txt file.
I have a php project, within changelog.txt inside the root folder (at the same level where index.php is located). What I want is that after each svn commit, my changelog.txt will be updated with some information by looking like this:
*** YYYY-MM-DD HH:MM by SVN_USERNAME
SVN_COMMIT_MESSAGE
-------------------------------------------------
*** 2010-09-22 18:31 by marco.belinni
- eshop category navigation - fixed issue with navigation, due overcaching with previous version of seo tool
-------------------------------------------------
*** 2010-09-20 01:03 by jean.laroche
- plg_c16n - fixed canonicalization with SEO Plugin which redirects non www urls to www urls
- mod_login - fixed ie and ff login, hidded input type "remember me" with checked paramater
- the whole frontpage have bolded text because of bolded "READ MORE" button - need to clean it before posting any article
- eshop browse - 10products per page FIXED by clearing cache and purged ALL urls
- eshop orderby - removed useless "SELECT" option in selection field for sorting out the items on page
-------------------------------------------------
I tried to find some info but there was a plenty websites showing the exemples with C++ programming. Is there any other solution to use only SVN and PHP ? As I'am not even a newbie in C++.
UPDATED
Here is a visual to show you where my changelog.txt is:
- web
|- framework
| + engine
| + framework
- web
+ css
+ images
| index.php
-->| changelog.txt
Thanks
I'm going to assume your changelog is stored in SVN itself. In which case, stop right there.
You cannot update a file that's stored in SVN after committing, because it will then need committing, which will trigger the update that makes it need committing... you get the idea.
You can happily write data to a new file and use that however, simply create a file called post_commit in the hooks directory and put some script in it (and script language you like) to call svn log, pipe the output to your changelog file.