model view controller - Return different viewmodels in desktop and mobile versions for the same action in zend framework -
in zf2 application have show database records in mobile , desktop versions different criteria , conditions. mobile version have used getusermobiletable()
function , desktop version getuserdesktoptable()
.
for mobile version action should work
public function useraction() { return new viewmodel(array('rowset' => $this->getusermobiletable()->select())); }
for desktop version action should work
public function useraction() { return new viewmodel(array('rowset' => $this->getuserdesktoptable()->select())); }
what should logic it? need use navigator.useragent
in javascript detect agent? if how? please i've no idea i'm new zend framework.
you can use mobile detect module detect user's device.
you logic in same action , select different template in example
Comments
Post a Comment