April 11th, 2012
At the time of this writing, Nette lacks a good support for dynamic snippets. You can define them wrapped in a static snippet but you can’t invalidate them individually (unless they each belong to a different control, I think). You can only invalidate the static parent snippet which means you receive all its dynamic children snippets in the payload.
If you defined only a few snippets with small amount of data in each then no big deal. If however, you have a pageful of forms, each form containing a snippet that you want updated upon the parent form submission then you have to resort to tricks. For instance, you don’t want a message “Saved” displayed in each row/form in a product administration table.
Read the rest of this entry »
Tags: Nette Framework 2.0.1 (revision 94abcaa released on 2012-02-29)
Posted in Nette | No Comments »
March 22nd, 2012
Many applications use the default Windows colour picker which unfortunately, doesn’t support hexa codes. Use this bookmarklet to convert and copy the decimal values from your browser to the picker. No need to bullshit around, here’s the thing :-)
Drag this onto your bookmark toolbar:
RGB hex2dec
Read the rest of this entry »
Posted in Tools | 1 Comment »
November 30th, 2011
There are many ways to handle image thumbnails. Sites with heavy traffic generate resized copies right after the original image is uploaded. Light traffic sites on the other hand, prefer to wait until the thumbnail is actually requested. Nette offers a few creative ways to handle this:
- You can use .htaccess to catch requests for non-existent thumbnails and redirect them to your script.
- Following the same theme, you can also use your ErrorPresenter to generate the thumbnail and override the response code (so that it’s not 404).
- An unusual solution is to use a helper and generate the thumbnail when rendering your template.
- Or simply use a presenter action.
In any of these cases, you need to decide where you’re going to store the thumbnail and how you’re going to delete/update it when the main image changes. This is where you can use the excellent built-in caching aparatus.
Read the rest of this entry »
Tags: Nette Framework 2.0-beta (revision 8a3182e released on 2011-10-11)
Posted in Nette | No Comments »
November 23rd, 2011
As you have probably guessed by now, I love Nette. The more it hurts when I see the documentation lag behind the quality of the framework. Although I don’t understand why Latte built-in macros don’t include n:src when the oh-so-useful n:href is there my main concern however, is that nowhere in the documentation you’ll find detailed information on how to add it yourself. You’re condemned to endlessly search through forum again and crawl through various outdated subdomains of nette.org.
Here’s my solution to the n:src alias based on a post in the cookbook and the built-in n:href macro. You can also take a peek an another post of mine on how to tweak your forms using macros. As always, hopefully it’ll save you some time.
Read the rest of this entry »
Tags: Nette Framework 2.0-beta (revision 8a3182e released on 2011-10-11)
Posted in Nette | No Comments »
November 22nd, 2011
Often you want the user to have a form not just for one entity but for all of them on the same page. A form for each product in the same category, for example. I’m not talking about multiple different forms but multiple instances of the same form.
This topic has been discussed in the Nette forum so many times that it’s really a shame that it’s still missing in the documentation. Frustrated after an hour spent reading outdated forum posts, I offer here a complete solution based on one of the posts.
Read the rest of this entry »
Tags: Nette Framework 2.0-beta (revision 8a3182e released on 2011-10-11)
Posted in Nette | 2 Comments »