X

An Oracle blog about NetBeans for PHP

Nette Framework with Latte Templates (and one more thing)

Hi all! After few weeks we would like to introduce you some new features which will be available in NetBeans 7.4. And what is it about? It's about new framework support! For NetBeans 7.4 we added a support for Nette Framework with Latte Templates.

Not sure if all of you know it, so here is an official introduction: "A popular tool for PHP web development. It is designed to be the most usable as possible and is definitely one of the safest one. It speaks your language and helps you to easily build better websites."

If you remember, we wrote about Nette Framework few months ago when we added a support for the Neon file type, which is a configuration file type for most of Nette Framework applications, and then once again when we introduced new ApiGen suppport, which is an API generation tool based on Nette Framework.

Nette Framework also has a great and active community, so if you have a problem, don't hesitate to ask on an offical Nette Framework forum! You will receive an answer in minutes ;)

Ok, so let's look at some features :)

Nette Framework

Let's start with support of the framework part. As usual, Nette Framework has it's own Options tab. You can select a directory with Nette Framework sources and a directory with Nette Framework sandbox.

These both information are useful when you try to create a new project and in a framework selection step select a Nette2 Framework. Then you can decide to copy Nette Framework sources into your project and if you properly set a path to the Nette Framework sandbox directory, then it's automatically created in your new project.

We try to automatically detect whether the Nette Framework is used in your project to provide some framework specific features (such as custom @persistent annotation, code generator for action and render methods, or Go to View action), but when the detection fails (e.g. due to non-standard directory structure), you can enable whole support manually in Project Properties.

Latte Templates

At first, what is Latte Template? If you know Smarty or Twig, then you will exactly know what it is. It's just a HTML file, with a custom extension (.latte), which contains some embedded parts which are "somehow processed by Latte Templating engine". You can read much more in an official documentation of Latte Templates.

And what we support? For example coloring (of embedded Latte parts, comments and such). But our coloring is a bit clever ;) In Latte Templates, you can switch to another Latte delimiters in one file (or in HTML element) without any problem. Just use {syntax ...} macro or n:syntax="..." tag in a HTML element. NetBeans catches that and colors following source properly :)

And another great thing is code completion. It work for macros, helpers and keywords. And it works for n:tags too ;)

One more thing

Now all of you know, that Neon file type is a common configuration file for Nette Framework applications. It has some special sections like services: and such. And in these sections you will sometimes need to write some PHP types with fully qualified name (to specify factory classes and such). So it would be helpful to have some code completion in there, right? Ok, so it's there! ;) It's simple, it just lists all of PHP types from your project, but it's better then nothing, isn't it? :)

And that's all for today and as usual, please test it and if you find something strange, don't hesitate to file a new issue (product php, component Nette / Latte / Neon). Thanks a lot!

Join the discussion

Comments ( 11 )
  • Filip Procházka Thursday, May 9, 2013

    Great work! Thank you for supporting Nette Framework!


  • Ondrej Brejla Thursday, May 9, 2013

    You are welcome ;)


  • srigi Thursday, May 9, 2013

    This is awesome. Really thinking going back to Netbeans on my Nette projects. Amazing work.


  • Ondrej Brejla Thursday, May 9, 2013

    Don't hesitate to try it ;)


  • lano Thursday, May 9, 2013

    I hope to see more supported frameworks in NetBeans.

    Especially Laravel 4 which should be released in stable version in 2 or 3 weeks!


  • enumag Thursday, May 9, 2013

    WOW! Kind of glad I didn't have time to seriously try PHPStorm. Very much appriciated!


  • Sherif Sabry Friday, May 10, 2013

    Great work guys have been really hoping for this for a long time.

    BTW Is there any plans to add support for Behat framework? It's THE framework of choice of many developers when it comes to BDD.

    I opened a feature request long time ago, but no feedback was given:

    https://netbeans.org/bugzilla/show_bug.cgi?id=226804

    Did I make a mistake somewhere in the request?


  • Eli McMakin Friday, May 10, 2013

    NetBeans keeps adding support for frameworks, which is awesome. I would also like to +1 the support for Laravel 4 support. That framework seems to be gaining a lot of traction.


  • Martin Tuesday, October 22, 2013

    Hi Ondrej,

    great job, many thanks for new version! NetBeans is my favourite PHP IDE for several years.

    One thing I am missing in new 7.4 - there used to be such wizzard in nette plugin in 7.3, where you can really easilly create presenter with desired render/action methods and with all related latte templates. Are you going to add this feature soon?

    Toggling in config.neon is great, but intellisense for classes in my service section sadly doesn't work :-(

    I am running NetBeans 7.4 on Ubuntu 12.04 LTS 64bit, KDE desktop.

    Many thanks for your job and I am looking forward to your answer. Martin


  • Ondrej Brejla Tuesday, October 22, 2013

    Martin:

    Hi, thanks ;)

    No I don't think that the wizard is needed, you can simply create your presenter by standard Class wizard (select a proper NS from new UI) and then just use "Insert Code" action inside it (Source -> Insert Code, or keybord shortcut). There you can simply add render/action methods.

    Really don't know why CC doesn't work in your case. Example simple project would be useful (you can file new issue in bugzilla and attach it there).


  • Martin Thursday, October 24, 2013

    Ondrej: Ok, thanks for info! I know "Insert Code" but I didn't notice "Action and/or Render method..." - that's fine, but still: wizard has included template folder + all latte files creating - it was so comfortable! :-)

    I will try show simple example and put it into bugzilla. Maybe it could be because of module file structure? Or because of fact, that my model classes are not using namespace in purpose. I will try to find out.

    But again, IMHO, NetBeans IDE really rocks, it is the best! :-)


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services