views:

304

answers:

3

I can't get project-specific licenses to work in my Netbeans File Templates. I have a template called "PHP File". The contents look like this...

<?php
<#assign licenseFirst = "/*">
<#assign licensePrefix = " * ">
<#assign licenseLast = " */">
<#include "../Licenses/license-${project.license}.txt">
?>

I also added a file template to the "Licenses" directory named "license-test.txt". It contains the license info for this particular project.

I have modified my "properties.project" file to assign a specific license (called "test") for this project. My "project.properties" file looks like this...

include.path=${php.global.include.path}
source.encoding=UTF-8
src.dir=../../../../../wamp/www/test-project
tags.asp=false
tags.short=true
web.root=.
project.license=test

When I create a new page based on the "PHP File" template, it gives me the default license, instead of the "license-test.php" license. If I modify the "PHP File" file template, and change line 5 to:

<#include "../Licenses/license-test.txt">

...everything works fine. So I know the license is working. There must be an error in either the assigning or calling of the "project.license" variable. Any ideas?

I am using Netbeans 6.7.1 (PHP) and I have been following this tutorial to get this to work. Also, in case it matters, I am storing my Netbeans project data in a location outside of the actual website file structure.

A: 

You have mixed names in your description...

In the PHP template you say that you want license-test.txt...

You say that you created a license file named license-test.php...

It looks like your license file should be named license dash test dot txt... not dot php...

vkraemer
Sorry, that was a typo when submitting my question to Stackflow. It is named properly in my application. Which is why it works if I manually call it from the template file, instead of using the "project.license" variable/property. Thank you for looking into my problem though.
mikemick
A: 

I'm having the same problem and so are others at this netbeans forum post - http://forums.netbeans.org/topic11600.html

efnx clckclcks
A: 

What you see in the Template manager is the 'display name' of the file which may be different from the actual file name. But the project.license property refers to the actual file name. If you right-click on an entry in template manager and select Properties you can view and rename the actual file. If you make this the same as the display name this should now be picked up.

Peter Hull