Pagelist filtering by language

Permalink 3 users found helpful
If anyone needs this e.g. display all news pages for a language. Just patch getPages()-method of the pageList controller with this:

Loader::model('section', 'multilingual');
$lang = MultilingualSection::getCurrentSection()->getLanguage();
$pl->filterByPath('/'.$lang);


CU
Markus

msglueck
View Replies:
MainostoimistoExx replied on at Permalink Reply
I really need this, would solve loads of problems, but I need more detailed answer. Just show that snippet of code where I need to apply this. :) I tried on my own and it resulted in errors. Only thing with getPages() I found was this

public function view() {
   $cArray = $this->getPages();
   $nh = Loader::helper('navigation');
   $this->set('nh', $nh);
   $this->set('cArray', $cArray);
}


and I changed it to this, and it simply caused loads of errors :)

public function view() {
   Loader::model('section', 'multilingual');
   $lang = MultilingualSection::getCurrentSection()->getLanguage();
   $pl->filterByPath('/'.$lang);
   $cArray = $this->getPages();
   $nh = Loader::helper('navigation');
   $this->set('nh', $nh);
   $this->set('cArray', $cArray);
}
tomekwi replied on at Permalink Reply
Thanks mate! Useful one
dscomix replied on at Permalink Reply
Can you please tell me where to put the code. The way I tried it, I only get error messages.

Thanks