Zend Framework 2 : MvcEvent – get __NAMESPACE__ / Module Name from Layout
I just created a module named ZfCommons that can initialize common functionality over module. For this post, i want to introduce a set ‘layout variable’ functionality with example : __NAMESPACE__, so we can echo-ing the module name / __NAMESPACE__ from layout.
Zend Framework 2 : Handling Trailing Slash “issue”
In fact, in web application, it’s better not to have two urls respond to the same thing. But we are a lazy programmer, right, RIGHT ? We don’t have a much time to remember the route where is end with “/” or not.
For example we have 2 url like this :
http://zf-tutorial/album/add – 200 – works fine
http://zf-tutorial/album/add/ – 404 – The requested URL could not be matched by routing.
To handle that, just add the empty “/” in the end of route segment :
'route' => '/[:controller[/[:action[/]]]]',
Or for “:slug” segment :
'route' => '/[:controller[/[:action[/[:slug[/]]]]]]',
I do not know if this is a best solution or not, but this is probably one of the easiest.
References :
1. http://zend-framework-community.634137.n4.nabble.com/Trailing-slash-td4655266.html
Zend Framework 2 : Zend\Paginator : Paginate Your Data
Zend Framework has a component named Zend\Paginator. It can paginate items into pages, paginate arbitrary data, not just relational databases, and fetch only the results that need to be displayed.
Zend Framework 2 : Create Your Custom View Helper
In MVC Architecture, sometimes, we have to do a “logic” to manage a view. The Logic is called by View named View Helper. Zend Framework 2 has a ton of flexibility, so, we can create a custom View Helper if we want to -that can be called by View Layer over modules.
Read More
Zend Framework 2 : Zend\I18n\Translator\Translator – Translate your Web Application
Zend Framework 2 comes with i18n Component which one of the features is translator. It can translate your content of the page that you register in file(s) as dictionary and called with this component. The type of format that can be handled by this components are :
Zend Framework 2 : Purists vs Pragmatic Developer
Kita semua tahu, bahwa segala macam teori yang ada, sebaiknya mendukung implementasi. Namun, pada akhirnya, teori kadang tak selalu bisa diimplementasikan dengan se-“ketat” yang seharusnya. Para developer aplikasi biasa terbagi menjadi 2, yaitu yang purists, dan yang satu pragmatis.
Baca Selengkapnya
Zend Framework 2 : ServiceLocator ControllerLoader – Get Module Configuration from Controller
Zend Framework 2, dengan segala fiturnya, telah mengubah pola pikir dalam membuat aplikasi secara modular. Dalam setiap module yang kita buat, kita mempunyai file konfigurasi yang bernama module.config.php yang nantinya akan di-merge dengan file-file konfigurasi di module lain.
12 comments